nodes

package
v1.29.1 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoNode = errs.Class("no such node")

ErrNoNode is a special error type that indicates about absence of node in NodesDB.

View Source
var (

	// Error is an error class for nodes service error.
	Error = errs.Class("nodes service error")
)

Functions

This section is empty.

Types

type DB

type DB interface {
	// Get return node from NodesDB by its id.
	Get(ctx context.Context, id storj.NodeID) (Node, error)
	// List returns all connected nodes.
	List(ctx context.Context) ([]Node, error)
	// Add creates new node in NodesDB.
	Add(ctx context.Context, id storj.NodeID, apiSecret []byte, publicAddress string) error
	// Remove removed node from NodesDB.
	Remove(ctx context.Context, id storj.NodeID) error
	// UpdateName will update name of the specified node in database.
	UpdateName(ctx context.Context, id storj.NodeID, name string) error
}

DB exposes needed by MND NodesDB functionality.

architecture: Database

type Node

type Node struct {
	ID storj.NodeID `json:"id"`
	// APISecret is a secret issued by storagenode, that will be main auth mechanism in MND <-> SNO api.
	APISecret     []byte `json:"apiSecret"`
	PublicAddress string `json:"publicAddress"`
	Name          string `json:"name"`
}

Node is a representation of storagenode, that SNO could add to the Multinode Dashboard.

type NodeInfo

type NodeInfo struct {
	ID            storj.NodeID `json:"id"`
	Name          string       `json:"name"`
	Version       string       `json:"version"`
	LastContact   time.Time    `json:"lastContact"`
	DiskSpaceUsed int64        `json:"diskSpaceUsed"`
	DiskSpaceLeft int64        `json:"diskSpaceLeft"`
	BandwidthUsed int64        `json:"bandwidthUsed"`
	TotalEarned   int64        `json:"totalEarned"`
}

NodeInfo contains basic node internal state.

type NodeInfoSatellite

type NodeInfoSatellite struct {
	ID              storj.NodeID `json:"id"`
	Name            string       `json:"name"`
	Version         string       `json:"version"`
	LastContact     time.Time    `json:"lastContact"`
	OnlineScore     float64      `json:"onlineScore"`
	AuditScore      float64      `json:"auditScore"`
	SuspensionScore float64      `json:"suspensionScore"`
	TotalEarned     int64        `json:"totalEarned"`
}

NodeInfoSatellite contains satellite specific node internal state.

type Service

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

Service exposes all nodes related logic.

architecture: Service

func NewService

func NewService(log *zap.Logger, dialer rpc.Dialer, nodes DB) *Service

NewService creates new instance of Service.

func (*Service) Add

func (service *Service) Add(ctx context.Context, id storj.NodeID, apiSecret []byte, publicAddress string) (err error)

Add adds new node to the system.

func (*Service) Get

func (service *Service) Get(ctx context.Context, id storj.NodeID) (_ Node, err error)

Get retrieves node by id.

func (*Service) ListInfos

func (service *Service) ListInfos(ctx context.Context) (_ []NodeInfo, err error)

ListInfos queries node basic info from all nodes via rpc.

func (*Service) ListInfosSatellite

func (service *Service) ListInfosSatellite(ctx context.Context, satelliteID storj.NodeID) (_ []NodeInfoSatellite, err error)

ListInfosSatellite queries node satellite specific info from all nodes via rpc.

func (*Service) Remove

func (service *Service) Remove(ctx context.Context, id storj.NodeID) (err error)

Remove removes node from the system.

func (*Service) TrustedSatellites added in v1.21.1

func (service *Service) TrustedSatellites(ctx context.Context) (_ storj.NodeURLs, err error)

TrustedSatellites returns list of unique trusted satellites node urls.

func (*Service) UpdateName

func (service *Service) UpdateName(ctx context.Context, id storj.NodeID, name string) (err error)

UpdateName will update name of the specified node.

Jump to

Keyboard shortcuts

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