domain

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: 8 Imported by: 0

Documentation

Index

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

func (d Domain) GetAddress() ident.Address

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 NewDomainMap

func NewDomainMap() DomainMap

NewDomainMap returns a new DomainMap

func (DomainMap) Delete

func (m DomainMap) Delete(id uuid.UUID)

Delete removes a Domain from the DomainMap

func (DomainMap) Load

func (m DomainMap) Load(id uuid.UUID) (*DomainGuard, bool)

Load offers access to a Domain

func (DomainMap) LoadOrStore

func (m DomainMap) LoadOrStore(id uuid.UUID, mem *DomainGuard) (*Domain, bool)

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

func (m *DomainMap) SizeEstimate() int

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

func (*DomainMap) Store

func (m *DomainMap) Store(id uuid.UUID, mem *DomainGuard)

Store stores a new Domain in the DomainMap

Jump to

Keyboard shortcuts

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