Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2021-04-25 11:58:24 +03:00
parent bae3b0ef94
commit 00a4785df3
8 changed files with 14 additions and 15 deletions

View File

@ -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 {

View File

@ -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 {

View File

@ -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
}

View File

@ -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
}

View File

@ -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 {

View File

@ -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

View File

@ -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 {

View File

@ -6,8 +6,8 @@ import (
)
type memorySync struct {
options Options
locks map[string]*memoryLock
options Options
mtx gosync.RWMutex
}