Documentation
¶
Overview ¶
Package instance_manager manages the instances
Package instance_manager manages the instances
Index ¶
- Constants
- type Child
- type Parent
- func (parent *Parent) AddInstance(handlerType config.HandlerType, routes kvRef, routeDeps kvRef, clients kvRef) (string, error)
- func (parent *Parent) Close()
- func (parent *Parent) DeleteInstance(instanceId string, instant bool) error
- func (parent *Parent) Handler(instanceId string) *zmq.Socket
- func (parent *Parent) Instances() map[string]string
- func (parent *Parent) NewInstanceId() string
- func (parent *Parent) Ready() (string, *zmq.Socket)
- func (parent *Parent) SetMessageOperations(messageOps *message.Operations)
- func (parent *Parent) Start() error
- func (parent *Parent) Status() string
Constants ¶
const ( InstanceCreated = "created" // Instance is created, but not initialized yet. Used for child instances Running = "running" Idle = "idle" )
const ( EventClose = "close" // notify instance manager is starting to close EventIdle = "idle" // notify instance manager is not running but created EventReady = "ready" // notify instance manager is ready EventError = "error" // notify if in the instance manager occurred an error EventInstanceAdded = "instance_added" // notify if a new instance added EventInstanceDeleted = "instance_deleted" // notify if the instance is deleted )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Parent ¶
type Parent struct { MessageOps *message.Operations // contains filtered or unexported fields }
func (*Parent) AddInstance ¶
func (parent *Parent) AddInstance(handlerType config.HandlerType, routes kvRef, routeDeps kvRef, clients kvRef) (string, error)
AddInstance to the handler. Returns generated instance id and error. Returns error if instance manager is not running. Returns error if instance client socket creation fails.
func (*Parent) Close ¶
func (parent *Parent) Close()
Close the instance manager. It deletes all instances. The reason why it doesn't return an error is because it broadcasts them through pub socket. Also, it needs a time for closing the instance manager sockets.
func (*Parent) DeleteInstance ¶
DeleteInstance closes the instance. Sends the signal to the instance thread. Instance sends back to instance manager a status update.
instanceId must be registered in the instance manager.
If instant is set true, then instance is closed without replying back
func (*Parent) Handler ¶
Handler socket of the instance.
Don't do any operations on the socket, as it could lead to the unexpected behaviors of the instance manager.
func (*Parent) NewInstanceId ¶
func (*Parent) SetMessageOperations ¶
func (parent *Parent) SetMessageOperations(messageOps *message.Operations)
SetMessageOperations overwrites the default message type.