Documentation ¶
Index ¶
- Variables
- type Cursor
- type DB
- type Node
- type NodeInfo
- type NodeInfoSatellite
- type Page
- type Service
- func (service *Service) Add(ctx context.Context, node Node) (err error)
- func (service *Service) FetchNodeMeta(ctx context.Context, node Node) (_ Status, _ *multinodepb.VersionResponse, _ *multinodepb.LastContactResponse)
- func (service *Service) Get(ctx context.Context, id storj.NodeID) (_ Node, err error)
- func (service *Service) List(ctx context.Context) (_ []Node, err error)
- func (service *Service) ListInfos(ctx context.Context) (_ []NodeInfo, err error)
- func (service *Service) ListInfosSatellite(ctx context.Context, satelliteID storj.NodeID) (_ []NodeInfoSatellite, err error)
- func (service *Service) Remove(ctx context.Context, id storj.NodeID) (err error)
- func (service *Service) TrustedSatellites(ctx context.Context) (_ storj.NodeURLs, err error)
- func (service *Service) UpdateName(ctx context.Context, id storj.NodeID, name string) (err error)
- type Status
Constants ¶
This section is empty.
Variables ¶
var ( // Error is an error class for nodes service error. Error = errs.Class("nodes") // ErrNodeNotReachable is an error class that indicates that we are not able to establish drpc connection with node. ErrNodeNotReachable = errs.Class("node is not reachable") // ErrNodeAPIKeyInvalid is an error class that indicates that we uses wrong api key. ErrNodeAPIKeyInvalid = errs.Class("node api key is invalid") )
var ( // ErrNoNode is a special error type that indicates about absence of node in NodesDB. ErrNoNode = errs.Class("no such node") )
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) // ListPaged returns paginated nodes list. // TODO: rename to ListPaginated, because pagination is to divide up copy into pages, // because paging doesn't necessarily mean pagination in computing. ListPaged(ctx context.Context, cursor Cursor) (page Page, err error) // Add creates new node in NodesDB. Add(ctx context.Context, node Node) 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 multinodeauth.Secret `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"` Status Status `json:"status"` }
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"` Status Status `json:"status"` }
NodeInfoSatellite contains satellite specific node internal state.
type Page ¶ added in v1.32.1
type Page struct { Nodes []Node Limit int64 Offset int64 PageCount int64 CurrentPage int64 TotalCount int64 }
Page holds nodes page entity which is used to show listed page of nodes.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service exposes all nodes related logic.
architecture: Service
func NewService ¶
NewService creates new instance of Service.
func (*Service) FetchNodeMeta ¶ added in v1.115.1
func (service *Service) FetchNodeMeta(ctx context.Context, node Node) (_ Status, _ *multinodepb.VersionResponse, _ *multinodepb.LastContactResponse)
FetchNodeMeta information about a node status, version, and last contact.
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) TrustedSatellites ¶ added in v1.21.1
TrustedSatellites returns list of unique trusted satellites node urls.
type Status ¶ added in v1.34.1
type Status string
Status represents node online status.
const ( // StatusOnline represents online status. StatusOnline Status = "online" // StatusOffline represents offline status. StatusOffline Status = "offline" // StatusNotReachable indicates that we could not reach storagenode via drpc request. StatusNotReachable Status = "not reachable" StatusUnauthorized Status = "unauthorized" // StatusStorageNodeInternalError indicates storagenode internal error. StatusStorageNodeInternalError Status = "storagenode internal error" )