Documentation ¶
Index ¶
- func CreateNode(id string, local bool, logger *log.Entry) moleculer.Node
- type ActionCatalog
- func (actionCatalog *ActionCatalog) Add(action service.Action, serv *service.Service, local bool)
- func (actionCatalog *ActionCatalog) Find(name string) []ActionEntry
- func (actionCatalog *ActionCatalog) Next(actionName string, stg strategy.Strategy) *ActionEntry
- func (actionCatalog *ActionCatalog) NextFromNode(actionName string, nodeID string) *ActionEntry
- func (actionCatalog *ActionCatalog) Remove(nodeID string, name string)
- func (actionCatalog *ActionCatalog) RemoveByNode(nodeID string)
- func (actionCatalog *ActionCatalog) Update(nodeID string, fullname string, updates map[string]interface{})
- type ActionEntry
- type ActionError
- type EventCatalog
- func (eventCatalog *EventCatalog) Add(event service.Event, service *service.Service, local bool)
- func (eventCatalog *EventCatalog) Find(name string, groups []string, preferLocal bool, localOnly bool, ...) []*EventEntry
- func (eventCatalog *EventCatalog) Remove(nodeID string, name string)
- func (eventCatalog *EventCatalog) RemoveByNode(nodeID string)
- func (eventCatalog *EventCatalog) Update(nodeID string, name string, updates map[string]interface{})
- type EventEntry
- type Node
- func (node *Node) Available()
- func (node *Node) ExportAsMap() map[string]interface{}
- func (node *Node) GetID() string
- func (node *Node) HeartBeat(heartbeat map[string]interface{})
- func (node *Node) IncreaseSequence()
- func (node *Node) IsAvailable() bool
- func (node *Node) IsExpired(timeout time.Duration) bool
- func (node *Node) IsLocal() bool
- func (node *Node) Publish(service map[string]interface{})
- func (node *Node) Unavailable()
- func (node *Node) Update(id string, info map[string]interface{}) bool
- type NodeCatalog
- type ServiceCatalog
- func (serviceCatalog *ServiceCatalog) Add(service *service.Service)
- func (serviceCatalog *ServiceCatalog) Find(name string, version string, nodeID string) bool
- func (serviceCatalog *ServiceCatalog) FindByName(name string) bool
- func (serviceCatalog *ServiceCatalog) Get(name string, version string, nodeID string) *service.Service
- func (serviceCatalog *ServiceCatalog) RemoveByNode(nodeID string) []*service.Service
- type ServiceEntry
- type ServiceRegistry
- func (registry *ServiceRegistry) AddLocalService(service *service.Service)
- func (registry *ServiceRegistry) BroadcastEvent(context moleculer.BrokerContext) []*EventEntry
- func (registry *ServiceRegistry) HandleRemoteEvent(context moleculer.BrokerContext)
- func (registry *ServiceRegistry) KnowAction(name string) bool
- func (registry *ServiceRegistry) KnowNode(nodeID string) bool
- func (registry *ServiceRegistry) KnowService(name string) bool
- func (registry *ServiceRegistry) KnownEventListeners(addNode bool) []string
- func (registry *ServiceRegistry) KnownNodes() []string
- func (registry *ServiceRegistry) LoadBalanceCall(context moleculer.BrokerContext, opts ...moleculer.Options) chan moleculer.Payload
- func (registry *ServiceRegistry) LoadBalanceEvent(context moleculer.BrokerContext) []*EventEntry
- func (registry *ServiceRegistry) LocalNode() moleculer.Node
- func (registry *ServiceRegistry) LocalServices() []*service.Service
- func (registry *ServiceRegistry) ServiceForAction(name string) []*service.Service
- func (registry *ServiceRegistry) Start()
- func (registry *ServiceRegistry) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ActionCatalog ¶
type ActionCatalog struct {
// contains filtered or unexported fields
}
func CreateActionCatalog ¶
func CreateActionCatalog(logger *log.Entry) *ActionCatalog
func (*ActionCatalog) Find ¶
func (actionCatalog *ActionCatalog) Find(name string) []ActionEntry
func (*ActionCatalog) Next ¶
func (actionCatalog *ActionCatalog) Next(actionName string, stg strategy.Strategy) *ActionEntry
Next find all actions registered in this node and use the strategy to select and return the best one to be called.
func (*ActionCatalog) NextFromNode ¶
func (actionCatalog *ActionCatalog) NextFromNode(actionName string, nodeID string) *ActionEntry
func (*ActionCatalog) Remove ¶
func (actionCatalog *ActionCatalog) Remove(nodeID string, name string)
func (*ActionCatalog) RemoveByNode ¶
func (actionCatalog *ActionCatalog) RemoveByNode(nodeID string)
RemoveByNode remove actions for the given nodeID.
type ActionEntry ¶
type ActionEntry struct {
// contains filtered or unexported fields
}
func (ActionEntry) IsLocal ¶
func (actionEntry ActionEntry) IsLocal() bool
func (ActionEntry) Service ¶
func (actionEntry ActionEntry) Service() *service.Service
func (ActionEntry) TargetNodeID ¶
func (actionEntry ActionEntry) TargetNodeID() string
type ActionError ¶
type ActionError struct {
// contains filtered or unexported fields
}
func (*ActionError) Action ¶
func (e *ActionError) Action() string
func (*ActionError) Error ¶
func (e *ActionError) Error() string
func (*ActionError) Stack ¶
func (e *ActionError) Stack() string
type EventCatalog ¶
type EventCatalog struct {
// contains filtered or unexported fields
}
func CreateEventCatalog ¶
func CreateEventCatalog(logger *log.Entry) *EventCatalog
func (*EventCatalog) Find ¶
func (eventCatalog *EventCatalog) Find(name string, groups []string, preferLocal bool, localOnly bool, stg strategy.Strategy) []*EventEntry
Find find all events registered in this node and use the strategy to select and return the best one to be called.
func (*EventCatalog) Remove ¶
func (eventCatalog *EventCatalog) Remove(nodeID string, name string)
func (*EventCatalog) RemoveByNode ¶
func (eventCatalog *EventCatalog) RemoveByNode(nodeID string)
RemoveByNode remove events for the given nodeID.
type EventEntry ¶
type EventEntry struct {
// contains filtered or unexported fields
}
func (*EventEntry) IsLocal ¶
func (eventEntry *EventEntry) IsLocal() bool
func (*EventEntry) String ¶
func (eventEntry *EventEntry) String() string
func (EventEntry) TargetNodeID ¶
func (eventEntry EventEntry) TargetNodeID() string
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (*Node) ExportAsMap ¶
ExportAsMap export the node info as a map this map is used to publish the node info to other nodes.
func (*Node) IncreaseSequence ¶
func (node *Node) IncreaseSequence()
func (*Node) IsAvailable ¶
type NodeCatalog ¶
type NodeCatalog struct {
// contains filtered or unexported fields
}
NodeCatalog catalog of nodes
func CreateNodesCatalog ¶
func CreateNodesCatalog(logger *log.Entry) *NodeCatalog
CreateNodesCatalog create a node catalog
func (*NodeCatalog) Add ¶
func (catalog *NodeCatalog) Add(node moleculer.Node)
Info : process info received about a NODE. It can be new, update to existing
func (*NodeCatalog) HeartBeat ¶
func (catalog *NodeCatalog) HeartBeat(heartbeat map[string]interface{}) bool
HeartBeat delegate the heart beat to the node in question payload.sender
type ServiceCatalog ¶
type ServiceCatalog struct {
// contains filtered or unexported fields
}
func CreateServiceCatalog ¶
func CreateServiceCatalog(logger *log.Entry) *ServiceCatalog
func (*ServiceCatalog) Add ¶
func (serviceCatalog *ServiceCatalog) Add(service *service.Service)
Add : add a service to the catalog.
func (*ServiceCatalog) Find ¶
func (serviceCatalog *ServiceCatalog) Find(name string, version string, nodeID string) bool
Has : Checks if a service for the given name, version and nodeID already exists in the catalog.
func (*ServiceCatalog) FindByName ¶
func (serviceCatalog *ServiceCatalog) FindByName(name string) bool
func (*ServiceCatalog) Get ¶
func (serviceCatalog *ServiceCatalog) Get(name string, version string, nodeID string) *service.Service
Get : Return the service for the given name, version and nodeID if it exists in the catalog.
func (*ServiceCatalog) RemoveByNode ¶
func (serviceCatalog *ServiceCatalog) RemoveByNode(nodeID string) []*service.Service
RemoveByNode remove services for the given nodeID.
type ServiceEntry ¶
type ServiceEntry struct {
// contains filtered or unexported fields
}
type ServiceRegistry ¶
type ServiceRegistry struct {
// contains filtered or unexported fields
}
func CreateRegistry ¶
func CreateRegistry(nodeID string, broker *moleculer.BrokerDelegates) *ServiceRegistry
func (*ServiceRegistry) AddLocalService ¶
func (registry *ServiceRegistry) AddLocalService(service *service.Service)
AddLocalService : add a local service to the registry it will create endpoints for all service actions.
func (*ServiceRegistry) BroadcastEvent ¶
func (registry *ServiceRegistry) BroadcastEvent(context moleculer.BrokerContext) []*EventEntry
func (*ServiceRegistry) HandleRemoteEvent ¶
func (registry *ServiceRegistry) HandleRemoteEvent(context moleculer.BrokerContext)
HandleRemoteEvent handle when a remote event is delivered and call all the local handlers.
func (*ServiceRegistry) KnowAction ¶
func (registry *ServiceRegistry) KnowAction(name string) bool
func (*ServiceRegistry) KnowNode ¶
func (registry *ServiceRegistry) KnowNode(nodeID string) bool
func (*ServiceRegistry) KnowService ¶
func (registry *ServiceRegistry) KnowService(name string) bool
func (*ServiceRegistry) KnownEventListeners ¶
func (registry *ServiceRegistry) KnownEventListeners(addNode bool) []string
func (*ServiceRegistry) KnownNodes ¶
func (registry *ServiceRegistry) KnownNodes() []string
func (*ServiceRegistry) LoadBalanceCall ¶
func (registry *ServiceRegistry) LoadBalanceCall(context moleculer.BrokerContext, opts ...moleculer.Options) chan moleculer.Payload
DelegateCall : invoke a service action and return a channel which will eventualy deliver the results ;). This call might be local or remote.
func (*ServiceRegistry) LoadBalanceEvent ¶
func (registry *ServiceRegistry) LoadBalanceEvent(context moleculer.BrokerContext) []*EventEntry
LoadBalanceEvent load balance an event based on the known targetNodes.
func (*ServiceRegistry) LocalNode ¶
func (registry *ServiceRegistry) LocalNode() moleculer.Node
func (*ServiceRegistry) LocalServices ¶
func (registry *ServiceRegistry) LocalServices() []*service.Service
func (*ServiceRegistry) ServiceForAction ¶
func (registry *ServiceRegistry) ServiceForAction(name string) []*service.Service
func (*ServiceRegistry) Start ¶
func (registry *ServiceRegistry) Start()
Start : start the registry background processes.
func (*ServiceRegistry) Stop ¶
func (registry *ServiceRegistry) Stop()