connection

package module
v0.0.0-...-10c05c6 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2017 License: BSD-3-Clause Imports: 8 Imported by: 1

README

maturity build status GoDoc

connection

The connection package implements a service to manage neural connections.

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

func IsInvalidConfig(err error) bool

IsInvalidConfig asserts invalidConfigError.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound asserts notFoundError.

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 Connection interface {
	Created() time.Time
	ID() string
	json.Marshaler
	json.Unmarshaler
	PeerAID() string
	PeerBID() string
	Weight() float64
}

func New

func New(config Config) (Connection, error)

New creates a new configured 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.

Jump to

Keyboard shortcuts

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