service

package
v0.0.0-...-51fd5d7 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultServiceNumber = NumberHandler{
	// contains filtered or unexported fields
}

Functions

func CalcListLimit

func CalcListLimit(size, services, serviceNumber int) int

CalcListLimit calculates the number of elements that a service may handle without entering in conflict with anothers services.

func CalcListOffset

func CalcListOffset(size, services, serviceNumber int) int

CalcListOffset calculates the offset of the elements that the service may start handling without entering in conflict with anothers services.

func GetServiceIdent

func GetServiceIdent(t Type, n int) (ident string)

GetServiceIdent returns the service string identification according to the service type and number.

func GetServiceName

func GetServiceName(t Type) string

func Start

func Start(t Type, instantiator func(serviceNumber int) Service, setups ...func(Service))

Types

type NumberHandler

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

func (*NumberHandler) Get

func (s *NumberHandler) Get() (n int)

func (*NumberHandler) Release

func (s *NumberHandler) Release(n int)

type Service

type Service interface {
	Run()
	Done() <-chan error
	DispatchDone(error)
	GetServiceType() Type
	GetServiceNumber() int
	GetServiceIdent() string
	Close() error
}

Service is the interface that represent a Nemesys service.

type ServiceStatus

type ServiceStatus struct {
	// Name is the service name.
	Name string `json:"name"`
	// Ident is the service ident.
	Ident string `json:"-"`
	// Number is the service number.
	Number int `json:"number"`
	// Online is the online status;
	Online bool `json:"online"`
	// LastPing is the time of the last ping
	LastPing time.Time `json:"last-ping"`
	// LostConnectionTime is the time of the connection lost.
	LostConnectionTime time.Time `json:"lost-connection-time"`
	// Type is the service type.
	Type Type `json:"-"`
}

type Tools

type Tools struct {
	ServiceNumber int
	ServiceIdent  string
	ServiceType   Type
	// contains filtered or unexported fields
}

func NewTools

func NewTools(t Type, n int) Tools

func (*Tools) DispatchDone

func (st *Tools) DispatchDone(err error)

func (*Tools) Done

func (st *Tools) Done() <-chan error

func (*Tools) GetServiceIdent

func (t *Tools) GetServiceIdent() string

func (*Tools) GetServiceNumber

func (t *Tools) GetServiceNumber() int

func (*Tools) GetServiceType

func (t *Tools) GetServiceType() Type

type Type

type Type uint8
const (
	Unknown Type = iota
	ServiceManager
	APIManager
	RTS
	DHS
	Alarm
	SNMP
	WS
)

Jump to

Keyboard shortcuts

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