service

package
v0.0.0-...-407825d Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(serviceIdent ident.ServiceIdentity, domainIdent ident.Identity, dominionIdent ident.Identity, dockerImage string) error

Start calls make from the services directory to start a new service

Types

type Service

type Service struct {
	//ServiceIdentity holds the identifying information of the service
	ident.ServiceIdentity

	// conn is the protocol buffer connection to the member
	Conn *grpc.ClientConn

	// LastContact is the last time a service replied to a rpc
	LastContact time.Time
}

Service is a representation of a service on the same machine Service implements system.Connectable

func (Service) GetAddress

func (s Service) GetAddress() ident.Address

GetAddress returns the target address for the connection

func (Service) GetConnection

func (s Service) GetConnection() *grpc.ClientConn

GetConnection returns a current gRCP connection (for checking)

func (*Service) SetConnection

func (s *Service) SetConnection(newConn *grpc.ClientConn)

SetConnection replaces the connection of the device (any existing connection will be closed prior to this)

type ServiceGuard

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

ServiceGuard protects a service for concurrent access

func NewServiceGuard

func NewServiceGuard(identity ident.ServiceIdentity) *ServiceGuard

NewServiceGuard returns a new ServiceGuard with the passed identity

func (*ServiceGuard) LatchRead

func (d *ServiceGuard) LatchRead(operation func(Service) error) error

LatchRead offers read access to the Service

func (*ServiceGuard) LatchWrite

func (d *ServiceGuard) LatchWrite(operation func(*Service) error) error

LatchWrite offers write access to the Service

type ServiceMap

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

ServiceMap is a wrapper for sync.map to ensure better type safety

func NewServiceMap

func NewServiceMap() ServiceMap

NewServiceMap returns a new ServiceMap

func (ServiceMap) Delete

func (m ServiceMap) Delete(uuid string)

Delete removes a Service from the ServiceMap

func (ServiceMap) Load

func (m ServiceMap) Load(uuid string) (*ServiceGuard, bool)

Load offers access to a Service

func (ServiceMap) LoadOrStore

func (m ServiceMap) LoadOrStore(uuid string, mem *ServiceGuard) (*Service, bool)

LoadOrStore offers access to a Service or stores a new one

func (ServiceMap) Range

func (m ServiceMap) Range(f func(uuid string, mem *ServiceGuard) bool)

Range iterates across all Services in the ServiceMap

func (*ServiceMap) SizeEstimate

func (m *ServiceMap) SizeEstimate() int

SizeEstimate only garuntees that the number of all existing keys in some length of time is equal to the result

func (*ServiceMap) Store

func (m *ServiceMap) Store(uuid string, mem *ServiceGuard)

Store stores a new Service in the ServiceMap

Jump to

Keyboard shortcuts

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