From 00a4785df322e91fba396bcec299658a5dd2e86a Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 25 Apr 2021 11:58:24 +0300 Subject: [PATCH] fixup Signed-off-by: Vasiliy Tolstov --- broker/memory.go | 6 +++--- client/test_request.go | 4 ++-- register/memory.go | 3 +-- router/watcher.go | 4 ++-- server/health/health.go | 4 ++-- server/noop.go | 4 ++-- store/memory.go | 2 +- sync/memory.go | 2 +- 8 files changed, 14 insertions(+), 15 deletions(-) diff --git a/broker/memory.go b/broker/memory.go index 5c5c5eac..ab231b57 100644 --- a/broker/memory.go +++ b/broker/memory.go @@ -13,27 +13,27 @@ import ( ) type memoryBroker struct { - opts Options Subscribers map[string][]*memorySubscriber addr string + opts Options sync.RWMutex connected bool } type memoryEvent struct { - opts Options err error message interface{} topic string + opts Options } type memorySubscriber struct { - opts SubscribeOptions ctx context.Context exit chan bool handler Handler id string topic string + opts SubscribeOptions } func (m *memoryBroker) Options() Options { diff --git a/client/test_request.go b/client/test_request.go index 7a3972c5..0b4b7729 100644 --- a/client/test_request.go +++ b/client/test_request.go @@ -5,13 +5,13 @@ import ( ) type testRequest struct { - opts RequestOptions codec codec.Codec body interface{} + service string method string endpoint string contentType string - service string + opts RequestOptions } func (r *testRequest) ContentType() string { diff --git a/register/memory.go b/register/memory.go index 953c4177..112bf21a 100644 --- a/register/memory.go +++ b/register/memory.go @@ -30,10 +30,9 @@ type record struct { } type memory struct { - opts Options - // records is a KV map with domain name as the key and a services map as the value records map[string]services watchers map[string]*watcher + opts Options sync.RWMutex } diff --git a/router/watcher.go b/router/watcher.go index f3663d9e..af4786cd 100644 --- a/router/watcher.go +++ b/router/watcher.go @@ -38,12 +38,12 @@ func (t EventType) String() string { // Event is returned by a call to Next on the watcher. type Event struct { - // Route is table route - Route Route // Timestamp is event timestamp Timestamp time.Time // Id of the event Id string + // Route is table route + Route Route // Type defines type of event Type EventType } diff --git a/server/health/health.go b/server/health/health.go index 119da14e..ce91b8f9 100644 --- a/server/health/health.go +++ b/server/health/health.go @@ -23,10 +23,10 @@ type CheckFunc func(context.Context) error type Option func(*Options) type Options struct { - LiveChecks []CheckFunc - ReadyChecks []CheckFunc Version string Name string + LiveChecks []CheckFunc + ReadyChecks []CheckFunc } func LiveChecks(fns ...CheckFunc) Option { diff --git a/server/noop.go b/server/noop.go index bede5f71..63819965 100644 --- a/server/noop.go +++ b/server/noop.go @@ -32,13 +32,13 @@ const ( ) type noopServer struct { - opts Options h Handler + wg *sync.WaitGroup rsvc *register.Service handlers map[string]Handler subscribers map[*subscriber][]broker.Subscriber exit chan chan error - wg *sync.WaitGroup + opts Options sync.RWMutex registered bool started bool diff --git a/store/memory.go b/store/memory.go index 6cc6a8fb..9b65cf2d 100644 --- a/store/memory.go +++ b/store/memory.go @@ -28,8 +28,8 @@ func (m *memoryStore) Disconnect(ctx context.Context) error { } type memoryStore struct { - opts Options store *cache.Cache + opts Options } func (m *memoryStore) key(prefix, key string) string { diff --git a/sync/memory.go b/sync/memory.go index 05c44ded..8eb1ed95 100644 --- a/sync/memory.go +++ b/sync/memory.go @@ -6,8 +6,8 @@ import ( ) type memorySync struct { - options Options locks map[string]*memoryLock + options Options mtx gosync.RWMutex }