service

package
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2023 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JoinVersionToName

func JoinVersionToName(name string, version string) string

func MergeSettings

func MergeSettings(settings ...map[string]interface{}) map[string]interface{}

func ParseVersion

func ParseVersion(iver interface{}) string

Types

type Action

type Action struct {
	// contains filtered or unexported fields
}

func CreateServiceAction

func CreateServiceAction(serviceName string, actionName string, handler nucleo.ActionHandler, params nucleo.ActionParams) Action

func (*Action) FullName

func (serviceAction *Action) FullName() string

func (*Action) Handler

func (serviceAction *Action) Handler() nucleo.ActionHandler

func (*Action) Name

func (serviceAction *Action) Name() string

func (*Action) Params added in v0.1.4

func (serviceAction *Action) Params() nucleo.Payload

type Event

type Event struct {
	// contains filtered or unexported fields
}

func CreateServiceEvent

func CreateServiceEvent(eventName, serviceName, group string, handler nucleo.EventHandler) Event

func (*Event) Group

func (event *Event) Group() string

func (*Event) Handler

func (event *Event) Handler() nucleo.EventHandler

func (*Event) Name

func (event *Event) Name() string

func (*Event) ServiceName

func (event *Event) ServiceName() string

type HasCreated

type HasCreated interface {
	Created(nucleo.ServiceSchema, *log.Entry)
}

type HasCreatedNoParams

type HasCreatedNoParams interface {
	Created()
}

type HasDependencies

type HasDependencies interface {
	Dependencies() []string
}

type HasEvents

type HasEvents interface {
	Events() []nucleo.Event
}

type HasMetadata

type HasMetadata interface {
	Metadata() map[string]interface{}
}

type HasMixins

type HasMixins interface {
	Mixins() []nucleo.Mixin
}

type HasName

type HasName interface {
	Name() string
}

type HasSettings

type HasSettings interface {
	Settings() map[string]interface{}
}

type HasStarted

type HasStarted interface {
	Started(nucleo.BrokerContext, nucleo.ServiceSchema)
}

type HasStartedNoParams

type HasStartedNoParams interface {
	Started()
}

type HasStopped

type HasStopped interface {
	Stopped(nucleo.BrokerContext, nucleo.ServiceSchema)
}

type HasStoppedNoParams

type HasStoppedNoParams interface {
	Stopped()
}

type HasVersion

type HasVersion interface {
	Version() string
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func CreateServiceFromMap

func CreateServiceFromMap(serviceInfo map[string]interface{}) *Service

func FromObject

func FromObject(obj interface{}, bkr *nucleo.BrokerDelegates) (*Service, error)

FromObject creates a service based on an object.

func FromSchema

func FromSchema(schema nucleo.ServiceSchema, bkr *nucleo.BrokerDelegates) *Service

func (*Service) Actions

func (service *Service) Actions() []Action

func (*Service) AddActionMap

func (service *Service) AddActionMap(actionInfo map[string]interface{}) *Action

func (*Service) AddEventMap

func (service *Service) AddEventMap(eventInfo map[string]interface{}) *Event

func (*Service) AddMetadata

func (service *Service) AddMetadata(metadata map[string]interface{})

AddMetadata add metadata to the service. it will be merged with existing service metadata.

func (*Service) AddSettings

func (service *Service) AddSettings(settings map[string]interface{})

AddSettings add settings to the service. it will be merged with the existing service settings

func (*Service) AsMap

func (service *Service) AsMap() map[string]interface{}

AsMap export the service info in a map containing: name, version, settings, metadata, nodeID, actions and events. The events list does not contain internal events (events that starts with $) like $node.disconnected.

func (*Service) Dependencies

func (service *Service) Dependencies() []string

func (*Service) Events

func (service *Service) Events() []Event

func (*Service) FullName

func (service *Service) FullName() string

func (*Service) Name

func (service *Service) Name() string

func (*Service) NodeID

func (service *Service) NodeID() string

func (*Service) RemoveAction

func (service *Service) RemoveAction(fullname string)

func (*Service) RemoveEvent

func (service *Service) RemoveEvent(name string)

func (*Service) Schema

func (service *Service) Schema() *nucleo.ServiceSchema

func (*Service) SetNodeID

func (service *Service) SetNodeID(nodeID string)

func (*Service) Settings

func (service *Service) Settings() map[string]interface{}

func (*Service) Start

func (service *Service) Start(context nucleo.BrokerContext)

Start called by the broker when the service is starting.

func (*Service) Stop

func (service *Service) Stop(context nucleo.BrokerContext)

Stop called by the broker when the service is stopping.

func (*Service) Summary

func (service *Service) Summary() map[string]string

func (*Service) UpdateFromMap

func (service *Service) UpdateFromMap(serviceInfo map[string]interface{})

UpdateFromMap update the service metadata and settings from a serviceInfo map

func (*Service) Version

func (service *Service) Version() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL