diff --git a/broker/.snapshots/broker-glob--func1-2-1-bkr1-results b/broker/.snapshots/broker-glob--func1-2-1-bkr1-results deleted file mode 100644 index 344c5199..00000000 --- a/broker/.snapshots/broker-glob--func1-2-1-bkr1-results +++ /dev/null @@ -1,6 +0,0 @@ -(map[string]moleculer.Payload) (len=4) { - (string) (len=10) "food-lunch": (serializer.JSONPayload) input: (lunch param ) -> output: ( lunch result ), - (string) (len=11) "food-dinner": (serializer.JSONPayload) input: (dinner param ) -> output: ( dinner result ), - (string) (len=11) "music-start": (*payload.RawPayload)(input: (start param ) -> output: ( start result )), - (string) (len=9) "music-end": (*payload.RawPayload)(input: (end param ) -> output: ( end result )) -} diff --git a/broker/.snapshots/broker-glob--func1-2-1-bkr2-results b/broker/.snapshots/broker-glob--func1-2-1-bkr2-results deleted file mode 100644 index 159b6d79..00000000 --- a/broker/.snapshots/broker-glob--func1-2-1-bkr2-results +++ /dev/null @@ -1,6 +0,0 @@ -(map[string]moleculer.Payload) (len=4) { - (string) (len=10) "food-lunch": (*payload.RawPayload)(input: (lunch param ) -> output: ( lunch result )), - (string) (len=11) "food-dinner": (*payload.RawPayload)(input: (dinner param ) -> output: ( dinner result )), - (string) (len=11) "music-start": (serializer.JSONPayload) input: (start param ) -> output: ( start result ), - (string) (len=9) "music-end": (serializer.JSONPayload) input: (end param ) -> output: ( end result ) -} diff --git a/broker/broker.go b/broker/broker.go index 918a17aa..36df9af0 100644 --- a/broker/broker.go +++ b/broker/broker.go @@ -11,7 +11,6 @@ import ( "github.com/moleculer-go/moleculer/context" "github.com/moleculer-go/moleculer/metrics" "github.com/moleculer-go/moleculer/middleware" - "github.com/moleculer-go/moleculer/options" "github.com/moleculer-go/moleculer/payload" "github.com/moleculer-go/moleculer/registry" "github.com/moleculer-go/moleculer/serializer" @@ -92,6 +91,8 @@ type ServiceBroker struct { delegates *moleculer.BrokerDelegates + id string + localNode moleculer.Node } @@ -179,9 +180,8 @@ func (broker *ServiceBroker) createBrokerLogger() *log.Entry { log.SetLevel(log.InfoLevel) } - nodeID := broker.config.DiscoverNodeID() brokerLogger := log.WithFields(log.Fields{ - "broker": nodeID, + "broker": broker.id, }) //broker.logger.Debug("Broker Log Setup -> Level", log.GetLevel(), " nodeID: ", nodeID) return brokerLogger @@ -228,7 +228,8 @@ func (broker *ServiceBroker) Start() { broker.logger.Warn("broker.Start() called on a broker that already started!") return } - broker.logger.Info("Broker -> Starting...") + broker.logger.Info("Moleculer is starting...") + broker.logger.Info("Node ID: ", broker.localNode.GetID()) broker.middlewares.CallHandlers("brokerStarting", broker.delegates) @@ -254,7 +255,7 @@ func (broker *ServiceBroker) Start() { defer broker.middlewares.CallHandlers("brokerStarted", broker.delegates) broker.started = true - broker.logger.Info("Broker -> Started !!!") + broker.logger.Info("Service Broker with ", len(broker.services), " service(s) started successfully.") } func (broker *ServiceBroker) Stop() { @@ -262,7 +263,7 @@ func (broker *ServiceBroker) Stop() { broker.logger.Info("Broker is not started!") return } - broker.logger.Info("Broker -> Stopping...") + broker.logger.Info("Service Broker is stopping...") broker.middlewares.CallHandlers("brokerStopping", broker.delegates) @@ -334,13 +335,13 @@ func (broker *ServiceBroker) MCall(callMaps map[string]map[string]interface{}) c } // Call : invoke a service action and return a channel which will eventualy deliver the results ;) -func (broker *ServiceBroker) Call(actionName string, params interface{}, opts ...moleculer.OptionsFunc) chan moleculer.Payload { +func (broker *ServiceBroker) Call(actionName string, params interface{}, opts ...moleculer.Options) chan moleculer.Payload { broker.logger.Trace("Broker - Call() actionName: ", actionName, " params: ", params, " opts: ", opts) if !broker.IsStarted() { panic(errors.New("Broker must be started before making calls :(")) } - actionContext := broker.rootContext.ChildActionContext(actionName, payload.New(params), options.Wrap(opts)) - return broker.registry.LoadBalanceCall(actionContext, options.Wrap(opts)) + actionContext := broker.rootContext.ChildActionContext(actionName, payload.New(params), opts...) + return broker.registry.LoadBalanceCall(actionContext, opts...) } func (broker *ServiceBroker) Emit(event string, params interface{}, groups ...string) { @@ -400,6 +401,7 @@ func (broker *ServiceBroker) registerInternalMiddlewares() { } func (broker *ServiceBroker) init() { + broker.id = broker.config.DiscoverNodeID() broker.logger = broker.createBrokerLogger() broker.setupLocalBus() @@ -410,7 +412,7 @@ func (broker *ServiceBroker) init() { broker.logger.Debug("Config middleware after: \n", broker.config) broker.delegates = broker.createDelegates() - broker.registry = registry.CreateRegistry(broker.delegates) + broker.registry = registry.CreateRegistry(broker.id, broker.delegates) broker.localNode = broker.registry.LocalNode() broker.rootContext = context.BrokerContext(broker.delegates) @@ -423,8 +425,8 @@ func (broker *ServiceBroker) createDelegates() *moleculer.BrokerDelegates { Bus: broker.LocalBus, IsStarted: broker.IsStarted, Config: broker.config, - ActionDelegate: func(context moleculer.BrokerContext, opts ...moleculer.OptionsFunc) chan moleculer.Payload { - return broker.registry.LoadBalanceCall(context, options.Wrap(opts)) + ActionDelegate: func(context moleculer.BrokerContext, opts ...moleculer.Options) chan moleculer.Payload { + return broker.registry.LoadBalanceCall(context, opts...) }, EmitEvent: func(context moleculer.BrokerContext) { broker.registry.LoadBalanceEvent(context) @@ -459,6 +461,5 @@ func New(userConfig ...*moleculer.Config) *ServiceBroker { config := mergeConfigs(moleculer.DefaultConfig, userConfig) broker := ServiceBroker{config: config} broker.init() - broker.logger.Info("Broker - New() ") return &broker } diff --git a/context/contextFactory.go b/context/contextFactory.go index 4541157a..046d6aea 100644 --- a/context/contextFactory.go +++ b/context/contextFactory.go @@ -5,7 +5,6 @@ import ( "fmt" "github.com/moleculer-go/moleculer" - "github.com/moleculer-go/moleculer/options" "github.com/moleculer-go/moleculer/payload" "github.com/moleculer-go/moleculer/util" @@ -24,7 +23,7 @@ type Context struct { groups []string broadcast bool params moleculer.Payload - meta *map[string]interface{} + meta moleculer.Payload timeout int level int } @@ -37,6 +36,7 @@ func BrokerContext(broker *moleculer.BrokerDelegates) moleculer.BrokerContext { broker: broker, level: 1, parentID: "ImGroot;)", + meta: payload.Empty(), } return &context } @@ -45,12 +45,8 @@ func BrokerContext(broker *moleculer.BrokerDelegates) moleculer.BrokerContext { func (context *Context) ChildEventContext(eventName string, params moleculer.Payload, groups []string, broadcast bool) moleculer.BrokerContext { parentContext := context meta := parentContext.meta - if meta == nil { - metaMap := make(map[string]interface{}) - meta = &metaMap - } if context.broker.Config.Metrics { - (*meta)["metrics"] = true + meta = meta.Add("metrics", true) } id := util.RandomString(12) var requestID string @@ -80,15 +76,14 @@ func (context *Context) BrokerDelegates() *moleculer.BrokerDelegates { } // ChildActionContext : create a chiold context for a specific action call. -func (context *Context) ChildActionContext(actionName string, params moleculer.Payload, opts ...moleculer.OptionsFunc) moleculer.BrokerContext { +func (context *Context) ChildActionContext(actionName string, params moleculer.Payload, opts ...moleculer.Options) moleculer.BrokerContext { parentContext := context meta := parentContext.meta - if meta == nil { - metaMap := make(map[string]interface{}) - meta = &metaMap - } if context.broker.Config.Metrics { - (*meta)["metrics"] = true + meta = meta.Add("metrics", true) + } + if len(opts) > 0 && opts[0].Meta != nil && opts[0].Meta.Len() > 0 { + meta = meta.AddMany(opts[0].Meta.RawMap()) } id := util.RandomString(12) var requestID string @@ -118,9 +113,8 @@ func checkMaxCalls(context *Context) { // ActionContext create an action context for remote call. func ActionContext(broker *moleculer.BrokerDelegates, values map[string]interface{}) moleculer.BrokerContext { var level int - var parentID string var timeout int - var meta map[string]interface{} + var meta moleculer.Payload sourceNodeID := values["sender"].(string) id := values["id"].(string) @@ -129,14 +123,22 @@ func ActionContext(broker *moleculer.BrokerDelegates, values map[string]interfac panic(errors.New("Can't create an action context, you need a action field!")) } level = values["level"].(int) - parentID = values["parentID"].(string) + + parentID := "" + if p, ok := values["parentID"]; ok { + if s, ok := p.(string); ok { + parentID = s + } + } params := payload.New(values["params"]) if values["timeout"] != nil { timeout = values["timeout"].(int) } if values["meta"] != nil { - meta = values["meta"].(map[string]interface{}) + meta = payload.New(values["meta"]) + } else { + meta = payload.Empty() } newContext := Context{ @@ -147,7 +149,7 @@ func ActionContext(broker *moleculer.BrokerDelegates, values map[string]interfac actionName: actionName.(string), parentID: parentID, params: params, - meta: &meta, + meta: meta, timeout: timeout, level: level, } @@ -157,30 +159,29 @@ func ActionContext(broker *moleculer.BrokerDelegates, values map[string]interfac // EventContext create an event context for a remote call. func EventContext(broker *moleculer.BrokerDelegates, values map[string]interface{}) moleculer.BrokerContext { - var level int - var parentID string - var timeout int - var meta map[string]interface{} - + var meta moleculer.Payload sourceNodeID := values["sender"].(string) - id := values["id"].(string) + id := "" + if t, ok := values["id"]; ok { + id = t.(string) + } eventName, isEvent := values["event"] if !isEvent { panic(errors.New("Can't create an event context, you need an event field!")) } - params := payload.New(values["params"]) - + if values["meta"] != nil { + meta = payload.New(values["meta"]) + } else { + meta = payload.Empty() + } newContext := Context{ broker: broker, sourceNodeID: sourceNodeID, id: id, eventName: eventName.(string), broadcast: values["broadcast"].(bool), - parentID: parentID, - params: params, - meta: &meta, - timeout: timeout, - level: level, + params: payload.New(values["data"]), + meta: meta, } if values["groups"] != nil { temp := values["groups"] @@ -209,27 +210,29 @@ func (context *Context) RequestID() string { func (context *Context) AsMap() map[string]interface{} { mapResult := make(map[string]interface{}) - var metrics interface{} - if context.meta != nil { - metrics = (*context.meta)["metrics"] + var metrics bool + if context.meta.Get("metrics").Exists() { + metrics = context.meta.Get("metrics").Bool() } mapResult["id"] = context.id mapResult["requestID"] = context.requestID - mapResult["params"] = context.params.Value() mapResult["level"] = context.level if context.actionName != "" { mapResult["action"] = context.actionName mapResult["metrics"] = metrics mapResult["parentID"] = context.parentID - mapResult["meta"] = (*context.meta) + mapResult["meta"] = context.meta.RawMap() mapResult["timeout"] = context.timeout + mapResult["params"] = context.params.Value() } if context.eventName != "" { mapResult["event"] = context.eventName mapResult["groups"] = context.groups mapResult["broadcast"] = context.broadcast + mapResult["data"] = context.params.Value() + mapResult["meta"] = context.meta.RawMap() } //TODO : check how to support streaming params in go @@ -244,9 +247,9 @@ func (context *Context) MCall(callMaps map[string]map[string]interface{}) chan m // Call : main entry point to call actions. // chained action invocation -func (context *Context) Call(actionName string, params interface{}, opts ...moleculer.OptionsFunc) chan moleculer.Payload { - actionContext := context.ChildActionContext(actionName, payload.New(params), options.Wrap(opts)) - return context.broker.ActionDelegate(actionContext, options.Wrap(opts)) +func (context *Context) Call(actionName string, params interface{}, opts ...moleculer.Options) chan moleculer.Payload { + actionContext := context.ChildActionContext(actionName, payload.New(params), opts...) + return context.broker.ActionDelegate(actionContext, opts...) } // Emit : Emit an event (grouped & balanced global event) @@ -299,10 +302,14 @@ func (context *Context) ID() string { return context.id } -func (context *Context) Meta() *map[string]interface{} { +func (context *Context) Meta() moleculer.Payload { return context.meta } +func (context *Context) UpdateMeta(meta moleculer.Payload) { + context.meta = meta +} + func (context *Context) Logger() *log.Entry { if context.actionName != "" { return context.broker.Logger("action", context.actionName) diff --git a/context/context_test.go b/context/context_test.go index d64b7cd9..e209dd28 100644 --- a/context/context_test.go +++ b/context/context_test.go @@ -75,13 +75,13 @@ var _ = g.Describe("Context", func() { "sender": "test", "id": "id", "event": "event", - "params": map[string]interface{}{}, + "data": map[string]interface{}{}, "groups": []string{"a", "b"}, "broadcast": true, }) Expect(eventContext).ShouldNot(BeNil()) Expect(eventContext.IsBroadcast()).Should(BeTrue()) - Expect(len(eventContext.AsMap())).Should(Equal(8)) + Expect(len(eventContext.AsMap())).Should(Equal(9)) Expect(eventContext.EventName()).Should(Equal("event")) Expect(eventContext.Groups()).Should(Equal([]string{"a", "b"})) Expect(eventContext.Payload()).Should(Equal(payload.Empty())) @@ -104,12 +104,12 @@ var _ = g.Describe("Context", func() { brokerContext := BrokerContext(test.DelegatesWithIdAndConfig("nodex", config)) actionContext := brokerContext.ChildActionContext("actionx", nil) Expect(actionContext.Meta()).ShouldNot(BeNil()) - Expect((*actionContext.Meta())["metrics"]).Should(BeTrue()) + Expect(actionContext.Meta().Get("metrics").Bool()).Should(BeTrue()) eventContext := brokerContext.ChildEventContext("eventx", nil, nil, false) Expect(eventContext.Meta()).ShouldNot(BeNil()) Expect(eventContext.RequestID()).ShouldNot(Equal("")) - Expect((*eventContext.Meta())["metrics"]).Should(BeTrue()) + Expect(actionContext.Meta().Get("metrics").Bool()).Should(BeTrue()) config = moleculer.Config{ Metrics: false, @@ -117,11 +117,11 @@ var _ = g.Describe("Context", func() { brokerContext = BrokerContext(test.DelegatesWithIdAndConfig("nodex", config)) actionContext = brokerContext.ChildActionContext("actionx", nil) Expect(actionContext.Meta()).ShouldNot(BeNil()) - Expect((*actionContext.Meta())["metrics"]).Should(BeNil()) + Expect(actionContext.Meta().Get("metrics").Exists()).Should(BeFalse()) eventContext = brokerContext.ChildEventContext("eventx", nil, nil, false) Expect(eventContext.Meta()).ShouldNot(BeNil()) - Expect((*eventContext.Meta())["metrics"]).Should(BeNil()) + Expect(actionContext.Meta().Get("metrics").Exists()).Should(BeFalse()) }) @@ -143,7 +143,7 @@ var _ = g.Describe("Context", func() { g.It("Should call Call and delegate it to broker", func() { delegates := test.DelegatesWithIdAndConfig("x", moleculer.Config{}) called := false - delegates.ActionDelegate = func(context moleculer.BrokerContext, opts ...moleculer.OptionsFunc) chan moleculer.Payload { + delegates.ActionDelegate = func(context moleculer.BrokerContext, opts ...moleculer.Options) chan moleculer.Payload { called = true result := make(chan moleculer.Payload, 1) result <- payload.New("value") diff --git a/go.mod b/go.mod index 250c0c58..ca8b43b8 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/lib/pq v1.1.1 // indirect github.com/moleculer-go/cupaloy/v2 v2.5.0 - github.com/moleculer-go/goemitter v1.0.0 + github.com/moleculer-go/goemitter v1.0.1 github.com/nats-io/gnatsd v1.4.1 // indirect github.com/nats-io/go-nats v1.7.2 // indirect github.com/nats-io/go-nats-streaming v0.4.2 diff --git a/metrics/metrics.go b/metrics/metrics.go index ed88fbf7..61ec3208 100644 --- a/metrics/metrics.go +++ b/metrics/metrics.go @@ -10,12 +10,12 @@ import ( ) func metricEnd(brokerContext moleculer.BrokerContext, result moleculer.Payload) { - rawContext := brokerContext.(*context.Context) - if rawContext.Meta() == nil || (*rawContext.Meta())["startTime"] == nil { + ctx := brokerContext.(*context.Context) + if !ctx.Meta().Get("startTime").Exists() { return } - startTime := (*rawContext.Meta())["startTime"].(time.Time) + startTime := ctx.Meta().Get("startTime").Time() payload := metricsPayload(brokerContext) mlseconds := float64(time.Since(startTime).Nanoseconds()) / 1000000 @@ -26,21 +26,21 @@ func metricEnd(brokerContext moleculer.BrokerContext, result moleculer.Payload) "message": fmt.Sprintf("%s", result.Error()), } } - rawContext.Emit("metrics.trace.span.finish", payload) + ctx.Emit("metrics.trace.span.finish", payload) } func metricStart(context moleculer.BrokerContext) { - (*context.Meta())["startTime"] = time.Now() - (*context.Meta())["duration"] = 0 - context.(moleculer.Context).Emit("metrics.trace.span.start", metricsPayload(context)) + meta := context.Meta().Add("startTime", time.Now()).Add("duration", 0) + context.UpdateMeta(meta) + context.Emit("metrics.trace.span.start", metricsPayload(context)) } // metricsPayload generate the payload for the metrics event func metricsPayload(brokerContext moleculer.BrokerContext) map[string]interface{} { rawContext := brokerContext.(*context.Context) contextMap := brokerContext.AsMap() - if rawContext.Meta() != nil && (*rawContext.Meta())["startTime"] != nil { - contextMap["startTime"] = (*rawContext.Meta())["startTime"].(time.Time).Format(time.RFC3339) + if rawContext.Meta().Get("startTime").Exists() { + contextMap["startTime"] = rawContext.Meta().Get("startTime").Time().Format(time.RFC3339) } nodeID := rawContext.BrokerDelegates().LocalNode().GetID() contextMap["nodeID"] = nodeID @@ -64,7 +64,7 @@ func metricsPayload(brokerContext moleculer.BrokerContext) map[string]interface{ func createShouldMetric(Config moleculer.Config) func(context moleculer.BrokerContext) bool { var callsCount float32 = 0 return func(context moleculer.BrokerContext) bool { - if context.Meta() != nil && (*context.Meta())["metrics"] != nil && (*context.Meta())["metrics"].(bool) { + if context.Meta().Get("metrics").Bool() { callsCount++ if callsCount*Config.MetricsRate >= 1.0 { diff --git a/moleculer.go b/moleculer.go index 345e9821..24da4307 100644 --- a/moleculer.go +++ b/moleculer.go @@ -2,6 +2,7 @@ package moleculer import ( "fmt" + "os" "time" bus "github.com/moleculer-go/goemitter" @@ -117,6 +118,7 @@ type Config struct { HeartbeatFrequency time.Duration HeartbeatTimeout time.Duration OfflineCheckFrequency time.Duration + OfflineTimeout time.Duration NeighboursCheckTimeout time.Duration WaitForDependenciesTimeout time.Duration Middlewares []Middlewares @@ -141,9 +143,10 @@ var DefaultConfig = Config{ LogFormat: "TEXT", DiscoverNodeID: discoverNodeID, Transporter: "MEMORY", - HeartbeatFrequency: 15 * time.Second, - HeartbeatTimeout: 30 * time.Second, + HeartbeatFrequency: 5 * time.Second, + HeartbeatTimeout: 15 * time.Second, OfflineCheckFrequency: 20 * time.Second, + OfflineTimeout: 10 * time.Minute, NeighboursCheckTimeout: 2 * time.Second, WaitForDependenciesTimeout: 2 * time.Second, Metrics: false, @@ -164,8 +167,11 @@ var DefaultConfig = Config{ // discoverNodeID - should return the node id for this machine func discoverNodeID() string { - // return fmt.Sprint(strings.Replace(hostname, ".", "_", -1), "-", util.RandomString(12)) - return fmt.Sprint("Node_", util.RandomString(5)) + hostname, err := os.Hostname() + if err != nil { + hostname = "node-" + util.RandomString(2) + } + return fmt.Sprint(hostname, "-", util.RandomString(5)) } type RetryPolicy struct { @@ -186,13 +192,12 @@ type LoggerFunc func(name string, value string) *log.Entry type BusFunc func() *bus.Emitter type isStartedFunc func() bool type LocalNodeFunc func() Node -type ActionDelegateFunc func(context BrokerContext, opts ...OptionsFunc) chan Payload +type ActionDelegateFunc func(context BrokerContext, opts ...Options) chan Payload type EmitEventFunc func(context BrokerContext) type ServiceForActionFunc func(string) *ServiceSchema type MultActionDelegateFunc func(callMaps map[string]map[string]interface{}) chan map[string]Payload type BrokerContextFunc func() BrokerContext type MiddlewareHandlerFunc func(name string, params interface{}) interface{} -type OptionsFunc func(key string) interface{} type PublishFunc func(...interface{}) type MiddlewareHandler func(params interface{}, next func(...interface{})) @@ -205,25 +210,38 @@ type Node interface { GetID() string ExportAsMap() map[string]interface{} IsAvailable() bool + Available() Unavailable() IsExpired(timeout time.Duration) bool - Update(info map[string]interface{}) bool + Update(id string, info map[string]interface{}) bool IncreaseSequence() HeartBeat(heartbeat map[string]interface{}) Publish(service map[string]interface{}) } + +type Options struct { + Meta Payload + NodeID string +} + type Context interface { //context methods used by services MCall(map[string]map[string]interface{}) chan map[string]Payload - Call(actionName string, params interface{}, opts ...OptionsFunc) chan Payload + Call(actionName string, params interface{}, opts ...Options) chan Payload Emit(eventName string, params interface{}, groups ...string) Broadcast(eventName string, params interface{}, groups ...string) Logger() *log.Entry + + Payload() Payload + Meta() Payload } type BrokerContext interface { - ChildActionContext(actionName string, params Payload, opts ...OptionsFunc) BrokerContext + Call(actionName string, params interface{}, opts ...Options) chan Payload + Emit(eventName string, params interface{}, groups ...string) + + ChildActionContext(actionName string, params Payload, opts ...Options) BrokerContext ChildEventContext(eventName string, params Payload, groups []string, broadcast bool) BrokerContext ActionName() string @@ -240,8 +258,8 @@ type BrokerContext interface { ID() string RequestID() string - Meta() *map[string]interface{} - + Meta() Payload + UpdateMeta(Payload) Logger() *log.Entry Publish(...interface{}) diff --git a/options/options.go b/options/options.go deleted file mode 100644 index 5963dde3..00000000 --- a/options/options.go +++ /dev/null @@ -1,27 +0,0 @@ -package options - -import "github.com/moleculer-go/moleculer" - -func Wrap(opts []moleculer.OptionsFunc) moleculer.OptionsFunc { - return func(key string) interface{} { - return Get(key, opts) - } -} - -func String(key string, opts []moleculer.OptionsFunc) string { - result := Get(key, opts) - if result != nil { - return result.(string) - } - return "" -} - -func Get(key string, opts []moleculer.OptionsFunc) interface{} { - for _, opt := range opts { - result := opt(key) - if result != nil { - return result - } - } - return nil -} diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-all-false-$node.actions1 b/registry/.snapshots/registry_test-glob--func3-1-1-1-all-false-$node.actions1 index c61aaba1..6d4b4f8f 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-all-false-$node.actions1 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-all-false-$node.actions1 @@ -2,7 +2,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=10) "$node.list", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -11,7 +11,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=12) "$node.events", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -20,7 +20,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=13) "$node.actions", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -29,7 +29,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=13) "printer.print", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -38,7 +38,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=14) "$node.services", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-all-false-$node.actions2 b/registry/.snapshots/registry_test-glob--func3-1-1-1-all-false-$node.actions2 index 84502c61..d8928eb8 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-all-false-$node.actions2 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-all-false-$node.actions2 @@ -2,7 +2,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=10) "$node.list", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -11,7 +11,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=12) "$node.events", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -20,7 +20,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=12) "scanner.scan", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -29,7 +29,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=13) "$node.actions", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -38,7 +38,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=13) "printer.print", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) false, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -47,7 +47,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=14) "$node.services", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-all-false-$node.actions3 b/registry/.snapshots/registry_test-glob--func3-1-1-1-all-false-$node.actions3 index 4586630e..7e6ee0de 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-all-false-$node.actions3 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-all-false-$node.actions3 @@ -2,7 +2,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=10) "$node.list", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -11,7 +11,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=11) "cpu.compute", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -20,7 +20,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=12) "$node.events", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -29,7 +29,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=12) "scanner.scan", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) false, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -38,7 +38,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=13) "$node.actions", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -47,7 +47,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=13) "printer.print", - (string) (len=5) "count": (int) 2, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -56,7 +56,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=14) "$node.services", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-all-true-$node.actions1 b/registry/.snapshots/registry_test-glob--func3-1-1-1-all-true-$node.actions1 index 33596cb7..1c67117f 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-all-true-$node.actions1 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-all-true-$node.actions1 @@ -2,7 +2,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=13) "printer.print", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": ([]map[string]interface {}) (len=1) { diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-all-true-$node.actions2 b/registry/.snapshots/registry_test-glob--func3-1-1-1-all-true-$node.actions2 index 421a91e9..cc906094 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-all-true-$node.actions2 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-all-true-$node.actions2 @@ -2,7 +2,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=12) "scanner.scan", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": ([]map[string]interface {}) (len=1) { diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-all-true-$node.actions3 b/registry/.snapshots/registry_test-glob--func3-1-1-1-all-true-$node.actions3 index 77b7fd59..03e95254 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-all-true-$node.actions3 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-all-true-$node.actions3 @@ -2,7 +2,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=11) "cpu.compute", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": ([]map[string]interface {}) (len=1) { @@ -16,14 +16,26 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=13) "printer.print", - (string) (len=5) "count": (int) 2, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, - (string) (len=9) "endpoints": ([]map[string]interface {}) (len=2) { + (string) (len=9) "endpoints": ([]map[string]interface {}) (len=5) { (map[string]interface {}) (len=2) { (string) (len=6) "nodeID": (string) (len=14) "node_cpuBroker", (string) (len=9) "available": (bool) true }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, (map[string]interface {}) (len=2) { (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", (string) (len=9) "available": (bool) true diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-all-true-$node.services1 b/registry/.snapshots/registry_test-glob--func3-1-1-1-all-true-$node.services1 index d693a7eb..32d39043 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-all-true-$node.services1 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-all-true-$node.services1 @@ -2,18 +2,18 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=9) { (string) (len=4) "name": (string) (len=7) "printer", - (string) (len=6) "events": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=3) { - (string) (len=11) "serviceName": (string) (len=7) "printer", + (string) (len=6) "events": (map[string]map[string]interface {}) (len=1) { + (string) (len=7) "printed": (map[string]interface {}) (len=2) { (string) (len=4) "name": (string) (len=7) "printed", (string) (len=5) "group": (string) (len=7) "printer" } }, - (string) (len=7) "actions": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=5) "print", + (string) (len=7) "actions": (map[string]map[string]interface {}) (len=1) { + (string) (len=5) "print": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=13) "printer.print", (string) (len=6) "params": (map[string]interface {}) { - } + }, + (string) (len=7) "rawName": (string) (len=5) "print" } }, (string) (len=7) "version": (string) "", diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-all-true-$node.services2 b/registry/.snapshots/registry_test-glob--func3-1-1-1-all-true-$node.services2 index eac81a50..d27e2240 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-all-true-$node.services2 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-all-true-$node.services2 @@ -2,18 +2,18 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=9) { (string) (len=4) "name": (string) (len=7) "scanner", - (string) (len=6) "events": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=3) { - (string) (len=11) "serviceName": (string) (len=7) "scanner", + (string) (len=6) "events": (map[string]map[string]interface {}) (len=1) { + (string) (len=7) "scanned": (map[string]interface {}) (len=2) { (string) (len=4) "name": (string) (len=7) "scanned", (string) (len=5) "group": (string) (len=7) "scanner" } }, - (string) (len=7) "actions": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=4) "scan", + (string) (len=7) "actions": (map[string]map[string]interface {}) (len=1) { + (string) (len=4) "scan": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=12) "scanner.scan", (string) (len=6) "params": (map[string]interface {}) { - } + }, + (string) (len=7) "rawName": (string) (len=4) "scan" } }, (string) (len=7) "version": (string) "", diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-all-true-$node.services3 b/registry/.snapshots/registry_test-glob--func3-1-1-1-all-true-$node.services3 index e3bd0d34..233d012a 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-all-true-$node.services3 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-all-true-$node.services3 @@ -2,13 +2,14 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=9) { (string) (len=4) "name": (string) (len=3) "cpu", - (string) (len=6) "events": ([]map[string]interface {}) { + (string) (len=6) "events": (map[string]map[string]interface {}) { }, - (string) (len=7) "actions": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=7) "compute", + (string) (len=7) "actions": (map[string]map[string]interface {}) (len=1) { + (string) (len=7) "compute": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=11) "cpu.compute", (string) (len=6) "params": (map[string]interface {}) { - } + }, + (string) (len=7) "rawName": (string) (len=7) "compute" } }, (string) (len=7) "version": (string) "", @@ -29,18 +30,18 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=9) { (string) (len=4) "name": (string) (len=7) "printer", - (string) (len=6) "events": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=3) { - (string) (len=11) "serviceName": (string) (len=7) "printer", + (string) (len=6) "events": (map[string]map[string]interface {}) (len=1) { + (string) (len=7) "printed": (map[string]interface {}) (len=2) { (string) (len=4) "name": (string) (len=7) "printed", (string) (len=5) "group": (string) (len=7) "printer" } }, - (string) (len=7) "actions": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=5) "print", + (string) (len=7) "actions": (map[string]map[string]interface {}) (len=1) { + (string) (len=5) "print": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=13) "printer.print", (string) (len=6) "params": (map[string]interface {}) { - } + }, + (string) (len=7) "rawName": (string) (len=5) "print" } }, (string) (len=7) "version": (string) "", diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-no-services-$node.list1 b/registry/.snapshots/registry_test-glob--func3-1-1-1-no-services-$node.list1 index fd1d194c..17fc5e00 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-no-services-$node.list1 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-no-services-$node.list1 @@ -3,7 +3,7 @@ (string) (len=15) "noPrinterBroker": (map[string]interface {}) (len=8) { (string) (len=2) "id": (string) (len=18) "node_printerBroker", (string) (len=3) "cpu": (int64) 0, - (string) (len=3) "seq": (int64) 0, + (string) (len=3) "seq": (string) (len=7) "removed", (string) (len=6) "client": (map[string]interface {}) (len=3) { (string) (len=11) "langVersion": (string) (len=3) "1.5", (string) (len=4) "type": (string) (len=12) "moleculer-go", @@ -13,7 +13,7 @@ (string) (len=6) "ipList": ([]string) (len=1) { (string) (len=13) "100.100.0.100" }, - (string) (len=8) "hostname": (string) "", + (string) (len=8) "hostname": (string) (len=7) "removed", (string) (len=9) "available": (bool) true }, (string) (len=19) "nodedeScannerBroker": (map[string]interface {}) diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-no-services-$node.list2 b/registry/.snapshots/registry_test-glob--func3-1-1-1-no-services-$node.list2 index 46fc67a8..f4c5649f 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-no-services-$node.list2 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-no-services-$node.list2 @@ -3,7 +3,7 @@ (string) (len=15) "noPrinterBroker": (map[string]interface {}) (len=8) { (string) (len=2) "id": (string) (len=18) "node_printerBroker", (string) (len=3) "cpu": (int64) 0, - (string) (len=3) "seq": (int64) 0, + (string) (len=3) "seq": (string) (len=7) "removed", (string) (len=6) "client": (map[string]interface {}) (len=3) { (string) (len=11) "langVersion": (string) (len=3) "1.5", (string) (len=4) "type": (string) (len=12) "moleculer-go", @@ -13,13 +13,13 @@ (string) (len=6) "ipList": ([]string) (len=1) { (string) (len=13) "100.100.0.100" }, - (string) (len=8) "hostname": (string) "", + (string) (len=8) "hostname": (string) (len=7) "removed", (string) (len=9) "available": (bool) true }, (string) (len=19) "nodedeScannerBroker": (map[string]interface {}) (len=8) { (string) (len=2) "id": (string) (len=18) "node_scannerBroker", (string) (len=3) "cpu": (int64) 0, - (string) (len=3) "seq": (int64) 0, + (string) (len=3) "seq": (string) (len=7) "removed", (string) (len=6) "client": (map[string]interface {}) (len=3) { (string) (len=11) "langVersion": (string) (len=3) "1.5", (string) (len=4) "type": (string) (len=12) "moleculer-go", @@ -29,7 +29,7 @@ (string) (len=6) "ipList": ([]string) (len=1) { (string) (len=13) "100.100.0.100" }, - (string) (len=8) "hostname": (string) "", + (string) (len=8) "hostname": (string) (len=7) "removed", (string) (len=9) "available": (bool) true } } diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-no-services-$node.list3 b/registry/.snapshots/registry_test-glob--func3-1-1-1-no-services-$node.list3 index 8a1efc8b..37e0cf25 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-no-services-$node.list3 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-no-services-$node.list3 @@ -2,7 +2,7 @@ (string) (len=13) "nodeCpuBroker": (map[string]interface {}) (len=8) { (string) (len=2) "id": (string) (len=14) "node_cpuBroker", (string) (len=3) "cpu": (int64) 0, - (string) (len=3) "seq": (int64) 0, + (string) (len=3) "seq": (string) (len=7) "removed", (string) (len=6) "client": (map[string]interface {}) (len=3) { (string) (len=11) "langVersion": (string) (len=3) "1.5", (string) (len=4) "type": (string) (len=12) "moleculer-go", @@ -12,13 +12,13 @@ (string) (len=6) "ipList": ([]string) (len=1) { (string) (len=13) "100.100.0.100" }, - (string) (len=8) "hostname": (string) "", + (string) (len=8) "hostname": (string) (len=7) "removed", (string) (len=9) "available": (bool) true }, (string) (len=15) "noPrinterBroker": (map[string]interface {}) (len=8) { (string) (len=2) "id": (string) (len=18) "node_printerBroker", (string) (len=3) "cpu": (int64) 0, - (string) (len=3) "seq": (int64) 0, + (string) (len=3) "seq": (string) (len=7) "removed", (string) (len=6) "client": (map[string]interface {}) (len=3) { (string) (len=11) "langVersion": (string) (len=3) "1.5", (string) (len=4) "type": (string) (len=12) "moleculer-go", @@ -28,13 +28,13 @@ (string) (len=6) "ipList": ([]string) (len=1) { (string) (len=13) "100.100.0.100" }, - (string) (len=8) "hostname": (string) "", + (string) (len=8) "hostname": (string) (len=7) "removed", (string) (len=9) "available": (bool) true }, (string) (len=19) "nodedeScannerBroker": (map[string]interface {}) (len=8) { (string) (len=2) "id": (string) (len=18) "node_scannerBroker", (string) (len=3) "cpu": (int64) 0, - (string) (len=3) "seq": (int64) 0, + (string) (len=3) "seq": (string) (len=7) "removed", (string) (len=6) "client": (map[string]interface {}) (len=3) { (string) (len=11) "langVersion": (string) (len=3) "1.5", (string) (len=4) "type": (string) (len=12) "moleculer-go", @@ -44,7 +44,7 @@ (string) (len=6) "ipList": ([]string) (len=1) { (string) (len=13) "100.100.0.100" }, - (string) (len=8) "hostname": (string) "", + (string) (len=8) "hostname": (string) (len=7) "removed", (string) (len=9) "available": (bool) true } } diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-onlyAvailable-$node.actions1 b/registry/.snapshots/registry_test-glob--func3-1-1-1-onlyAvailable-$node.actions1 index c61aaba1..6d4b4f8f 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-onlyAvailable-$node.actions1 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-onlyAvailable-$node.actions1 @@ -2,7 +2,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=10) "$node.list", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -11,7 +11,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=12) "$node.events", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -20,7 +20,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=13) "$node.actions", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -29,7 +29,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=13) "printer.print", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -38,7 +38,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=14) "$node.services", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-onlyAvailable-$node.actions2 b/registry/.snapshots/registry_test-glob--func3-1-1-1-onlyAvailable-$node.actions2 index 84502c61..d8928eb8 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-onlyAvailable-$node.actions2 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-onlyAvailable-$node.actions2 @@ -2,7 +2,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=10) "$node.list", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -11,7 +11,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=12) "$node.events", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -20,7 +20,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=12) "scanner.scan", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -29,7 +29,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=13) "$node.actions", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -38,7 +38,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=13) "printer.print", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) false, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -47,7 +47,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=14) "$node.services", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-onlyAvailable-$node.actions3 b/registry/.snapshots/registry_test-glob--func3-1-1-1-onlyAvailable-$node.actions3 index 4586630e..7e6ee0de 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-onlyAvailable-$node.actions3 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-onlyAvailable-$node.actions3 @@ -2,7 +2,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=10) "$node.list", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -11,7 +11,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=11) "cpu.compute", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -20,7 +20,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=12) "$node.events", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -29,7 +29,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=12) "scanner.scan", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) false, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -38,7 +38,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=13) "$node.actions", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -47,7 +47,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=13) "printer.print", - (string) (len=5) "count": (int) 2, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -56,7 +56,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=14) "$node.services", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-onlyLocal-$node.actions1 b/registry/.snapshots/registry_test-glob--func3-1-1-1-onlyLocal-$node.actions1 index c61aaba1..6d4b4f8f 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-onlyLocal-$node.actions1 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-onlyLocal-$node.actions1 @@ -2,7 +2,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=10) "$node.list", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -11,7 +11,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=12) "$node.events", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -20,7 +20,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=13) "$node.actions", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -29,7 +29,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=13) "printer.print", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -38,7 +38,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=14) "$node.services", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-onlyLocal-$node.actions2 b/registry/.snapshots/registry_test-glob--func3-1-1-1-onlyLocal-$node.actions2 index 2a10d592..71b68eda 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-onlyLocal-$node.actions2 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-onlyLocal-$node.actions2 @@ -2,7 +2,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=10) "$node.list", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -11,7 +11,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=12) "$node.events", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -20,7 +20,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=12) "scanner.scan", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -29,7 +29,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=13) "$node.actions", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -38,7 +38,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=14) "$node.services", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-onlyLocal-$node.actions3 b/registry/.snapshots/registry_test-glob--func3-1-1-1-onlyLocal-$node.actions3 index 06a5fe18..162f737c 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-onlyLocal-$node.actions3 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-onlyLocal-$node.actions3 @@ -2,7 +2,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=10) "$node.list", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -11,7 +11,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=11) "cpu.compute", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -20,7 +20,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=12) "$node.events", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -29,7 +29,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=13) "$node.actions", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -38,7 +38,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=13) "printer.print", - (string) (len=5) "count": (int) 2, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -47,7 +47,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=14) "$node.services", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-skipInternal-$node.actions1 b/registry/.snapshots/registry_test-glob--func3-1-1-1-skipInternal-$node.actions1 index f2085dad..a4be1e22 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-skipInternal-$node.actions1 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-skipInternal-$node.actions1 @@ -2,7 +2,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=13) "printer.print", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-skipInternal-$node.actions2 b/registry/.snapshots/registry_test-glob--func3-1-1-1-skipInternal-$node.actions2 index 400bc86e..4e9632da 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-skipInternal-$node.actions2 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-skipInternal-$node.actions2 @@ -2,7 +2,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=12) "scanner.scan", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -11,7 +11,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=13) "printer.print", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) false, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-skipInternal-$node.actions3 b/registry/.snapshots/registry_test-glob--func3-1-1-1-skipInternal-$node.actions3 index f7f38976..a4efa97b 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-skipInternal-$node.actions3 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-skipInternal-$node.actions3 @@ -2,7 +2,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=11) "cpu.compute", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -11,7 +11,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=12) "scanner.scan", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) false, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) @@ -20,7 +20,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=13) "printer.print", - (string) (len=5) "count": (int) 2, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": (interface {}) diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-with-services-$node.list1 b/registry/.snapshots/registry_test-glob--func3-1-1-1-with-services-$node.list1 index bcf149f3..e34f2468 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-with-services-$node.list1 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-with-services-$node.list1 @@ -3,7 +3,7 @@ (string) (len=15) "noPrinterBroker": (map[string]interface {}) (len=9) { (string) (len=2) "id": (string) (len=18) "node_printerBroker", (string) (len=3) "cpu": (int64) 0, - (string) (len=3) "seq": (int64) 0, + (string) (len=3) "seq": (string) (len=7) "removed", (string) (len=6) "client": (map[string]interface {}) (len=3) { (string) (len=11) "langVersion": (string) (len=3) "1.5", (string) (len=4) "type": (string) (len=12) "moleculer-go", @@ -13,23 +13,72 @@ (string) (len=6) "ipList": ([]string) (len=1) { (string) (len=13) "100.100.0.100" }, - (string) (len=8) "hostname": (string) "", - (string) (len=8) "services": ([]map[string]interface {}) (len=1) { + (string) (len=8) "hostname": (string) (len=7) "removed", + (string) (len=8) "services": ([]map[string]interface {}) (len=2) { + (map[string]interface {}) (len=7) { + (string) (len=4) "name": (string) (len=5) "$node", + (string) (len=6) "events": (map[string]map[string]interface {}) { + }, + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=7) "actions": (map[string]map[string]interface {}) (len=6) { + (string) (len=4) "list": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=10) "$node.list", + (string) (len=6) "params": (map[string]interface {}) { + }, + (string) (len=7) "rawName": (string) (len=4) "list" + }, + (string) (len=6) "events": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=12) "$node.events", + (string) (len=6) "params": (map[string]interface {}) { + }, + (string) (len=7) "rawName": (string) (len=6) "events" + }, + (string) (len=6) "health": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=12) "$node.health", + (string) (len=6) "params": (map[string]interface {}) { + }, + (string) (len=7) "rawName": (string) (len=6) "health" + }, + (string) (len=7) "actions": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=13) "$node.actions", + (string) (len=6) "params": (map[string]interface {}) { + }, + (string) (len=7) "rawName": (string) (len=7) "actions" + }, + (string) (len=7) "options": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=13) "$node.options", + (string) (len=6) "params": (map[string]interface {}) { + }, + (string) (len=7) "rawName": (string) (len=7) "options" + }, + (string) (len=8) "services": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=14) "$node.services", + (string) (len=6) "params": (map[string]interface {}) { + }, + (string) (len=7) "rawName": (string) (len=8) "services" + } + }, + (string) (len=7) "version": (string) "", + (string) (len=8) "metadata": (map[string]interface {}) { + }, + (string) (len=8) "settings": (map[string]interface {}) { + } + }, (map[string]interface {}) (len=7) { (string) (len=4) "name": (string) (len=7) "printer", - (string) (len=6) "events": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=3) { - (string) (len=11) "serviceName": (string) (len=7) "printer", + (string) (len=6) "events": (map[string]map[string]interface {}) (len=1) { + (string) (len=7) "printed": (map[string]interface {}) (len=2) { (string) (len=4) "name": (string) (len=7) "printed", (string) (len=5) "group": (string) (len=7) "printer" } }, (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", - (string) (len=7) "actions": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=5) "print", + (string) (len=7) "actions": (map[string]map[string]interface {}) (len=1) { + (string) (len=5) "print": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=13) "printer.print", (string) (len=6) "params": (map[string]interface {}) { - } + }, + (string) (len=7) "rawName": (string) (len=5) "print" } }, (string) (len=7) "version": (string) "", diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-with-services-$node.list2 b/registry/.snapshots/registry_test-glob--func3-1-1-1-with-services-$node.list2 index 9162e86a..935a9a6a 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-with-services-$node.list2 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-with-services-$node.list2 @@ -1,85 +1,5 @@ (map[string]map[string]interface {}) (len=3) { (string) (len=13) "nodeCpuBroker": (map[string]interface {}) , - (string) (len=15) "noPrinterBroker": (map[string]interface {}) (len=9) { - (string) (len=2) "id": (string) (len=18) "node_printerBroker", - (string) (len=3) "cpu": (int64) 0, - (string) (len=3) "seq": (int64) 0, - (string) (len=6) "client": (map[string]interface {}) (len=3) { - (string) (len=11) "langVersion": (string) (len=3) "1.5", - (string) (len=4) "type": (string) (len=12) "moleculer-go", - (string) (len=7) "version": (string) (len=5) "0.1.0" - }, - (string) (len=6) "cpuSeq": (int64) 0, - (string) (len=6) "ipList": ([]string) (len=1) { - (string) (len=13) "100.100.0.100" - }, - (string) (len=8) "hostname": (string) "", - (string) (len=8) "services": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=7) { - (string) (len=4) "name": (string) (len=7) "printer", - (string) (len=6) "events": ([]interface {}) (len=1) { - (map[string]interface {}) (len=3) { - (string) (len=11) "serviceName": (string) (len=7) "printer", - (string) (len=4) "name": (string) (len=7) "printed", - (string) (len=5) "group": (string) (len=7) "printer" - } - }, - (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", - (string) (len=7) "actions": ([]interface {}) (len=1) { - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=5) "print", - (string) (len=6) "params": (map[string]interface {}) { - } - } - }, - (string) (len=7) "version": (string) "", - (string) (len=8) "metadata": (map[string]interface {}) { - }, - (string) (len=8) "settings": (map[string]interface {}) { - } - } - }, - (string) (len=9) "available": (bool) true - }, - (string) (len=19) "nodedeScannerBroker": (map[string]interface {}) (len=9) { - (string) (len=2) "id": (string) (len=18) "node_scannerBroker", - (string) (len=3) "cpu": (int64) 0, - (string) (len=3) "seq": (int64) 0, - (string) (len=6) "client": (map[string]interface {}) (len=3) { - (string) (len=11) "langVersion": (string) (len=3) "1.5", - (string) (len=4) "type": (string) (len=12) "moleculer-go", - (string) (len=7) "version": (string) (len=5) "0.1.0" - }, - (string) (len=6) "cpuSeq": (int64) 0, - (string) (len=6) "ipList": ([]string) (len=1) { - (string) (len=13) "100.100.0.100" - }, - (string) (len=8) "hostname": (string) "", - (string) (len=8) "services": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=7) { - (string) (len=4) "name": (string) (len=7) "scanner", - (string) (len=6) "events": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=3) { - (string) (len=11) "serviceName": (string) (len=7) "scanner", - (string) (len=4) "name": (string) (len=7) "scanned", - (string) (len=5) "group": (string) (len=7) "scanner" - } - }, - (string) (len=6) "nodeID": (string) (len=18) "node_scannerBroker", - (string) (len=7) "actions": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=4) "scan", - (string) (len=6) "params": (map[string]interface {}) { - } - } - }, - (string) (len=7) "version": (string) "", - (string) (len=8) "metadata": (map[string]interface {}) { - }, - (string) (len=8) "settings": (map[string]interface {}) { - } - } - }, - (string) (len=9) "available": (bool) true - } + (string) (len=15) "noPrinterBroker": (map[string]interface {}) , + (string) (len=19) "nodedeScannerBroker": (map[string]interface {}) } diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-with-services-$node.list3 b/registry/.snapshots/registry_test-glob--func3-1-1-1-with-services-$node.list3 index 485b8284..935a9a6a 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-with-services-$node.list3 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-with-services-$node.list3 @@ -1,143 +1,5 @@ (map[string]map[string]interface {}) (len=3) { - (string) (len=13) "nodeCpuBroker": (map[string]interface {}) (len=9) { - (string) (len=2) "id": (string) (len=14) "node_cpuBroker", - (string) (len=3) "cpu": (int64) 0, - (string) (len=3) "seq": (int64) 0, - (string) (len=6) "client": (map[string]interface {}) (len=3) { - (string) (len=11) "langVersion": (string) (len=3) "1.5", - (string) (len=4) "type": (string) (len=12) "moleculer-go", - (string) (len=7) "version": (string) (len=5) "0.1.0" - }, - (string) (len=6) "cpuSeq": (int64) 0, - (string) (len=6) "ipList": ([]string) (len=1) { - (string) (len=13) "100.100.0.100" - }, - (string) (len=8) "hostname": (string) "", - (string) (len=8) "services": ([]map[string]interface {}) (len=2) { - (map[string]interface {}) (len=7) { - (string) (len=4) "name": (string) (len=3) "cpu", - (string) (len=6) "events": ([]map[string]interface {}) { - }, - (string) (len=6) "nodeID": (string) (len=14) "node_cpuBroker", - (string) (len=7) "actions": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=7) "compute", - (string) (len=6) "params": (map[string]interface {}) { - } - } - }, - (string) (len=7) "version": (string) "", - (string) (len=8) "metadata": (map[string]interface {}) { - }, - (string) (len=8) "settings": (map[string]interface {}) { - } - }, - (map[string]interface {}) (len=7) { - (string) (len=4) "name": (string) (len=7) "printer", - (string) (len=6) "events": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=3) { - (string) (len=11) "serviceName": (string) (len=7) "printer", - (string) (len=4) "name": (string) (len=7) "printed", - (string) (len=5) "group": (string) (len=7) "printer" - } - }, - (string) (len=6) "nodeID": (string) (len=14) "node_cpuBroker", - (string) (len=7) "actions": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=5) "print", - (string) (len=6) "params": (map[string]interface {}) { - } - } - }, - (string) (len=7) "version": (string) "", - (string) (len=8) "metadata": (map[string]interface {}) { - }, - (string) (len=8) "settings": (map[string]interface {}) { - } - } - }, - (string) (len=9) "available": (bool) true - }, - (string) (len=15) "noPrinterBroker": (map[string]interface {}) (len=9) { - (string) (len=2) "id": (string) (len=18) "node_printerBroker", - (string) (len=3) "cpu": (int64) 0, - (string) (len=3) "seq": (int64) 0, - (string) (len=6) "client": (map[string]interface {}) (len=3) { - (string) (len=11) "langVersion": (string) (len=3) "1.5", - (string) (len=4) "type": (string) (len=12) "moleculer-go", - (string) (len=7) "version": (string) (len=5) "0.1.0" - }, - (string) (len=6) "cpuSeq": (int64) 0, - (string) (len=6) "ipList": ([]string) (len=1) { - (string) (len=13) "100.100.0.100" - }, - (string) (len=8) "hostname": (string) "", - (string) (len=8) "services": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=7) { - (string) (len=4) "name": (string) (len=7) "printer", - (string) (len=6) "events": ([]interface {}) (len=1) { - (map[string]interface {}) (len=3) { - (string) (len=11) "serviceName": (string) (len=7) "printer", - (string) (len=4) "name": (string) (len=7) "printed", - (string) (len=5) "group": (string) (len=7) "printer" - } - }, - (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", - (string) (len=7) "actions": ([]interface {}) (len=1) { - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=5) "print", - (string) (len=6) "params": (map[string]interface {}) { - } - } - }, - (string) (len=7) "version": (string) "", - (string) (len=8) "metadata": (map[string]interface {}) { - }, - (string) (len=8) "settings": (map[string]interface {}) { - } - } - }, - (string) (len=9) "available": (bool) true - }, - (string) (len=19) "nodedeScannerBroker": (map[string]interface {}) (len=9) { - (string) (len=2) "id": (string) (len=18) "node_scannerBroker", - (string) (len=3) "cpu": (int64) 0, - (string) (len=3) "seq": (int64) 0, - (string) (len=6) "client": (map[string]interface {}) (len=3) { - (string) (len=11) "langVersion": (string) (len=3) "1.5", - (string) (len=4) "type": (string) (len=12) "moleculer-go", - (string) (len=7) "version": (string) (len=5) "0.1.0" - }, - (string) (len=6) "cpuSeq": (int64) 0, - (string) (len=6) "ipList": ([]string) (len=1) { - (string) (len=13) "100.100.0.100" - }, - (string) (len=8) "hostname": (string) "", - (string) (len=8) "services": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=7) { - (string) (len=4) "name": (string) (len=7) "scanner", - (string) (len=6) "events": ([]interface {}) (len=1) { - (map[string]interface {}) (len=3) { - (string) (len=11) "serviceName": (string) (len=7) "scanner", - (string) (len=4) "name": (string) (len=7) "scanned", - (string) (len=5) "group": (string) (len=7) "scanner" - } - }, - (string) (len=6) "nodeID": (string) (len=18) "node_scannerBroker", - (string) (len=7) "actions": ([]interface {}) (len=1) { - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=4) "scan", - (string) (len=6) "params": (map[string]interface {}) { - } - } - }, - (string) (len=7) "version": (string) "", - (string) (len=8) "metadata": (map[string]interface {}) { - }, - (string) (len=8) "settings": (map[string]interface {}) { - } - } - }, - (string) (len=9) "available": (bool) true - } + (string) (len=13) "nodeCpuBroker": (map[string]interface {}) , + (string) (len=15) "noPrinterBroker": (map[string]interface {}) , + (string) (len=19) "nodedeScannerBroker": (map[string]interface {}) } diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-withActions-$node.services1 b/registry/.snapshots/registry_test-glob--func3-1-1-1-withActions-$node.services1 index 334688d1..4fa560c8 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-withActions-$node.services1 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-withActions-$node.services1 @@ -2,26 +2,42 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=7) { (string) (len=4) "name": (string) (len=5) "$node", - (string) (len=7) "actions": ([]map[string]interface {}) (len=4) { - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=4) "list", + (string) (len=7) "actions": (map[string]map[string]interface {}) (len=6) { + (string) (len=4) "list": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=10) "$node.list", (string) (len=6) "params": (map[string]interface {}) { - } + }, + (string) (len=7) "rawName": (string) (len=4) "list" }, - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=6) "events", + (string) (len=6) "events": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=12) "$node.events", (string) (len=6) "params": (map[string]interface {}) { - } + }, + (string) (len=7) "rawName": (string) (len=6) "events" }, - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=7) "actions", + (string) (len=6) "health": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=12) "$node.health", (string) (len=6) "params": (map[string]interface {}) { - } + }, + (string) (len=7) "rawName": (string) (len=6) "health" }, - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=8) "services", + (string) (len=7) "actions": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=13) "$node.actions", (string) (len=6) "params": (map[string]interface {}) { - } + }, + (string) (len=7) "rawName": (string) (len=7) "actions" + }, + (string) (len=7) "options": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=13) "$node.options", + (string) (len=6) "params": (map[string]interface {}) { + }, + (string) (len=7) "rawName": (string) (len=7) "options" + }, + (string) (len=8) "services": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=14) "$node.services", + (string) (len=6) "params": (map[string]interface {}) { + }, + (string) (len=7) "rawName": (string) (len=8) "services" } }, (string) (len=7) "version": (string) "", @@ -36,11 +52,12 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=7) { (string) (len=4) "name": (string) (len=7) "printer", - (string) (len=7) "actions": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=5) "print", + (string) (len=7) "actions": (map[string]map[string]interface {}) (len=1) { + (string) (len=5) "print": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=13) "printer.print", (string) (len=6) "params": (map[string]interface {}) { - } + }, + (string) (len=7) "rawName": (string) (len=5) "print" } }, (string) (len=7) "version": (string) "", diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-withActions-$node.services2 b/registry/.snapshots/registry_test-glob--func3-1-1-1-withActions-$node.services2 index f6d083c6..02583933 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-withActions-$node.services2 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-withActions-$node.services2 @@ -2,26 +2,42 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=7) { (string) (len=4) "name": (string) (len=5) "$node", - (string) (len=7) "actions": ([]map[string]interface {}) (len=4) { - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=4) "list", + (string) (len=7) "actions": (map[string]map[string]interface {}) (len=6) { + (string) (len=4) "list": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=10) "$node.list", (string) (len=6) "params": (map[string]interface {}) { - } + }, + (string) (len=7) "rawName": (string) (len=4) "list" }, - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=6) "events", + (string) (len=6) "events": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=12) "$node.events", (string) (len=6) "params": (map[string]interface {}) { - } + }, + (string) (len=7) "rawName": (string) (len=6) "events" }, - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=7) "actions", + (string) (len=6) "health": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=12) "$node.health", (string) (len=6) "params": (map[string]interface {}) { - } + }, + (string) (len=7) "rawName": (string) (len=6) "health" }, - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=8) "services", + (string) (len=7) "actions": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=13) "$node.actions", (string) (len=6) "params": (map[string]interface {}) { - } + }, + (string) (len=7) "rawName": (string) (len=7) "actions" + }, + (string) (len=7) "options": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=13) "$node.options", + (string) (len=6) "params": (map[string]interface {}) { + }, + (string) (len=7) "rawName": (string) (len=7) "options" + }, + (string) (len=8) "services": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=14) "$node.services", + (string) (len=6) "params": (map[string]interface {}) { + }, + (string) (len=7) "rawName": (string) (len=8) "services" } }, (string) (len=7) "version": (string) "", @@ -36,11 +52,12 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=7) { (string) (len=4) "name": (string) (len=7) "printer", - (string) (len=7) "actions": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=5) "print", + (string) (len=7) "actions": (map[string]map[string]interface {}) (len=1) { + (string) (len=5) "print": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=13) "printer.print", (string) (len=6) "params": (map[string]interface {}) { - } + }, + (string) (len=7) "rawName": (string) (len=5) "print" } }, (string) (len=7) "version": (string) "", @@ -55,11 +72,12 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=7) { (string) (len=4) "name": (string) (len=7) "scanner", - (string) (len=7) "actions": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=4) "scan", + (string) (len=7) "actions": (map[string]map[string]interface {}) (len=1) { + (string) (len=4) "scan": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=12) "scanner.scan", (string) (len=6) "params": (map[string]interface {}) { - } + }, + (string) (len=7) "rawName": (string) (len=4) "scan" } }, (string) (len=7) "version": (string) "", diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-withActions-$node.services3 b/registry/.snapshots/registry_test-glob--func3-1-1-1-withActions-$node.services3 index 1f841ede..14141a7b 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-withActions-$node.services3 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-withActions-$node.services3 @@ -2,11 +2,12 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=7) { (string) (len=4) "name": (string) (len=3) "cpu", - (string) (len=7) "actions": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=7) "compute", + (string) (len=7) "actions": (map[string]map[string]interface {}) (len=1) { + (string) (len=7) "compute": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=11) "cpu.compute", (string) (len=6) "params": (map[string]interface {}) { - } + }, + (string) (len=7) "rawName": (string) (len=7) "compute" } }, (string) (len=7) "version": (string) "", @@ -21,26 +22,42 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=7) { (string) (len=4) "name": (string) (len=5) "$node", - (string) (len=7) "actions": ([]map[string]interface {}) (len=4) { - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=4) "list", + (string) (len=7) "actions": (map[string]map[string]interface {}) (len=6) { + (string) (len=4) "list": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=10) "$node.list", (string) (len=6) "params": (map[string]interface {}) { - } + }, + (string) (len=7) "rawName": (string) (len=4) "list" }, - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=6) "events", + (string) (len=6) "events": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=12) "$node.events", (string) (len=6) "params": (map[string]interface {}) { - } + }, + (string) (len=7) "rawName": (string) (len=6) "events" }, - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=7) "actions", + (string) (len=6) "health": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=12) "$node.health", (string) (len=6) "params": (map[string]interface {}) { - } + }, + (string) (len=7) "rawName": (string) (len=6) "health" }, - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=8) "services", + (string) (len=7) "actions": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=13) "$node.actions", (string) (len=6) "params": (map[string]interface {}) { - } + }, + (string) (len=7) "rawName": (string) (len=7) "actions" + }, + (string) (len=7) "options": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=13) "$node.options", + (string) (len=6) "params": (map[string]interface {}) { + }, + (string) (len=7) "rawName": (string) (len=7) "options" + }, + (string) (len=8) "services": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=14) "$node.services", + (string) (len=6) "params": (map[string]interface {}) { + }, + (string) (len=7) "rawName": (string) (len=8) "services" } }, (string) (len=7) "version": (string) "", @@ -55,11 +72,12 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=7) { (string) (len=4) "name": (string) (len=7) "printer", - (string) (len=7) "actions": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=5) "print", + (string) (len=7) "actions": (map[string]map[string]interface {}) (len=1) { + (string) (len=5) "print": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=13) "printer.print", (string) (len=6) "params": (map[string]interface {}) { - } + }, + (string) (len=7) "rawName": (string) (len=5) "print" } }, (string) (len=7) "version": (string) "", @@ -74,11 +92,12 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=7) { (string) (len=4) "name": (string) (len=7) "scanner", - (string) (len=7) "actions": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=2) { - (string) (len=4) "name": (string) (len=4) "scan", + (string) (len=7) "actions": (map[string]map[string]interface {}) (len=1) { + (string) (len=4) "scan": (map[string]interface {}) (len=3) { + (string) (len=4) "name": (string) (len=12) "scanner.scan", (string) (len=6) "params": (map[string]interface {}) { - } + }, + (string) (len=7) "rawName": (string) (len=4) "scan" } }, (string) (len=7) "version": (string) "", diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-withEndpoints-$node.actions1 b/registry/.snapshots/registry_test-glob--func3-1-1-1-withEndpoints-$node.actions1 index 359ff7a3..ed63c541 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-withEndpoints-$node.actions1 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-withEndpoints-$node.actions1 @@ -2,7 +2,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=10) "$node.list", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": ([]map[string]interface {}) (len=1) { @@ -16,7 +16,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=12) "$node.events", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": ([]map[string]interface {}) (len=1) { @@ -30,7 +30,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=13) "$node.actions", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": ([]map[string]interface {}) (len=1) { @@ -44,7 +44,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=13) "printer.print", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": ([]map[string]interface {}) (len=1) { @@ -58,7 +58,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=14) "$node.services", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": ([]map[string]interface {}) (len=1) { diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-withEndpoints-$node.actions2 b/registry/.snapshots/registry_test-glob--func3-1-1-1-withEndpoints-$node.actions2 index d904e635..035663a2 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-withEndpoints-$node.actions2 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-withEndpoints-$node.actions2 @@ -2,10 +2,22 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=10) "$node.list", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, - (string) (len=9) "endpoints": ([]map[string]interface {}) (len=1) { + (string) (len=9) "endpoints": ([]map[string]interface {}) (len=4) { + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, (map[string]interface {}) (len=2) { (string) (len=6) "nodeID": (string) (len=18) "node_scannerBroker", (string) (len=9) "available": (bool) true @@ -16,10 +28,22 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=12) "$node.events", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, - (string) (len=9) "endpoints": ([]map[string]interface {}) (len=1) { + (string) (len=9) "endpoints": ([]map[string]interface {}) (len=4) { + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, (map[string]interface {}) (len=2) { (string) (len=6) "nodeID": (string) (len=18) "node_scannerBroker", (string) (len=9) "available": (bool) true @@ -30,7 +54,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=12) "scanner.scan", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": ([]map[string]interface {}) (len=1) { @@ -44,10 +68,22 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=13) "$node.actions", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, - (string) (len=9) "endpoints": ([]map[string]interface {}) (len=1) { + (string) (len=9) "endpoints": ([]map[string]interface {}) (len=4) { + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, (map[string]interface {}) (len=2) { (string) (len=6) "nodeID": (string) (len=18) "node_scannerBroker", (string) (len=9) "available": (bool) true @@ -58,10 +94,18 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=13) "printer.print", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) false, (string) (len=9) "available": (bool) true, - (string) (len=9) "endpoints": ([]map[string]interface {}) (len=1) { + (string) (len=9) "endpoints": ([]map[string]interface {}) (len=3) { + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, (map[string]interface {}) (len=2) { (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", (string) (len=9) "available": (bool) true @@ -72,10 +116,22 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=14) "$node.services", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, - (string) (len=9) "endpoints": ([]map[string]interface {}) (len=1) { + (string) (len=9) "endpoints": ([]map[string]interface {}) (len=4) { + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, (map[string]interface {}) (len=2) { (string) (len=6) "nodeID": (string) (len=18) "node_scannerBroker", (string) (len=9) "available": (bool) true diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-withEndpoints-$node.actions3 b/registry/.snapshots/registry_test-glob--func3-1-1-1-withEndpoints-$node.actions3 index 0bd37761..9477c6d8 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-withEndpoints-$node.actions3 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-withEndpoints-$node.actions3 @@ -2,13 +2,45 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=10) "$node.list", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, - (string) (len=9) "endpoints": ([]map[string]interface {}) (len=1) { + (string) (len=9) "endpoints": ([]map[string]interface {}) (len=9) { (map[string]interface {}) (len=2) { (string) (len=6) "nodeID": (string) (len=14) "node_cpuBroker", (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_scannerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_scannerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_scannerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_scannerBroker", + (string) (len=9) "available": (bool) true } } } @@ -16,7 +48,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=11) "cpu.compute", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, (string) (len=9) "endpoints": ([]map[string]interface {}) (len=1) { @@ -30,13 +62,45 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=12) "$node.events", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, - (string) (len=9) "endpoints": ([]map[string]interface {}) (len=1) { + (string) (len=9) "endpoints": ([]map[string]interface {}) (len=9) { (map[string]interface {}) (len=2) { (string) (len=6) "nodeID": (string) (len=14) "node_cpuBroker", (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_scannerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_scannerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_scannerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_scannerBroker", + (string) (len=9) "available": (bool) true } } } @@ -44,10 +108,22 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=12) "scanner.scan", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) false, (string) (len=9) "available": (bool) true, - (string) (len=9) "endpoints": ([]map[string]interface {}) (len=1) { + (string) (len=9) "endpoints": ([]map[string]interface {}) (len=4) { + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_scannerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_scannerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_scannerBroker", + (string) (len=9) "available": (bool) true + }, (map[string]interface {}) (len=2) { (string) (len=6) "nodeID": (string) (len=18) "node_scannerBroker", (string) (len=9) "available": (bool) true @@ -58,13 +134,45 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=13) "$node.actions", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, - (string) (len=9) "endpoints": ([]map[string]interface {}) (len=1) { + (string) (len=9) "endpoints": ([]map[string]interface {}) (len=9) { (map[string]interface {}) (len=2) { (string) (len=6) "nodeID": (string) (len=14) "node_cpuBroker", (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_scannerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_scannerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_scannerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_scannerBroker", + (string) (len=9) "available": (bool) true } } } @@ -72,14 +180,26 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=13) "printer.print", - (string) (len=5) "count": (int) 2, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, - (string) (len=9) "endpoints": ([]map[string]interface {}) (len=2) { + (string) (len=9) "endpoints": ([]map[string]interface {}) (len=5) { (map[string]interface {}) (len=2) { (string) (len=6) "nodeID": (string) (len=14) "node_cpuBroker", (string) (len=9) "available": (bool) true }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, (map[string]interface {}) (len=2) { (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", (string) (len=9) "available": (bool) true @@ -90,13 +210,45 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=5) { (string) (len=4) "name": (string) (len=14) "$node.services", - (string) (len=5) "count": (int) 1, + (string) (len=5) "count": (string) (len=7) "removed", (string) (len=8) "hasLocal": (bool) true, (string) (len=9) "available": (bool) true, - (string) (len=9) "endpoints": ([]map[string]interface {}) (len=1) { + (string) (len=9) "endpoints": ([]map[string]interface {}) (len=9) { (map[string]interface {}) (len=2) { (string) (len=6) "nodeID": (string) (len=14) "node_cpuBroker", (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_scannerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_scannerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_scannerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_scannerBroker", + (string) (len=9) "available": (bool) true } } } diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-withEndpoints-$node.services2 b/registry/.snapshots/registry_test-glob--func3-1-1-1-withEndpoints-$node.services2 index 21749a9d..8a062a51 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-withEndpoints-$node.services2 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-withEndpoints-$node.services2 @@ -9,7 +9,11 @@ (string) (len=8) "settings": (map[string]interface {}) { }, (string) (len=9) "available": (bool) true, - (string) (len=9) "endpoints": ([]map[string]interface {}) (len=1) { + (string) (len=9) "endpoints": ([]map[string]interface {}) (len=2) { + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, (map[string]interface {}) (len=2) { (string) (len=6) "nodeID": (string) (len=18) "node_scannerBroker", (string) (len=9) "available": (bool) true diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-withEndpoints-$node.services3 b/registry/.snapshots/registry_test-glob--func3-1-1-1-withEndpoints-$node.services3 index 13be483f..7f654a4e 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-withEndpoints-$node.services3 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-withEndpoints-$node.services3 @@ -27,10 +27,18 @@ (string) (len=8) "settings": (map[string]interface {}) { }, (string) (len=9) "available": (bool) true, - (string) (len=9) "endpoints": ([]map[string]interface {}) (len=1) { + (string) (len=9) "endpoints": ([]map[string]interface {}) (len=3) { (map[string]interface {}) (len=2) { (string) (len=6) "nodeID": (string) (len=14) "node_cpuBroker", (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_printerBroker", + (string) (len=9) "available": (bool) true + }, + (map[string]interface {}) (len=2) { + (string) (len=6) "nodeID": (string) (len=18) "node_scannerBroker", + (string) (len=9) "available": (bool) true } } } diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-withEvents-$node.services1 b/registry/.snapshots/registry_test-glob--func3-1-1-1-withEvents-$node.services1 index 4b69d061..ea439a0e 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-withEvents-$node.services1 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-withEvents-$node.services1 @@ -2,7 +2,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=7) { (string) (len=4) "name": (string) (len=5) "$node", - (string) (len=6) "events": ([]map[string]interface {}) { + (string) (len=6) "events": (map[string]map[string]interface {}) { }, (string) (len=7) "version": (string) "", (string) (len=8) "hasLocal": (bool) true, @@ -16,9 +16,8 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=7) { (string) (len=4) "name": (string) (len=7) "printer", - (string) (len=6) "events": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=3) { - (string) (len=11) "serviceName": (string) (len=7) "printer", + (string) (len=6) "events": (map[string]map[string]interface {}) (len=1) { + (string) (len=7) "printed": (map[string]interface {}) (len=2) { (string) (len=4) "name": (string) (len=7) "printed", (string) (len=5) "group": (string) (len=7) "printer" } diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-withEvents-$node.services2 b/registry/.snapshots/registry_test-glob--func3-1-1-1-withEvents-$node.services2 index eb11ce2d..e69fd849 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-withEvents-$node.services2 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-withEvents-$node.services2 @@ -2,7 +2,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=7) { (string) (len=4) "name": (string) (len=5) "$node", - (string) (len=6) "events": ([]map[string]interface {}) { + (string) (len=6) "events": (map[string]map[string]interface {}) { }, (string) (len=7) "version": (string) "", (string) (len=8) "hasLocal": (bool) true, @@ -16,9 +16,8 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=7) { (string) (len=4) "name": (string) (len=7) "printer", - (string) (len=6) "events": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=3) { - (string) (len=11) "serviceName": (string) (len=7) "printer", + (string) (len=6) "events": (map[string]map[string]interface {}) (len=1) { + (string) (len=7) "printed": (map[string]interface {}) (len=2) { (string) (len=4) "name": (string) (len=7) "printed", (string) (len=5) "group": (string) (len=7) "printer" } @@ -35,9 +34,8 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=7) { (string) (len=4) "name": (string) (len=7) "scanner", - (string) (len=6) "events": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=3) { - (string) (len=11) "serviceName": (string) (len=7) "scanner", + (string) (len=6) "events": (map[string]map[string]interface {}) (len=1) { + (string) (len=7) "scanned": (map[string]interface {}) (len=2) { (string) (len=4) "name": (string) (len=7) "scanned", (string) (len=5) "group": (string) (len=7) "scanner" } diff --git a/registry/.snapshots/registry_test-glob--func3-1-1-1-withEvents-$node.services3 b/registry/.snapshots/registry_test-glob--func3-1-1-1-withEvents-$node.services3 index 1f884576..37e5e44b 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-1-1-withEvents-$node.services3 +++ b/registry/.snapshots/registry_test-glob--func3-1-1-1-withEvents-$node.services3 @@ -2,7 +2,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=7) { (string) (len=4) "name": (string) (len=3) "cpu", - (string) (len=6) "events": ([]map[string]interface {}) { + (string) (len=6) "events": (map[string]map[string]interface {}) { }, (string) (len=7) "version": (string) "", (string) (len=8) "hasLocal": (bool) true, @@ -16,7 +16,7 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=7) { (string) (len=4) "name": (string) (len=5) "$node", - (string) (len=6) "events": ([]map[string]interface {}) { + (string) (len=6) "events": (map[string]map[string]interface {}) { }, (string) (len=7) "version": (string) "", (string) (len=8) "hasLocal": (bool) true, @@ -30,9 +30,8 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=7) { (string) (len=4) "name": (string) (len=7) "printer", - (string) (len=6) "events": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=3) { - (string) (len=11) "serviceName": (string) (len=7) "printer", + (string) (len=6) "events": (map[string]map[string]interface {}) (len=1) { + (string) (len=7) "printed": (map[string]interface {}) (len=2) { (string) (len=4) "name": (string) (len=7) "printed", (string) (len=5) "group": (string) (len=7) "printer" } @@ -49,9 +48,8 @@ ([]map[string]interface {}) (len=1) { (map[string]interface {}) (len=7) { (string) (len=4) "name": (string) (len=7) "scanner", - (string) (len=6) "events": ([]map[string]interface {}) (len=1) { - (map[string]interface {}) (len=3) { - (string) (len=11) "serviceName": (string) (len=7) "scanner", + (string) (len=6) "events": (map[string]map[string]interface {}) (len=1) { + (string) (len=7) "scanned": (map[string]interface {}) (len=2) { (string) (len=4) "name": (string) (len=7) "scanned", (string) (len=5) "group": (string) (len=7) "scanner" } diff --git a/registry/.snapshots/registry_test-glob--func3-1-3-remote-serviceAdded b/registry/.snapshots/registry_test-glob--func3-1-3-remote-serviceAdded index 805d3f1c..e6e0916b 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-3-remote-serviceAdded +++ b/registry/.snapshots/registry_test-glob--func3-1-3-remote-serviceAdded @@ -5,18 +5,18 @@ (string) (len=7) "version": (string) "" }, (map[string]interface {}) (len=3) { - (string) (len=4) "name": (string) (len=14) "remote-service", - (string) (len=6) "nodeID": (string) (len=10) "test-node2", + (string) (len=4) "name": (string) (len=17) "internal-consumer", + (string) (len=6) "nodeID": (string) (len=10) "test-node1", (string) (len=7) "version": (string) "" }, (map[string]interface {}) (len=3) { - (string) (len=4) "name": (string) (len=17) "internal-consumer", + (string) (len=4) "name": (string) (len=5) "$node", (string) (len=6) "nodeID": (string) (len=10) "test-node1", (string) (len=7) "version": (string) "" }, (map[string]interface {}) (len=3) { (string) (len=4) "name": (string) (len=5) "$node", - (string) (len=6) "nodeID": (string) (len=10) "test-node1", + (string) (len=6) "nodeID": (string) (len=10) "test-node2", (string) (len=7) "version": (string) "" } } diff --git a/registry/.snapshots/registry_test-glob--func3-1-3-remote-serviceRemoved b/registry/.snapshots/registry_test-glob--func3-1-3-remote-serviceRemoved index c741c97b..a2784469 100644 --- a/registry/.snapshots/registry_test-glob--func3-1-3-remote-serviceRemoved +++ b/registry/.snapshots/registry_test-glob--func3-1-3-remote-serviceRemoved @@ -1,3 +1,4 @@ -([]string) (len=1) { - (string) (len=14) "remote-service" +([]string) (len=2) { + (string) (len=14) "remote-service", + (string) (len=5) "$node" } diff --git a/registry/actionCatalog.go b/registry/actionCatalog.go index 79da18ba..2aea57be 100644 --- a/registry/actionCatalog.go +++ b/registry/actionCatalog.go @@ -1,7 +1,6 @@ package registry import ( - "errors" "fmt" "runtime/debug" "strings" @@ -35,6 +34,24 @@ func CreateActionCatalog(logger *log.Entry) *ActionCatalog { var actionCallRecovery = true //TODO extract this to a Config - useful to turn for Debug in tests. +type ActionError struct { + message string + stack string + action string +} + +func (e *ActionError) Error() string { + return e.message +} + +func (e *ActionError) Stack() string { + return e.stack +} + +func (e *ActionError) Action() string { + return e.action +} + // catchActionError is called defered after invoking a local action // if there is an error (recover () != nil) this functions log the error and stack track and encapsulate // the error inside a moleculer.Payload @@ -43,13 +60,16 @@ func (actionEntry *ActionEntry) catchActionError(context moleculer.BrokerContext return } if err := recover(); err != nil { - actionEntry.logger.Error("Action failed: ", context.ActionName(), "\n[Error]: ", err, "\n[Stack Trace]: ", string(debug.Stack())) + stackTrace := string(debug.Stack()) + actionEntry.logger.Error("Action failed: ", context.ActionName(), "\n[Error]: ", err, "\n[Stack Trace]: ", stackTrace) errT, isError := err.(error) + msg := "" if isError { - result <- payload.New(errT) + msg = errT.Error() } else { - result <- payload.New(errors.New(fmt.Sprint(err))) + msg = fmt.Sprint(err) } + result <- payload.New(&ActionError{msg, stackTrace, actionEntry.action.Name()}) } } diff --git a/registry/node.go b/registry/node.go index 2b940ed1..43b2d84b 100644 --- a/registry/node.go +++ b/registry/node.go @@ -73,18 +73,13 @@ func CreateNode(id string, local bool, logger *log.Entry) moleculer.Node { services: services, logger: logger, isLocal: local, + sequence: 1, } var result moleculer.Node = &node return result } -//Unavailable mark the node as unavailable -func (node *Node) Unavailable() { - node.isAvailable = false -} - -func (node *Node) Update(info map[string]interface{}) bool { - id := info["id"] +func (node *Node) Update(id string, info map[string]interface{}) bool { if id != node.id { panic(fmt.Errorf("Node.Update() - the id received : %s does not match this node.id : %s", id, node.id)) } @@ -99,23 +94,43 @@ func (node *Node) Update(info map[string]interface{}) bool { node.hostname = info["hostname"].(string) node.client = info["client"].(map[string]interface{}) + node.services = filterServices(info) + node.logger.Debug("node.Update() node.services: ", node.services) + + node.sequence = int64Field(info, "seq", 0) + node.cpu = int64Field(info, "cpu", 0) + node.cpuSequence = int64Field(info, "cpuSeq", 0) + + return reconnected +} + +// filterServices return all services excluding local services (example: $node) +func filterServices(info map[string]interface{}) []map[string]interface{} { item, ok := info["services"] - items := make([]interface{}, 0) + var items []interface{} if ok { items = item.([]interface{}) } services := make([]map[string]interface{}, len(items)) for index, item := range items { - services[index] = item.(map[string]interface{}) + m := item.(map[string]interface{}) + if strings.Index(m["name"].(string), "$") == -1 { + services[index] = m + } } - node.services = services - node.logger.Debug("node.Update() node.services: ", node.services) - - node.sequence = int64(info["seq"].(float64)) - node.cpu = int64(info["cpu"].(float64)) - node.cpuSequence = int64(info["cpuSeq"].(float64)) + return services +} - return reconnected +func int64Field(values map[string]interface{}, field string, def int64) int64 { + raw, exists := values[field] + if !exists { + return def + } + fv, valid := raw.(float64) + if !valid { + return def + } + return int64(fv) } func interfaceToString(list []interface{}) []string { @@ -126,24 +141,12 @@ func interfaceToString(list []interface{}) []string { return result } -// removeInternalServices remove internal services from the list of services. -//checks the service name if it starts with $ -func (node *Node) removeInternalServices(services []map[string]interface{}) []map[string]interface{} { - result := make([]map[string]interface{}, 0) - for _, item := range services { - if !(strings.Index(item["name"].(string), "$") == 0) { - result = append(result, item) - } - } - return result -} - // ExportAsMap export the node info as a map // this map is used to publish the node info to other nodes. func (node *Node) ExportAsMap() map[string]interface{} { resultMap := make(map[string]interface{}) resultMap["id"] = node.id - resultMap["services"] = node.removeInternalServices(node.services) + resultMap["services"] = node.services // node.removeInternalServices(node.services) resultMap["ipList"] = node.ipList resultMap["hostname"] = node.hostname resultMap["client"] = node.client @@ -170,8 +173,8 @@ func (node *Node) HeartBeat(heartbeat map[string]interface{}) { node.isAvailable = true node.offlineSince = 0 } - node.cpu = int64(heartbeat["cpu"].(float64)) - node.cpuSequence = int64(heartbeat["cpuSeq"].(float64)) + node.cpu = int64Field(heartbeat, "cpu", 0) + node.cpuSequence = int64Field(heartbeat, "cpuSeq", 0) node.lastHeartBeatTime = time.Now().Unix() } @@ -183,6 +186,16 @@ func (node *Node) IsAvailable() bool { return node.isLocal || node.isAvailable } +//Unavailable mark the node as unavailable +func (node *Node) Unavailable() { + node.isAvailable = false +} + +//Unavailable mark the node as available +func (node *Node) Available() { + node.isAvailable = true +} + func (node *Node) IsLocal() bool { return node.isLocal } diff --git a/registry/nodeCatalog.go b/registry/nodeCatalog.go index 48c72c02..b3953c76 100644 --- a/registry/nodeCatalog.go +++ b/registry/nodeCatalog.go @@ -80,10 +80,10 @@ func (catalog *NodeCatalog) Info(info map[string]interface{}) (bool, bool) { node, exists := catalog.findNode(sender) var reconnected bool if exists { - reconnected = node.Update(info) + reconnected = node.Update(sender, info) } else { node := CreateNode(sender, false, catalog.logger.WithField("remote-node", sender)) - node.Update(info) + node.Update(sender, info) catalog.Add(node) } return exists, reconnected diff --git a/registry/nodeService.go b/registry/nodeService.go index 51204842..b241ce6f 100644 --- a/registry/nodeService.go +++ b/registry/nodeService.go @@ -2,6 +2,7 @@ package registry import ( "strings" + "time" "github.com/moleculer-go/moleculer" "github.com/moleculer-go/moleculer/service" @@ -9,6 +10,7 @@ import ( // createNodeService create the local node service -> $node. func createNodeService(registry *ServiceRegistry) *service.Service { + var startedTime time.Time isAvailable := func(nodeID string) bool { node, exists := registry.nodes.findNode(nodeID) return exists && node.IsAvailable() @@ -24,8 +26,11 @@ func createNodeService(registry *ServiceRegistry) *service.Service { } return service.FromSchema(moleculer.ServiceSchema{ Name: "$node", + Started: func(moleculer.BrokerContext, moleculer.ServiceSchema) { + startedTime = time.Now() + }, Actions: []moleculer.Action{ - moleculer.Action{ + { Name: "events", Handler: func(context moleculer.Context, params moleculer.Payload) interface{} { onlyLocal := params.Get("onlyLocal").Exists() && params.Get("onlyLocal").Bool() @@ -79,7 +84,7 @@ func createNodeService(registry *ServiceRegistry) *service.Service { return result }, }, - moleculer.Action{ + { Name: "actions", Description: "Find and return a list of actions in the registry of this service broker.", Handler: func(context moleculer.Context, params moleculer.Payload) interface{} { @@ -134,7 +139,7 @@ func createNodeService(registry *ServiceRegistry) *service.Service { return result }, }, - moleculer.Action{ + { Name: "services", Description: "Find and return a list of services in the registry of this service broker.", Schema: moleculer.ObjectSchema{ @@ -159,7 +164,6 @@ func createNodeService(registry *ServiceRegistry) *service.Service { withEvents := params.Get("withEvents").Exists() && params.Get("withEvents").Bool() withEndpoints := params.Get("withEndpoints").Exists() && params.Get("withEndpoints").Bool() - //ISSUE: is returning duplicate services. -> printer which exists in 2 brokers.. local and remote. result := make([]map[string]interface{}, 0) for name, entries := range registry.services.listByName() { has := func(check func(nodeID string) bool) bool { @@ -207,7 +211,7 @@ func createNodeService(registry *ServiceRegistry) *service.Service { return result }, }, - moleculer.Action{ + { Name: "list", Description: "Find and return a list of nodes in the registry of this service broker.", Handler: func(context moleculer.Context, params moleculer.Payload) interface{} { @@ -234,6 +238,138 @@ func createNodeService(registry *ServiceRegistry) *service.Service { return result }, }, + // + /* FIXME: currently returns incomplete payload */ + { + Name: "health", + Description: "Return health status of local node including transit, os, cpu, memory, process, network, client information.", + Handler: func(context moleculer.Context, params moleculer.Payload) interface{} { + /* TODO: map as JSON which follows standard structure + { cpu: + { load1: 1.802734375, + load5: 1.8603515625, + load15: 1.82666015625, + cores: 16, + utilization: 11 }, + mem: + { free: 886513664, + total: 68719476736, + percent: 1.2900471687316895 }, + os: + { uptime: 1507874, + type: 'Darwin', + release: '18.5.0', + hostname: 'imac.local', + arch: 'x64', + platform: 'darwin', + user: + { uid: 501, + gid: 20, + username: 'dehypnosis', + homedir: '/Users/dehypnosis', + shell: '/bin/zsh' } }, + process: + { pid: 67218, + memory: + { rss: 60497920, + heapTotal: 32743424, + heapUsed: 27003144, + external: 104085 }, + uptime: 80.434, + argv: + [ '/usr/local/bin/node', + '/usr/local/bin/moleculer', + 'connect', + 'nats://dev.nats.svc.cluster.local:4222' ] }, + client: { type: 'nodejs', version: '0.13.8', langVersion: 'v8.16.0' }, + net: { ip: [ '222.107.184.34', '172.30.1.7' ] }, + transit: + { stat: + { packets: + { sent: { count: 28, bytes: 13409 }, + received: { count: 158, bytes: 199426 } } } }, + time: + { now: 1556737026387, + iso: '2019-05-01T18:57:06.387Z', + utc: 'Wed, 01 May 2019 18:57:06 GMT' } } + */ + nodeInfo := registry.localNode.ExportAsMap() + return map[string]interface{}{ + "cpu": map[string]interface{}{}, + "mem": map[string]interface{}{}, + "os": map[string]interface{}{}, + "process": map[string]interface{}{ + "uptime": time.Since(startedTime), + }, + "client": nodeInfo["client"], + "net": map[string]interface{}{ + "ip": nodeInfo["ipList"], + }, + "transit": map[string]interface{}{ + // TODO + }, + "time": map[string]interface{}{ + // TODO + }, + } + }, + }, + /* TODO: support $node.options */ + { + Name: "options", + Description: "Return broker configuration of local node.", + Handler: func(context moleculer.Context, params moleculer.Payload) interface{} { + /* TODO: map as JSON which follows standard structure + { logger: true, + transporter: 'nats://dev.nats.svc.cluster.local:4222', + nodeID: 'cli-imac.local-67218', + namespace: '', + logLevel: null, + logFormatter: 'default', + logObjectPrinter: null, + requestTimeout: 0, + retryPolicy: + { enabled: false, + retries: 5, + delay: 100, + maxDelay: 1000, + factor: 2, + check: [Function: check] }, + maxCallLevel: 0, + heartbeatInterval: 5, + heartbeatTimeout: 15, + tracking: { enabled: false, shutdownTimeout: 5000 }, + disableBalancer: false, + registry: { strategy: 'RoundRobin', preferLocal: true }, + circuitBreaker: + { enabled: false, + threshold: 0.5, + windowTime: 60, + minRequestCount: 20, + halfOpenTime: 10000, + check: [Function: check] }, + bulkhead: { enabled: false, concurrency: 10, maxQueueSize: 100 }, + transit: + { maxQueueSize: 50000, + packetLogFilter: [], + disableReconnect: false, + disableVersionCheck: false }, + cacher: null, + serializer: null, + validation: true, + validator: null, + metrics: false, + metricsRate: 1, + internalServices: true, + internalMiddlewares: true, + hotReload: false, + middlewares: null, + replCommands: null } + */ + // from registry.broker.Config ? + return map[string]interface{}{} + }, + }, }, }, registry.broker) } diff --git a/registry/registry.go b/registry/registry.go index 08d72220..7e769252 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -13,7 +13,6 @@ import ( "github.com/moleculer-go/moleculer/payload" "github.com/moleculer-go/moleculer" - "github.com/moleculer-go/moleculer/options" "github.com/moleculer-go/moleculer/service" "github.com/moleculer-go/moleculer/strategy" @@ -38,6 +37,7 @@ type ServiceRegistry struct { heartbeatFrequency time.Duration heartbeatTimeout time.Duration offlineCheckFrequency time.Duration + offlineTimeout time.Duration nodeReceivedMutex *sync.Mutex } @@ -53,13 +53,13 @@ func createStrategy(broker *moleculer.BrokerDelegates) strategy.Strategy { return strategy.RoundRobinStrategy{} } -func CreateRegistry(broker *moleculer.BrokerDelegates) *ServiceRegistry { +func CreateRegistry(nodeID string, broker *moleculer.BrokerDelegates) *ServiceRegistry { config := broker.Config transit := createTransit(broker) strategy := createStrategy(broker) - logger := broker.Logger("registry", "Moleculer Registry") - nodeID := config.DiscoverNodeID() + logger := broker.Logger("registry", nodeID) localNode := CreateNode(nodeID, true, logger.WithField("Node", nodeID)) + localNode.Unavailable() registry := &ServiceRegistry{ broker: broker, transit: transit, @@ -73,17 +73,16 @@ func CreateRegistry(broker *moleculer.BrokerDelegates) *ServiceRegistry { heartbeatFrequency: config.HeartbeatFrequency, heartbeatTimeout: config.HeartbeatTimeout, offlineCheckFrequency: config.OfflineCheckFrequency, + offlineTimeout: config.OfflineTimeout, stopping: false, nodeReceivedMutex: &sync.Mutex{}, } - registry.logger.Info("Service Registry created for broker: ", nodeID) + registry.logger.Debug("Service Registry created for broker: ", nodeID) broker.Bus().On("$broker.started", func(args ...interface{}) { registry.logger.Debug("Registry -> $broker.started event") - if registry.localNode != nil { - //TODO: broadcast info ? I think we do that elsewhere already.. - } + registry.localNode.Available() }) registry.setupMessageHandlers() @@ -121,11 +120,11 @@ func (registry *ServiceRegistry) Stop() { registry.logger.Debug("Registry Stopping...") registry.stopping = true err := <-registry.transit.Disconnect() + registry.localNode.Unavailable() if err != nil { registry.logger.Debug("Error trying to disconnect transit - error: ", err) return } - registry.logger.Debug("Transit Disconnected -> Registry Full Stop!") } @@ -237,12 +236,12 @@ func (registry *ServiceRegistry) BroadcastEvent(context moleculer.BrokerContext) // DelegateCall : invoke a service action and return a channel which will eventualy deliver the results ;). // This call might be local or remote. -func (registry *ServiceRegistry) LoadBalanceCall(context moleculer.BrokerContext, opts ...moleculer.OptionsFunc) chan moleculer.Payload { +func (registry *ServiceRegistry) LoadBalanceCall(context moleculer.BrokerContext, opts ...moleculer.Options) chan moleculer.Payload { actionName := context.ActionName() params := context.Payload() registry.logger.Trace("LoadBalanceCall() - actionName: ", actionName, " params: ", params, " opts: ", opts) - actionEntry := registry.nextAction(actionName, registry.strategy, options.Wrap(opts)) + actionEntry := registry.nextAction(actionName, registry.strategy, opts...) if actionEntry == nil { msg := fmt.Sprint("Registry - endpoint not found for actionName: ", actionName) registry.logger.Error(msg) @@ -332,12 +331,11 @@ func (registry *ServiceRegistry) checkExpiredRemoteNodes() { } func (registry *ServiceRegistry) checkOfflineNodes() { - timeout := registry.offlineCheckFrequency * 10 - expiredNodes := registry.nodes.expiredNodes(timeout) + expiredNodes := registry.nodes.expiredNodes(registry.offlineTimeout) for _, node := range expiredNodes { nodeID := node.GetID() registry.nodes.removeNode(nodeID) - registry.logger.Warnf("Removed offline Node: %s from the registry because it hasn't submitted heartbeat in %d seconds.", nodeID, timeout) + registry.logger.Warnf("Removed offline Node: %s from the registry because it hasn't submitted heartbeat in %d seconds.", nodeID, registry.offlineTimeout) } } @@ -386,6 +384,14 @@ func (registry *ServiceRegistry) disconnectMessageReceived(message moleculer.Pay } } +func compatibility(info map[string]interface{}) map[string]interface{} { + _, exists := info["version"] + if !exists { + info["version"] = "" + } + return info +} + // remoteNodeInfoReceived process the remote node info message and add to local registry. func (registry *ServiceRegistry) remoteNodeInfoReceived(message moleculer.Payload) { registry.nodeReceivedMutex.Lock() @@ -394,7 +400,7 @@ func (registry *ServiceRegistry) remoteNodeInfoReceived(message moleculer.Payloa services := message.Get("services").MapArray() exists, reconnected := registry.nodes.Info(message.RawMap()) for _, serviceInfo := range services { - + serviceInfo = compatibility(serviceInfo) svc, newService, updatedActions, newActions, deletedActions, updatedEvents, newEvents, deletedEvents := registry.services.updateRemote(nodeID, serviceInfo) for _, newAction := range newActions { @@ -436,6 +442,8 @@ func (registry *ServiceRegistry) remoteNodeInfoReceived(message moleculer.Payloa } if newService { + registry.logger.Infof("Registry - remote %s service is registered.", svc.FullName()) + registry.broker.Bus().EmitAsync( "$registry.service.added", []interface{}{svc.Summary()}) @@ -507,7 +515,7 @@ func (registry *ServiceRegistry) notifyServiceAded(svc map[string]string) { "$registry.service.added", []interface{}{svc}) } else { - registry.broker.Bus().Once("$broker.started", func(data ...interface{}) { + registry.broker.Bus().Once("$broker.started", func(...interface{}) { registry.broker.Bus().EmitAsync( "$registry.service.added", []interface{}{svc}) @@ -517,10 +525,9 @@ func (registry *ServiceRegistry) notifyServiceAded(svc map[string]string) { // nextAction it will find and return the next action to be invoked. // If multiple nodes that contain this action are found it will use the strategy to decide which one to use. -func (registry *ServiceRegistry) nextAction(actionName string, strategy strategy.Strategy, opts ...moleculer.OptionsFunc) *ActionEntry { - nodeID := options.String("nodeID", opts) - if nodeID != "" { - return registry.actions.NextFromNode(actionName, nodeID) +func (registry *ServiceRegistry) nextAction(actionName string, strategy strategy.Strategy, opts ...moleculer.Options) *ActionEntry { + if len(opts) > 0 && opts[0].NodeID != "" { + return registry.actions.NextFromNode(actionName, opts[0].NodeID) } return registry.actions.Next(actionName, strategy) } diff --git a/registry/registry_test.go b/registry/registry_test.go index e07347cd..1c030a8c 100644 --- a/registry/registry_test.go +++ b/registry/registry_test.go @@ -144,7 +144,8 @@ func cleanupNode(in map[string]interface{}) map[string]interface{} { return make(map[string]interface{}) } in["ipList"] = []string{"100.100.0.100"} - in["hostname"] = "" + in["hostname"] = "removed" + in["seq"] = "removed" return in } @@ -153,7 +154,7 @@ func cleanupAction(ins []map[string]interface{}) []map[string]interface{} { for index, item := range ins { result[index] = map[string]interface{}{ "name": item["name"], - "count": item["count"], + "count": "removed", "hasLocal": item["hasLocal"], "available": item["available"], "endpoints": item["endpoints"], @@ -209,7 +210,7 @@ var _ = Describe("Registry", func() { scannerBroker := createScannerBroker(mem) scannerBroker.Start() - time.Sleep(100 * time.Millisecond) + time.Sleep(300 * time.Millisecond) result = <-scannerBroker.Call(action, params) Expect(result.Exists()).Should(BeTrue()) @@ -217,7 +218,7 @@ var _ = Describe("Registry", func() { cpuBroker := createCpuBroker(mem) cpuBroker.Start() - time.Sleep(100 * time.Millisecond) + time.Sleep(300 * time.Millisecond) result = <-cpuBroker.Call(action, params) Expect(result.Exists()).Should(BeTrue()) @@ -464,15 +465,16 @@ var _ = Describe("Registry", func() { Dependencies: []string{"internal-consumer", "service-added"}, }) bkr2.Start() - //time.Sleep(100 * time.Millisecond) + time.Sleep(300 * time.Millisecond) <-addedChan + sort.Strings(serviceRemoved) Expect(snap.SnapshotMulti("remote-serviceAdded", serviceAdded)).ShouldNot(HaveOccurred()) Expect(snap.SnapshotMulti("empty-serviceRemoved", serviceRemoved)).ShouldNot(HaveOccurred()) //stop broker 2 .. should remove services on broker 1 bkr2.Stop() - time.Sleep(100 * time.Millisecond) + time.Sleep(200 * time.Millisecond) sort.Strings(serviceRemoved) Expect(snap.SnapshotMulti("remote-serviceRemoved", serviceRemoved)).ShouldNot(HaveOccurred()) @@ -508,7 +510,7 @@ var _ = Describe("Registry", func() { Expect(scanResult.IsError()).Should(BeTrue()) scannerBroker.Start() - time.Sleep(time.Second) + time.Sleep(time.Millisecond * 300) scanResult = <-scannerBroker.Call("scanner.scan", scanText) Expect(scanResult.IsError()).ShouldNot(Equal(true)) @@ -519,7 +521,7 @@ var _ = Describe("Registry", func() { Expect(scanResult.Value()).Should(Equal(scanText)) cpuBroker.Start() - time.Sleep(time.Second) //sleep until services are registered + time.Sleep(time.Millisecond * 300) //sleep until services are registered contentToCompute := "Some long long text ..." computeResult := <-cpuBroker.Call("cpu.compute", contentToCompute) @@ -528,7 +530,7 @@ var _ = Describe("Registry", func() { //stopping broker B scannerBroker.Stop() // TODO -> not implemented yet - time.Sleep(time.Second) + time.Sleep(time.Millisecond * 300) Expect(func() { <-scannerBroker.Call("scanner.scan", scanText) diff --git a/registry/serviceCatalog.go b/registry/serviceCatalog.go index 1facf439..ed621e97 100644 --- a/registry/serviceCatalog.go +++ b/registry/serviceCatalog.go @@ -26,7 +26,7 @@ func CreateServiceCatalog(logger *log.Entry) *ServiceCatalog { } // createKey creates the catalogy key used in the map -func createKey(name string, version string, nodeID string) string { +func createKey(name, version, nodeID string) string { return fmt.Sprintf("%s:%s:%s", nodeID, name, version) } @@ -163,23 +163,13 @@ func serviceEventExists(name string, events []service.Event) bool { return false } -func itemMapExists(name string, items []interface{}) bool { - for _, item := range items { - mvalue := item.(map[string]interface{}) - if mvalue["name"].(string) == name { - return true - } - } - return false -} - // updateEvents takes the remote service definition and the current service definition and calculates what events are new, updated or removed. // add new events to the service and return new, updated and deleted events. func (serviceCatalog *ServiceCatalog) updateEvents(serviceMap map[string]interface{}, current *service.Service) ([]map[string]interface{}, []service.Event, []service.Event) { var updated []map[string]interface{} var newEvents, deletedEvents []service.Event - events := serviceMap["events"].([]interface{}) + events := serviceMap["events"].(map[string]interface{}) for _, item := range events { event := item.(map[string]interface{}) name := event["name"].(string) @@ -192,7 +182,8 @@ func (serviceCatalog *ServiceCatalog) updateEvents(serviceMap map[string]interfa } for _, event := range current.Events() { name := event.Name() - if !itemMapExists(name, events) { + _, exists := events[name] + if !exists { deletedEvents = append(deletedEvents, event) current.RemoveEvent(name) } @@ -206,7 +197,7 @@ func (serviceCatalog *ServiceCatalog) updateActions(serviceMap map[string]interf var updatedActions []map[string]interface{} var newActions, deletedActions []service.Action - actions := serviceMap["actions"].([]interface{}) + actions := serviceMap["actions"].(map[string]interface{}) for _, item := range actions { action := item.(map[string]interface{}) name := action["name"].(string) @@ -219,7 +210,8 @@ func (serviceCatalog *ServiceCatalog) updateActions(serviceMap map[string]interf } for _, action := range current.Actions() { name := action.Name() - if !itemMapExists(name, actions) { + _, exists := actions[name] + if !exists { deletedActions = append(deletedActions, action) current.RemoveAction(name) } @@ -229,6 +221,7 @@ func (serviceCatalog *ServiceCatalog) updateActions(serviceMap map[string]interf // updateRemote : update remote service info and return what actions are new, updated and deleted func (serviceCatalog *ServiceCatalog) updateRemote(nodeID string, serviceInfo map[string]interface{}) (*service.Service, bool, []map[string]interface{}, []service.Action, []service.Action, []map[string]interface{}, []service.Event, []service.Event) { + key := createKey(serviceInfo["name"].(string), serviceInfo["version"].(string), nodeID) item, serviceExists := serviceCatalog.services.Load(key) @@ -242,6 +235,7 @@ func (serviceCatalog *ServiceCatalog) updateRemote(nodeID string, serviceInfo ma } newService := service.CreateServiceFromMap(serviceInfo) + newService.SetNodeID(nodeID) serviceCatalog.Add(newService) newActions := newService.Actions() diff --git a/service/.snapshots/service-glob--func19-12 b/service/.snapshots/service-glob--func19-12 new file mode 100644 index 00000000..70a441f9 --- /dev/null +++ b/service/.snapshots/service-glob--func19-12 @@ -0,0 +1,88 @@ +(moleculer.ServiceSchema) { + Name: (string) (len=5) "earth", + Version: (string) (len=3) "0.2", + Dependencies: ([]string) { + }, + Settings: (map[string]interface {}) (len=2) { + (string) (len=10) "dinosauros": (bool) true, + (string) (len=7) "craters": (bool) true + }, + Metadata: (map[string]interface {}) (len=2) { + (string) (len=10) "resolution": (string) (len=4) "high", + (string) (len=11) "star-system": (string) (len=3) "sun" + }, + Hooks: (map[string]interface {}) (len=2) { + (string) (len=12) "solar-system": (string) (len=4) "true", + (string) (len=5) "earth": (string) (len=4) "true" + }, + Mixins: ([]moleculer.Mixin) (len=1) { + (moleculer.Mixin) { + Name: (string) (len=4) "moon", + Dependencies: ([]string) , + Settings: (map[string]interface {}) (len=1) { + (string) (len=7) "craters": (bool) true + }, + Metadata: (map[string]interface {}) (len=1) { + (string) (len=10) "resolution": (string) (len=4) "high" + }, + Hooks: (map[string]interface {}) (len=1) { + (string) (len=5) "earth": (string) (len=4) "true" + }, + Actions: ([]moleculer.Action) (len=1) { + (moleculer.Action) { + Name: (string) (len=4) "tide", + Handler: (moleculer.ActionHandler) , + Schema: (moleculer.ActionSchema) , + Settings: (map[string]interface {}) , + Description: (string) "" + } + }, + Events: ([]moleculer.Event) (len=2) { + (moleculer.Event) { + Name: (string) (len=12) "moon.isClose", + Group: (string) "", + Handler: (moleculer.EventHandler) + }, + (moleculer.Event) { + Name: (string) (len=13) "earth.rotates", + Group: (string) "", + Handler: (moleculer.EventHandler) + } + }, + Created: (moleculer.CreatedFunc) , + Started: (moleculer.LifecycleFunc) , + Stopped: (moleculer.LifecycleFunc) + } + }, + Actions: ([]moleculer.Action) (len=2) { + (moleculer.Action) { + Name: (string) (len=4) "tide", + Handler: (moleculer.ActionHandler) , + Schema: (moleculer.ActionSchema) , + Settings: (map[string]interface {}) , + Description: (string) "" + }, + (moleculer.Action) { + Name: (string) (len=6) "rotate", + Handler: (moleculer.ActionHandler) , + Schema: (moleculer.ActionSchema) , + Settings: (map[string]interface {}) , + Description: (string) "" + } + }, + Events: ([]moleculer.Event) (len=2) { + (moleculer.Event) { + Name: (string) (len=12) "moon.isClose", + Group: (string) "", + Handler: (moleculer.EventHandler) + }, + (moleculer.Event) { + Name: (string) (len=13) "earth.rotates", + Group: (string) "", + Handler: (moleculer.EventHandler) + } + }, + Created: (moleculer.CreatedFunc) , + Started: (moleculer.LifecycleFunc) , + Stopped: (moleculer.LifecycleFunc) +} diff --git a/service/.snapshots/service-glob--func19-34 b/service/.snapshots/service-glob--func19-34 new file mode 100644 index 00000000..d6d17124 --- /dev/null +++ b/service/.snapshots/service-glob--func19-34 @@ -0,0 +1,72 @@ +([]moleculer.Action) (len=10) { + (moleculer.Action) { + Name: (string) (len=10) "justParams", + Handler: (moleculer.ActionHandler) , + Schema: (moleculer.ActionSchema) , + Settings: (map[string]interface {}) , + Description: (string) "" + }, + (moleculer.Action) { + Name: (string) (len=11) "justContext", + Handler: (moleculer.ActionHandler) , + Schema: (moleculer.ActionSchema) , + Settings: (map[string]interface {}) , + Description: (string) "" + }, + (moleculer.Action) { + Name: (string) (len=14) "completeAction", + Handler: (moleculer.ActionHandler) , + Schema: (moleculer.ActionSchema) , + Settings: (map[string]interface {}) , + Description: (string) "" + }, + (moleculer.Action) { + Name: (string) (len=14) "noArgsNoReturn", + Handler: (moleculer.ActionHandler) , + Schema: (moleculer.ActionSchema) , + Settings: (map[string]interface {}) , + Description: (string) "" + }, + (moleculer.Action) { + Name: (string) (len=18) "justParamsNoReturn", + Handler: (moleculer.ActionHandler) , + Schema: (moleculer.ActionSchema) , + Settings: (map[string]interface {}) , + Description: (string) "" + }, + (moleculer.Action) { + Name: (string) (len=19) "justContextNoReturn", + Handler: (moleculer.ActionHandler) , + Schema: (moleculer.ActionSchema) , + Settings: (map[string]interface {}) , + Description: (string) "" + }, + (moleculer.Action) { + Name: (string) (len=22) "completeActionNoReturn", + Handler: (moleculer.ActionHandler) , + Schema: (moleculer.ActionSchema) , + Settings: (map[string]interface {}) , + Description: (string) "" + }, + (moleculer.Action) { + Name: (string) (len=24) "nonPointerCompleteAction", + Handler: (moleculer.ActionHandler) , + Schema: (moleculer.ActionSchema) , + Settings: (map[string]interface {}) , + Description: (string) "" + }, + (moleculer.Action) { + Name: (string) (len=3) "add", + Handler: (moleculer.ActionHandler) , + Schema: (moleculer.ActionSchema) , + Settings: (map[string]interface {}) , + Description: (string) "" + }, + (moleculer.Action) { + Name: (string) (len=6) "noArgs", + Handler: (moleculer.ActionHandler) , + Schema: (moleculer.ActionSchema) , + Settings: (map[string]interface {}) , + Description: (string) "" + } +} diff --git a/service/.snapshots/service-glob--func19-7 b/service/.snapshots/service-glob--func19-7 new file mode 100644 index 00000000..1650c49e --- /dev/null +++ b/service/.snapshots/service-glob--func19-7 @@ -0,0 +1,16 @@ +([]moleculer.Action) (len=2) { + (moleculer.Action) { + Name: (string) (len=4) "tide", + Handler: (moleculer.ActionHandler) , + Schema: (moleculer.ActionSchema) , + Settings: (map[string]interface {}) , + Description: (string) "" + }, + (moleculer.Action) { + Name: (string) (len=6) "rotate", + Handler: (moleculer.ActionHandler) , + Schema: (moleculer.ActionSchema) , + Settings: (map[string]interface {}) , + Description: (string) "" + } +} diff --git a/service/.snapshots/service-glob--func19-8 b/service/.snapshots/service-glob--func19-8 new file mode 100644 index 00000000..37d4eede --- /dev/null +++ b/service/.snapshots/service-glob--func19-8 @@ -0,0 +1,12 @@ +([]moleculer.Event) (len=2) { + (moleculer.Event) { + Name: (string) (len=12) "moon.isClose", + Group: (string) "", + Handler: (moleculer.EventHandler) + }, + (moleculer.Event) { + Name: (string) (len=13) "earth.rotates", + Group: (string) "", + Handler: (moleculer.EventHandler) + } +} diff --git a/service/service.go b/service/service.go index 336ff8dd..57057e49 100644 --- a/service/service.go +++ b/service/service.go @@ -333,23 +333,23 @@ func (service *Service) AsMap() map[string]interface{} { panic("no service.nodeID") } - actions := make([]map[string]interface{}, len(service.actions)) - for index, serviceAction := range service.actions { + actions := map[string]map[string]interface{}{} + for _, serviceAction := range service.actions { actionInfo := make(map[string]interface{}) - actionInfo["name"] = serviceAction.name + actionInfo["name"] = serviceAction.fullname + actionInfo["rawName"] = serviceAction.name actionInfo["params"] = paramsAsMap(&serviceAction.params) - actions[index] = actionInfo + actions[serviceAction.name] = actionInfo } serviceInfo["actions"] = actions - events := make([]map[string]interface{}, 0) + events := map[string]map[string]interface{}{} for _, serviceEvent := range service.events { if !isInternalEvent(serviceEvent) { eventInfo := make(map[string]interface{}) eventInfo["name"] = serviceEvent.name - eventInfo["serviceName"] = serviceEvent.serviceName eventInfo["group"] = serviceEvent.group - events = append(events, eventInfo) + events[serviceEvent.name] = eventInfo } } serviceInfo["events"] = events @@ -378,7 +378,7 @@ func paramsAsMap(params *moleculer.ActionSchema) map[string]interface{} { func (service *Service) AddActionMap(actionInfo map[string]interface{}) *Action { action := CreateServiceAction( service.fullname, - actionInfo["name"].(string), + actionInfo["rawName"].(string), nil, paramsFromMap(actionInfo["schema"]), ) @@ -407,10 +407,14 @@ func (service *Service) RemoveAction(fullname string) { } func (service *Service) AddEventMap(eventInfo map[string]interface{}) *Event { + group, exists := eventInfo["group"] + if !exists { + group = service.name + } serviceEvent := Event{ name: eventInfo["name"].(string), - serviceName: eventInfo["serviceName"].(string), - group: eventInfo["group"].(string), + serviceName: service.name, + group: group.(string), } service.events = append(service.events, serviceEvent) return &serviceEvent @@ -434,13 +438,13 @@ func populateFromMap(service *Service, serviceInfo map[string]interface{}) { service.settings = serviceInfo["settings"].(map[string]interface{}) service.metadata = serviceInfo["metadata"].(map[string]interface{}) - actions := serviceInfo["actions"].([]interface{}) + actions := serviceInfo["actions"].(map[string]interface{}) for _, item := range actions { actionInfo := item.(map[string]interface{}) service.AddActionMap(actionInfo) } - events := serviceInfo["events"].([]interface{}) + events := serviceInfo["events"].(map[string]interface{}) for _, item := range events { eventInfo := item.(map[string]interface{}) service.AddEventMap(eventInfo) @@ -834,9 +838,6 @@ func CreateServiceFromMap(serviceInfo map[string]interface{}) *Service { if service.name == "" { panic(errors.New("Service name can't be empty! Maybe it is not a valid Service schema.")) } - if service.nodeID == "" { - panic(errors.New("Service nodeID can't be empty!")) - } return service } @@ -865,6 +866,18 @@ var actionHandlerTemplates = []aHandlerTemplate{ return obj.(func(moleculer.Context, moleculer.Payload) interface{}) }, }, + { + match: func(obj interface{}) bool { + _, valid := obj.(func(moleculer.Context, moleculer.Payload) moleculer.Payload) + return valid + }, + wrap: func(m reflect.Value, obj interface{}) moleculer.ActionHandler { + ah := obj.(func(moleculer.Context, moleculer.Payload) moleculer.Payload) + return func(ctx moleculer.Context, p moleculer.Payload) interface{} { + return ah(ctx, p) + } + }, + }, //Context, params NO return { match: func(obj interface{}) bool { diff --git a/test/node_mock.go b/test/node_mock.go index 6e8fa3be..e5a1cef8 100644 --- a/test/node_mock.go +++ b/test/node_mock.go @@ -10,16 +10,19 @@ type NodeMock struct { ExportAsMapResult map[string]interface{} IsAvailableResult bool IsExpiredResult bool - PublishCalls int + PublishCalls int } -func (node *NodeMock) Update(info map[string]interface{}) bool { +func (node *NodeMock) Update(id string, info map[string]interface{}) bool { return node.UpdateResult } func (node *NodeMock) Unavailable() { node.IsAvailableResult = false } +func (node *NodeMock) Available() { + node.IsAvailableResult = true +} func (node *NodeMock) GetID() string { return node.ID diff --git a/transit/nats/nats.go b/transit/nats/nats.go index 511e039f..c3413d98 100644 --- a/transit/nats/nats.go +++ b/transit/nats/nats.go @@ -110,7 +110,6 @@ func (t *NatsTransporter) Subscribe(command, nodeID string, handler transit.Tran } topic := t.topicName(command, nodeID) - t.logger.Info("NATS Subscribe to ", topic) sub, err := t.conn.Subscribe(topic, func(msg *nats.Msg) { payload := t.serializer.BytesToPayload(&msg.Data) diff --git a/transit/pubsub/pubsub.go b/transit/pubsub/pubsub.go index 3b24938b..b3799d82 100644 --- a/transit/pubsub/pubsub.go +++ b/transit/pubsub/pubsub.go @@ -36,10 +36,12 @@ type PubSub struct { knownNeighbours map[string]int64 neighboursTimeout time.Duration neighboursMutex *sync.Mutex + brokerStarted bool } func (pubsub *PubSub) onServiceAdded(values ...interface{}) { - if pubsub.isConnected { + if pubsub.isConnected && pubsub.brokerStarted { + pubsub.broker.LocalNode().IncreaseSequence() pubsub.broadcastNodeInfo("") } } @@ -47,6 +49,7 @@ func (pubsub *PubSub) onServiceAdded(values ...interface{}) { func (pubsub *PubSub) onBrokerStarted(values ...interface{}) { if pubsub.isConnected { pubsub.broadcastNodeInfo("") + pubsub.brokerStarted = true } } @@ -138,17 +141,17 @@ func isNats(v string) bool { func (pubsub *PubSub) createTransport() transit.Transport { var transport transit.Transport if pubsub.broker.Config.TransporterFactory != nil { - pubsub.logger.Info("createTransport() using a custom factory ...") + pubsub.logger.Info("Transporter: Custom factory") transport = pubsub.broker.Config.TransporterFactory().(transit.Transport) } else if pubsub.broker.Config.Transporter == "STAN" { - pubsub.logger.Info("createTransport() creating NATS Streaming Transporter") + pubsub.logger.Info("Transporter: NatsStreamingTransporter") transport = pubsub.createStanTransporter() } else if isNats(pubsub.broker.Config.Transporter) { - pubsub.logger.Info("createTransport() creating NATS Transporter") + pubsub.logger.Info("Transporter: NatsTransporter") transport = pubsub.createNatsTransporter() } else { - pubsub.logger.Info("createTransport() creating default Memory Transporter") + pubsub.logger.Info("Transporter: Memory") transport = pubsub.createMemoryTransporter() } transport.SetPrefix("MOL") @@ -222,7 +225,7 @@ func (pubsub *PubSub) waitForNeighbours() bool { expected := pubsub.expectedNeighbours() neighbours := pubsub.neighbours() if expected <= neighbours && (expected > 0 || neighbours > 0) { - pubsub.logger.Info("waitForNeighbours() - received info from all expected neighbours :) -> expected: ", expected) + pubsub.logger.Debug("waitForNeighbours() - received info from all expected neighbours :) -> expected: ", expected) return true } if time.Since(start) > pubsub.neighboursTimeout { @@ -378,14 +381,31 @@ func (pubsub *PubSub) reponseHandler() transit.TransportHandler { if message.Get("success").Bool() { result = message.Get("data") } else { - result = payload.New(errors.New(message.Get("error").String())) + result = pubsub.parseError(message) } pubsub.logger.Trace("reponseHandler() id: ", id, " result: ", result) - go func() { - (*request.resultChan) <- result - }() + (*request.resultChan) <- result + } +} + +func (pubsub *PubSub) parseError(message moleculer.Payload) moleculer.Payload { + if pubsub.isMoleculerJSError(message) { + return payload.New(pubsub.moleculerJSError(message)) } + return payload.New(errors.New(message.Get("error").String())) +} + +func (pubsub *PubSub) isMoleculerJSError(message moleculer.Payload) bool { + return message.Get("error").Get("message").Exists() +} + +func (pubsub *PubSub) moleculerJSError(message moleculer.Payload) error { + msg := message.Get("error").Get("message").String() + if message.Get("error").Get("stack").Exists() { + pubsub.logger.Error(message.Get("error").Get("stack").Value()) + } + return errors.New(msg) } func (pubsub *PubSub) sendResponse(context moleculer.BrokerContext, response moleculer.Payload) { @@ -404,8 +424,22 @@ func (pubsub *PubSub) sendResponse(context moleculer.BrokerContext, response mol values["meta"] = context.Meta() if response.IsError() { - values["error"] = response.String() + var errMap map[string]string + actionError, isActionError := response.Value().(ActionError) + if isActionError { + errMap = map[string]string{ + "message": actionError.Error(), + "stack": actionError.Stack(), + "name": "Error", + } + } else { + errMap = map[string]string{ + "message": response.String(), + "name": "Error", + } + } values["success"] = false + values["error"] = errMap } else { values["success"] = true values["data"] = response.Value() @@ -422,6 +456,11 @@ func (pubsub *PubSub) sendResponse(context moleculer.BrokerContext, response mol pubsub.transport.Publish("RES", targetNodeID, message) } +type ActionError interface { + Error() string + Stack() string +} + // requestHandler : handles when a request arrives on this node. // 1: create a moleculer.Context from the message, the moleculer.Context contains the target action // 2: invoke the action @@ -479,7 +518,13 @@ func (pubsub *PubSub) broadcastNodeInfo(targetNodeID string) { func (pubsub *PubSub) discoverHandler() transit.TransportHandler { return func(message moleculer.Payload) { sender := message.Get("sender").String() - pubsub.broadcastNodeInfo(sender) + if pubsub.brokerStarted { + pubsub.broadcastNodeInfo(sender) + } else { + pubsub.broker.Bus().Once("$broker.started", func(...interface{}) { + pubsub.broadcastNodeInfo(sender) + }) + } } } @@ -580,7 +625,7 @@ func (pubsub *PubSub) Connect() chan error { endChan <- nil return endChan } - pubsub.logger.Info("PubSub - Connecting transport...") + pubsub.logger.Debug("PubSub - Connecting transport...") pubsub.transport = pubsub.createTransport() go func() { err := <-pubsub.transport.Connect() diff --git a/transit/pubsub/pubsub_test.go b/transit/pubsub/pubsub_test.go index 4caa9625..9f594cd1 100644 --- a/transit/pubsub/pubsub_test.go +++ b/transit/pubsub/pubsub_test.go @@ -37,7 +37,8 @@ var _ = Describe("PubSub Internals", func() { return &localNode }, }, - transport: mockT, + transport: mockT, + brokerStarted: true, } pubsub.onServiceAdded() Expect(mockT.PublishCalled).Should(BeTrue())