Documentation ¶
Index ¶
- Variables
- type Cache
- func (cache *Cache) Close() error
- func (cache *Cache) ConnFailure(ctx context.Context, node *pb.Node, failureError error)
- func (cache *Cache) ConnSuccess(ctx context.Context, node *pb.Node)
- func (cache *Cache) Create(ctx context.Context, nodeID storj.NodeID, initial *NodeStats) (stats *NodeStats, err error)
- func (cache *Cache) FindStorageNodes(ctx context.Context, req FindStorageNodesRequest) (_ []*pb.Node, err error)
- func (cache *Cache) FindStorageNodesWithPreferences(ctx context.Context, req FindStorageNodesRequest, ...) (nodes []*pb.Node, err error)
- func (cache *Cache) Get(ctx context.Context, nodeID storj.NodeID) (_ *NodeDossier, err error)
- func (cache *Cache) GetMissingPieces(ctx context.Context, pieces []*pb.RemotePiece) (missingPieces []int32, err error)
- func (cache *Cache) Inspect(ctx context.Context) (_ storage.Keys, err error)
- func (cache *Cache) IsOnline(node *NodeDossier) bool
- func (cache *Cache) IsVetted(ctx context.Context, nodeID storj.NodeID) (reputable bool, err error)
- func (cache *Cache) KnownUnreliableOrOffline(ctx context.Context, nodeIds storj.NodeIDList) (badNodes storj.NodeIDList, err error)
- func (cache *Cache) Paginate(ctx context.Context, offset int64, limit int) (_ []*NodeDossier, _ bool, err error)
- func (cache *Cache) Put(ctx context.Context, nodeID storj.NodeID, value pb.Node) (err error)
- func (cache *Cache) UpdateNodeInfo(ctx context.Context, node storj.NodeID, nodeInfo *pb.InfoResponse) (stats *NodeDossier, err error)
- func (cache *Cache) UpdateStats(ctx context.Context, request *UpdateRequest) (stats *NodeStats, err error)
- func (cache *Cache) UpdateUptime(ctx context.Context, nodeID storj.NodeID, isUp bool) (stats *NodeStats, err error)
- type Config
- type DB
- type FindStorageNodesRequest
- type Inspector
- func (srv *Inspector) CountNodes(ctx context.Context, req *pb.CountNodesRequest) (_ *pb.CountNodesResponse, err error)
- func (srv *Inspector) CreateStats(ctx context.Context, req *pb.CreateStatsRequest) (_ *pb.CreateStatsResponse, err error)
- func (srv *Inspector) DumpNodes(ctx context.Context, req *pb.DumpNodesRequest) (_ *pb.DumpNodesResponse, err error)
- func (srv *Inspector) GetStats(ctx context.Context, req *pb.GetStatsRequest) (_ *pb.GetStatsResponse, err error)
- type LookupConfig
- type NodeCriteria
- type NodeDossier
- type NodeSelectionConfig
- type NodeStats
- type UpdateRequest
Constants ¶
This section is empty.
Variables ¶
var ErrBucketNotFound = errs.New("bucket not found")
ErrBucketNotFound is returned if a bucket is unable to be found in the routing table
var ErrEmptyNode = errs.New("empty node ID")
ErrEmptyNode is returned when the nodeID is empty
var ErrNodeNotFound = errs.Class("node not found")
ErrNodeNotFound is returned if a node does not exist in database
var ErrNodeOffline = errs.Class("node is offline")
ErrNodeOffline is returned if a nodes is offline
var ErrNotEnoughNodes = errs.Class("not enough nodes")
ErrNotEnoughNodes is when selecting nodes failed with the given parameters
var ( // Error represents an overlay error Error = errs.Class("overlay error") )
var OverlayError = errs.Class("overlay error")
OverlayError creates class of errors for stack traces
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is used to store and handle node information
func NewCache ¶
func NewCache(log *zap.Logger, db DB, preferences NodeSelectionConfig) *Cache
NewCache returns a new Cache
func (*Cache) ConnFailure ¶
ConnFailure implements the Transport Observer `ConnFailure` function
func (*Cache) ConnSuccess ¶
ConnSuccess implements the Transport Observer `ConnSuccess` function
func (*Cache) Create ¶
func (cache *Cache) Create(ctx context.Context, nodeID storj.NodeID, initial *NodeStats) (stats *NodeStats, err error)
Create adds a new stats entry for node.
func (*Cache) FindStorageNodes ¶
func (cache *Cache) FindStorageNodes(ctx context.Context, req FindStorageNodesRequest) (_ []*pb.Node, err error)
FindStorageNodes searches the overlay network for nodes that meet the provided requirements
func (*Cache) FindStorageNodesWithPreferences ¶
func (cache *Cache) FindStorageNodesWithPreferences(ctx context.Context, req FindStorageNodesRequest, preferences *NodeSelectionConfig) (nodes []*pb.Node, err error)
FindStorageNodesWithPreferences searches the overlay network for nodes that meet the provided criteria
func (*Cache) GetMissingPieces ¶ added in v0.11.4
func (cache *Cache) GetMissingPieces(ctx context.Context, pieces []*pb.RemotePiece) (missingPieces []int32, err error)
GetMissingPieces returns the list of offline nodes
func (*Cache) IsOnline ¶ added in v0.10.0
func (cache *Cache) IsOnline(node *NodeDossier) bool
IsOnline checks if a node is 'online' based on the collected statistics.
func (*Cache) IsVetted ¶ added in v0.13.0
IsVetted returns whether or not the node reaches reputable thresholds
func (*Cache) KnownUnreliableOrOffline ¶ added in v0.11.0
func (cache *Cache) KnownUnreliableOrOffline(ctx context.Context, nodeIds storj.NodeIDList) (badNodes storj.NodeIDList, err error)
KnownUnreliableOrOffline filters a set of nodes to unhealth or offlines node, independent of new.
func (*Cache) Paginate ¶
func (cache *Cache) Paginate(ctx context.Context, offset int64, limit int) (_ []*NodeDossier, _ bool, err error)
Paginate returns a list of `limit` nodes starting from `start` offset.
func (*Cache) UpdateNodeInfo ¶ added in v0.9.0
func (cache *Cache) UpdateNodeInfo(ctx context.Context, node storj.NodeID, nodeInfo *pb.InfoResponse) (stats *NodeDossier, err error)
UpdateNodeInfo updates node dossier with info requested from the node itself like node type, email, wallet, capacity, and version.
func (*Cache) UpdateStats ¶
func (cache *Cache) UpdateStats(ctx context.Context, request *UpdateRequest) (stats *NodeStats, err error)
UpdateStats all parts of single storagenode's stats.
type Config ¶
type Config struct {
Node NodeSelectionConfig
}
Config is a configuration struct for everything you need to start the Overlay cache responsibility.
type DB ¶
type DB interface { // SelectStorageNodes looks up nodes based on criteria SelectStorageNodes(ctx context.Context, count int, criteria *NodeCriteria) ([]*pb.Node, error) // SelectNewStorageNodes looks up nodes based on new node criteria SelectNewStorageNodes(ctx context.Context, count int, criteria *NodeCriteria) ([]*pb.Node, error) // Get looks up the node by nodeID Get(ctx context.Context, nodeID storj.NodeID) (*NodeDossier, error) // KnownUnreliableOrOffline filters a set of nodes to unhealth or offlines node, independent of new KnownUnreliableOrOffline(context.Context, *NodeCriteria, storj.NodeIDList) (storj.NodeIDList, error) // Paginate will page through the database nodes Paginate(ctx context.Context, offset int64, limit int) ([]*NodeDossier, bool, error) // IsVetted returns whether or not the node reaches reputable thresholds IsVetted(ctx context.Context, id storj.NodeID, criteria *NodeCriteria) (bool, error) // CreateStats initializes the stats for node. CreateStats(ctx context.Context, nodeID storj.NodeID, initial *NodeStats) (stats *NodeStats, err error) // Update updates node address UpdateAddress(ctx context.Context, value *pb.Node) error // UpdateStats all parts of single storagenode's stats. UpdateStats(ctx context.Context, request *UpdateRequest) (stats *NodeStats, err error) // UpdateNodeInfo updates node dossier with info requested from the node itself like node type, email, wallet, capacity, and version. UpdateNodeInfo(ctx context.Context, node storj.NodeID, nodeInfo *pb.InfoResponse) (stats *NodeDossier, err error) // UpdateUptime updates a single storagenode's uptime stats. UpdateUptime(ctx context.Context, nodeID storj.NodeID, isUp bool) (stats *NodeStats, err error) }
DB implements the database for overlay.Cache
type FindStorageNodesRequest ¶
type FindStorageNodesRequest struct { MinimumRequiredNodes int RequestedCount int FreeBandwidth int64 FreeDisk int64 ExcludedNodes []storj.NodeID MinimumVersion string // semver or empty }
FindStorageNodesRequest defines easy request parameters.
type Inspector ¶
type Inspector struct {
// contains filtered or unexported fields
}
Inspector is a gRPC service for inspecting overlay cache internals
func (*Inspector) CountNodes ¶
func (srv *Inspector) CountNodes(ctx context.Context, req *pb.CountNodesRequest) (_ *pb.CountNodesResponse, err error)
CountNodes returns the number of nodes in the cache
func (*Inspector) CreateStats ¶
func (srv *Inspector) CreateStats(ctx context.Context, req *pb.CreateStatsRequest) (_ *pb.CreateStatsResponse, err error)
CreateStats creates a node with specified stats
func (*Inspector) DumpNodes ¶
func (srv *Inspector) DumpNodes(ctx context.Context, req *pb.DumpNodesRequest) (_ *pb.DumpNodesResponse, err error)
DumpNodes returns all of the nodes in the overlay cachea
func (*Inspector) GetStats ¶
func (srv *Inspector) GetStats(ctx context.Context, req *pb.GetStatsRequest) (_ *pb.GetStatsResponse, err error)
GetStats returns the stats for a particular node ID
type LookupConfig ¶
type LookupConfig struct { NodeIDsString string `help:"one or more string-encoded node IDs, delimited by Delimiter"` Delimiter string `help:"delimiter used for parsing node IDs" default:","` }
LookupConfig is a configuration struct for querying the overlay cache with one or more node IDs
func (LookupConfig) ParseIDs ¶
func (c LookupConfig) ParseIDs() (ids storj.NodeIDList, err error)
ParseIDs converts the base58check encoded node ID strings from the config into node IDs
type NodeCriteria ¶
type NodeCriteria struct { FreeBandwidth int64 FreeDisk int64 AuditCount int64 AuditSuccessRatio float64 UptimeCount int64 UptimeSuccessRatio float64 ExcludedNodes []storj.NodeID ExcludedIPs []string MinimumVersion string // semver or empty OnlineWindow time.Duration DistinctIP bool }
NodeCriteria are the requirements for selecting nodes
type NodeDossier ¶ added in v0.9.0
type NodeDossier struct { pb.Node Type pb.NodeType Operator pb.NodeOperator Capacity pb.NodeCapacity Reputation NodeStats Version pb.NodeVersion Contained bool Disqualified bool }
NodeDossier is the complete info that the satellite tracks for a storage node
type NodeSelectionConfig ¶
type NodeSelectionConfig struct { UptimeRatio float64 `help:"a node's ratio of being up/online vs. down/offline" releaseDefault:"0.9" devDefault:"0"` UptimeCount int64 `` /* 127-byte string literal not displayed */ AuditSuccessRatio float64 `help:"a node's ratio of successful audits" releaseDefault:"0.4" devDefault:"0"` // TODO: update after beta AuditCount int64 `help:"the number of times a node has been audited to not be considered a New Node" releaseDefault:"500" devDefault:"0"` NewNodePercentage float64 `help:"the percentage of new nodes allowed per request" default:"0.05"` // TODO: fix, this is not percentage, it's ratio MinimumVersion string `help:"the minimum node software version for node selection queries" default:""` OnlineWindow time.Duration `help:"the amount of time without seeing a node before its considered offline" default:"1h"` DistinctIP bool `help:"require distinct IPs when choosing nodes for upload" releaseDefault:"true" devDefault:"false"` }
NodeSelectionConfig is a configuration struct to determine the minimum values for nodes to select