Documentation
¶
Overview ¶
Package connection provides a service able to manage connections of the connection space.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsInvalidConfig ¶
IsInvalidConfig asserts invalidConfigError.
Types ¶
type Config ¶
type Config struct {
// Settings.
Created time.Time
ID string
PeerAID string
PeerBID string
Weight float64
}
Config represents the configuration used to create a new connection.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig provides a default configuration to create a new connection by best effort.
type Connection ¶
type Service ¶
type Service interface {
Boot()
Create(namespaceA, namespaceB, peerAID, peerBID string) (Connection, error)
Delete(namespaceA, namespaceB, peerAID, peerBID string) error
Exists(namespaceA, namespaceB, peerAID, peerBID string) (bool, error)
Search(namespaceA, namespaceB, peerAID, peerBID string) (Connection, error)
SearchPeers(namespaceA, namespaceB, peerAID string) ([]string, error)
Shutdown()
Weight() float64
}
Service represents a service being able to manage connections within the connection space.
func NewService ¶
func NewService(config ServiceConfig) (Service, error)
NewService creates a new connection service.
type ServiceConfig ¶
type ServiceConfig struct {
// Dependencies.
StorageCollection *storage.Collection
WorkerService worker.Service
// Settings.
Weight float64
}
ServiceConfig represents the configuration used to create a new connection service.
func DefaultServiceConfig ¶
func DefaultServiceConfig() ServiceConfig
DefaultServiceConfig provides a default configuration to create a new connection service by best effort.
Click to show internal directories.
Click to hide internal directories.