storagenode

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2019 License: AGPL-3.0 Imports: 35 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Identity identity.Config

	Server   server.Config
	Kademlia kademlia.Config

	// TODO: flatten storage config and only keep the new one
	Storage   piecestore.OldConfig
	Storage2  piecestore.Config
	Collector collector.Config

	Retain retain.Config

	Vouchers vouchers.Config

	Nodestats nodestats.Config

	Console consoleserver.Config

	Version version.Config

	Bandwidth bandwidth.Config
}

Config is all the configuration parameters for a Storage Node

func (*Config) Verify

func (config *Config) Verify(log *zap.Logger) error

Verify verifies whether configuration is consistent and acceptable.

type DB

type DB interface {
	// CreateTables initializes the database
	CreateTables() error
	// Close closes the database
	Close() error

	Pieces() storage.Blobs

	Orders() orders.DB
	V0PieceInfo() pieces.V0PieceInfoDB
	PieceExpirationDB() pieces.PieceExpirationDB
	PieceSpaceUsedDB() pieces.PieceSpaceUsedDB
	Bandwidth() bandwidth.DB
	UsedSerials() piecestore.UsedSerials
	Vouchers() vouchers.DB
	Console() console.DB
	Reputation() reputation.DB
	StorageUsage() storageusage.DB

	// TODO: use better interfaces
	RoutingTable() (kdb, ndb, adb storage.KeyValueStore)
}

DB is the master database for Storage Node

type Peer

type Peer struct {
	// core dependencies
	Log      *zap.Logger
	Identity *identity.FullIdentity
	DB       DB

	Transport transport.Client

	Server *server.Server

	Version *version.Service

	// services and endpoints
	// TODO: similar grouping to satellite.Peer
	Kademlia struct {
		RoutingTable *kademlia.RoutingTable
		Service      *kademlia.Kademlia
		Endpoint     *kademlia.Endpoint
		Inspector    *kademlia.Inspector
	}

	Storage2 struct {
		// TODO: lift things outside of it to organize better
		Trust         *trust.Pool
		Store         *pieces.Store
		BlobsCache    *pieces.BlobsUsageCache
		CacheService  *pieces.CacheService
		RetainService *retain.Service
		Endpoint      *piecestore.Endpoint
		Inspector     *inspector.Endpoint
		Monitor       *monitor.Service
		Sender        *orders.Sender
	}

	Vouchers *vouchers.Service

	Collector *collector.Service

	NodeStats struct {
		Service *nodestats.Service
		Cache   *nodestats.Cache
	}

	// Web server with web UI
	Console struct {
		Listener net.Listener
		Service  *console.Service
		Endpoint *consoleserver.Server
	}

	Bandwidth *bandwidth.Service
}

Peer is the representation of a Storage Node.

func New

func New(log *zap.Logger, full *identity.FullIdentity, db DB, revDB extensions.RevocationDB, config Config, versionInfo version.Info) (*Peer, error)

New creates a new Storage Node.

func (*Peer) Addr

func (peer *Peer) Addr() string

Addr returns the public address.

func (*Peer) Close

func (peer *Peer) Close() error

Close closes all the resources.

func (*Peer) ID

func (peer *Peer) ID() storj.NodeID

ID returns the peer ID.

func (*Peer) Local

func (peer *Peer) Local() overlay.NodeDossier

Local returns the peer local node info.

func (*Peer) PrivateAddr

func (peer *Peer) PrivateAddr() string

PrivateAddr returns the private address.

func (*Peer) Run

func (peer *Peer) Run(ctx context.Context) (err error)

Run runs storage node until it's either closed or it errors.

func (*Peer) URL added in v0.15.0

func (peer *Peer) URL() storj.NodeURL

URL returns the storj.NodeURL.

Directories

Path Synopsis
Package bandwidth implements bandwidth usage rollup loop.
Package bandwidth implements bandwidth usage rollup loop.
Package collector implements expired piece deletion from storage node.
Package collector implements expired piece deletion from storage node.

Jump to

Keyboard shortcuts

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