Documentation ¶
Index ¶
- func Start(serviceIdent ident.ServiceIdentity, domainIdent ident.Identity, ...) error
- type Service
- type ServiceGuard
- type ServiceMap
- func (m ServiceMap) Delete(uuid string)
- func (m ServiceMap) Load(uuid string) (*ServiceGuard, bool)
- func (m ServiceMap) LoadOrStore(uuid string, mem *ServiceGuard) (*Service, bool)
- func (m ServiceMap) Range(f func(uuid string, mem *ServiceGuard) bool)
- func (m *ServiceMap) SizeEstimate() int
- func (m *ServiceMap) Store(uuid string, mem *ServiceGuard)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
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 (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