registry

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package registry provides node information caching and retrieval

Index

Constants

View Source
const (
	// ErrInvalidNetwork is returned when an invalid node ID is provided
	ErrInvalidNetwork = "invalid node network"

	// ErrNetworkExists is returned when an network is provided that already exists
	ErrNetworkExists = "network already exists"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type NodeRegistry

type NodeRegistry struct {
	// contains filtered or unexported fields
}

NodeRegistry manages data on active nodes

func New

func New(logger *zap.SugaredLogger, ports config.Ports, nodes ...*ipfs.NodeInfo) *NodeRegistry

New sets up a new registry with provided nodes

func (*NodeRegistry) Close

func (r *NodeRegistry) Close()

Close stops registry background jobs

func (*NodeRegistry) Deregister

func (r *NodeRegistry) Deregister(network string) error

Deregister removes node with given network

func (*NodeRegistry) Get

func (r *NodeRegistry) Get(network string) (ipfs.NodeInfo, error)

Get retrieves details about node with given network

func (*NodeRegistry) List

func (r *NodeRegistry) List() []ipfs.NodeInfo

List retrieves a list of all known nodes

func (*NodeRegistry) Register

func (r *NodeRegistry) Register(node *ipfs.NodeInfo) error

Register registers a node and allocates appropriate ports

Jump to

Keyboard shortcuts

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