Documentation ¶
Index ¶
- type Domain
- type DomainGuard
- type DomainMap
- func (m DomainMap) Delete(id uuid.UUID)
- func (m DomainMap) Load(id uuid.UUID) (*DomainGuard, bool)
- func (m DomainMap) LoadOrStore(id uuid.UUID, mem *DomainGuard) (*Domain, bool)
- func (m DomainMap) Range(f func(id uuid.UUID, mem *DomainGuard) bool)
- func (m *DomainMap) SizeEstimate() int
- func (m *DomainMap) Store(id uuid.UUID, mem *DomainGuard)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Domain ¶
type Domain struct { // Identity holds the identifying information of the domain ident.Identity // Services Services []ident.ServiceIdentity // conn is the protocol buffer connection to the member Conn *grpc.ClientConn // LastContact is the last time a domain replied to a rpc LastContact time.Time }
Domain is a representation of a domain service somewhere on the network Domain implements system.Connectable
func (Domain) AddService ¶
func (d Domain) AddService(serviceIdent ident.ServiceIdentity) error
AddService adds a serviceIdentity if that service doesn't share an ID with any other service controled by the domain
func (Domain) GetAddress ¶
GetAddress returns the target address for the connection
func (Domain) GetConnection ¶
func (d Domain) GetConnection() *grpc.ClientConn
GetConnection returns a current gRCP connection (for checking)
func (*Domain) SetConnection ¶
func (d *Domain) SetConnection(newConn *grpc.ClientConn)
SetConnection replaces the connection of the device (any existing connection will be closed prior to this)
type DomainGuard ¶
type DomainGuard struct {
// contains filtered or unexported fields
}
DomainGuard protects a domain for concurrent access
func NewDomainGuard ¶
func NewDomainGuard(identity ident.Identity) *DomainGuard
NewDomainGuard returns a new DomainGuard with the passed identity
func (*DomainGuard) LatchRead ¶
func (d *DomainGuard) LatchRead(operation func(Domain) error) error
LatchRead offers read access to the Domain
func (*DomainGuard) LatchWrite ¶
func (d *DomainGuard) LatchWrite(operation func(*Domain) error) error
LatchWrite offers write access to the Domain
type DomainMap ¶
type DomainMap struct {
// contains filtered or unexported fields
}
DomainMap is a wrapper for sync.map to ensure better type safety
func (DomainMap) Load ¶
func (m DomainMap) Load(id uuid.UUID) (*DomainGuard, bool)
Load offers access to a Domain
func (DomainMap) LoadOrStore ¶
LoadOrStore offers access to a Domain or stores a new one
func (DomainMap) Range ¶
func (m DomainMap) Range(f func(id uuid.UUID, mem *DomainGuard) bool)
Range iterates across all Domain in the DomainMap
func (*DomainMap) SizeEstimate ¶
SizeEstimate only garuntees that the number of all existing keys in some length of time is equal to the result