fixed struct alignment && refactor linter (#369)
All checks were successful
test / test (push) Successful in 42s
All checks were successful
test / test (push) Successful in 42s
## Pull Request template Please, go through these steps before clicking submit on this PR. 1. Give a descriptive title to your PR. 2. Provide a description of your changes. 3. Make sure you have some relevant tests. 4. Put `closes #XXXX` in your comment to auto-close the issue that your PR fixes (if applicable). **PLEASE REMOVE THIS TEMPLATE BEFORE SUBMITTING** Reviewed-on: #369 Co-authored-by: Evstigneev Denis <danteevstigneev@yandex.ru> Co-committed-by: Evstigneev Denis <danteevstigneev@yandex.ru>
This commit is contained in:
@@ -775,13 +775,16 @@ func (s *subscriber) Options() SubscriberOptions {
|
||||
}
|
||||
|
||||
type subscriber struct {
|
||||
topic string
|
||||
|
||||
typ reflect.Type
|
||||
subscriber interface{}
|
||||
topic string
|
||||
endpoints []*register.Endpoint
|
||||
handlers []*handler
|
||||
opts SubscriberOptions
|
||||
rcvr reflect.Value
|
||||
|
||||
endpoints []*register.Endpoint
|
||||
handlers []*handler
|
||||
|
||||
rcvr reflect.Value
|
||||
opts SubscriberOptions
|
||||
}
|
||||
|
||||
type handler struct {
|
||||
|
||||
@@ -38,7 +38,9 @@ func TestNoopSub(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
_ = logger.DefaultLogger.Init(logger.WithLevel(logger.ErrorLevel))
|
||||
if err := logger.DefaultLogger.Init(logger.WithLevel(logger.ErrorLevel)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
s := server.NewServer(
|
||||
server.Broker(b),
|
||||
server.Codec("application/octet-stream", codec.NewCodec()),
|
||||
|
||||
@@ -24,36 +24,11 @@ type Option func(*Options)
|
||||
|
||||
// Options server struct
|
||||
type Options struct {
|
||||
// Context holds the external options and can be used for server shutdown
|
||||
Context context.Context
|
||||
// Broker holds the server broker
|
||||
Broker broker.Broker
|
||||
// Register holds the register
|
||||
Register register.Register
|
||||
// Tracer holds the tracer
|
||||
Tracer tracer.Tracer
|
||||
// Logger holds the logger
|
||||
Logger logger.Logger
|
||||
// Meter holds the meter
|
||||
Meter meter.Meter
|
||||
|
||||
/*
|
||||
// Router for requests
|
||||
Router Router
|
||||
*/
|
||||
|
||||
// Listener may be passed if already created
|
||||
Listener net.Listener
|
||||
// Wait group
|
||||
Wait *msync.WaitGroup
|
||||
// TLSConfig specifies tls.Config for secure serving
|
||||
TLSConfig *tls.Config
|
||||
// Metadata holds the server metadata
|
||||
Metadata metadata.Metadata
|
||||
// RegisterCheck run before register server
|
||||
RegisterCheck func(context.Context) error
|
||||
// Codecs map to handle content-type
|
||||
Codecs map[string]codec.Codec
|
||||
// Metadata holds the server metadata
|
||||
Metadata metadata.Metadata
|
||||
|
||||
// ID holds the id of the server
|
||||
ID string
|
||||
// Namespace for te server
|
||||
@@ -66,21 +41,46 @@ type Options struct {
|
||||
Advertise string
|
||||
// Version holds the server version
|
||||
Version string
|
||||
// RegisterAttempts holds the number of register attempts before error
|
||||
RegisterAttempts int
|
||||
|
||||
// Context holds the external options and can be used for server shutdown
|
||||
Context context.Context
|
||||
// Broker holds the server broker
|
||||
Broker broker.Broker
|
||||
// Register holds the register
|
||||
Register register.Register
|
||||
// Tracer holds the tracer
|
||||
Tracer tracer.Tracer
|
||||
// Logger holds the logger
|
||||
Logger logger.Logger
|
||||
// Meter holds the meter
|
||||
Meter meter.Meter
|
||||
// Listener may be passed if already created
|
||||
Listener net.Listener
|
||||
|
||||
// TLSConfig specifies tls.Config for secure serving
|
||||
TLSConfig *tls.Config
|
||||
// Wait group
|
||||
Wait *msync.WaitGroup
|
||||
|
||||
// RegisterCheck run before register server
|
||||
RegisterCheck func(context.Context) error
|
||||
|
||||
// Hooks may contains hook actions that performs before/after server handler
|
||||
// or server subscriber handler
|
||||
Hooks options.Hooks
|
||||
|
||||
// RegisterInterval holds he interval for re-register
|
||||
RegisterInterval time.Duration
|
||||
// RegisterTTL specifies TTL for register record
|
||||
RegisterTTL time.Duration
|
||||
// GracefulTimeout timeout for graceful stop server
|
||||
GracefulTimeout time.Duration
|
||||
// MaxConn limits number of connections
|
||||
MaxConn int
|
||||
// DeregisterAttempts holds the number of deregister attempts before error
|
||||
DeregisterAttempts int
|
||||
// Hooks may contains hook actions that performs before/after server handler
|
||||
// or server subscriber handler
|
||||
Hooks options.Hooks
|
||||
// GracefulTimeout timeout for graceful stop server
|
||||
GracefulTimeout time.Duration
|
||||
// RegisterAttempts holds the number of register attempts before error
|
||||
RegisterAttempts int
|
||||
}
|
||||
|
||||
// NewOptions returns new options struct with default or passed values
|
||||
@@ -318,14 +318,14 @@ type SubscriberOptions struct {
|
||||
Context context.Context
|
||||
// Queue holds the subscription queue
|
||||
Queue string
|
||||
// BatchWait flag specifies max wait time for batch filling
|
||||
BatchWait time.Duration
|
||||
// BatchSize flag specifies max size of batch
|
||||
BatchSize int
|
||||
// AutoAck flag for auto ack messages after processing
|
||||
AutoAck bool
|
||||
// BodyOnly flag specifies that message without headers
|
||||
BodyOnly bool
|
||||
// BatchSize flag specifies max size of batch
|
||||
BatchSize int
|
||||
// BatchWait flag specifies max wait time for batch filling
|
||||
BatchWait time.Duration
|
||||
}
|
||||
|
||||
// NewSubscriberOptions create new SubscriberOptions
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
// DefaultServer default server
|
||||
var (
|
||||
DefaultServer Server = NewServer()
|
||||
DefaultServer = NewServer()
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
Reference in New Issue
Block a user