nodestats

package
v1.17.5-rc Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2020 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// NodeStatsServiceErr defines node stats service error.
	NodeStatsServiceErr = errs.Class("node stats service error")
)

Functions

This section is empty.

Types

type Cache added in v0.18.0

type Cache struct {
	Reputation *sync2.Cycle
	Storage    *sync2.Cycle
	// contains filtered or unexported fields
}

Cache runs cache loop and stores reputation stats and storage usage into db

architecture: Chore

func NewCache added in v0.18.0

func NewCache(log *zap.Logger, config Config, db CacheStorage, service *Service, payoutEndpoint *payout.Endpoint, reputationService *reputation.Service, trust *trust.Pool) *Cache

NewCache creates new caching service instance.

func (*Cache) CacheHeldAmount added in v0.35.2

func (cache *Cache) CacheHeldAmount(ctx context.Context) (err error)

CacheHeldAmount queries held amount stats and payments from all the satellites known to the storagenode and stores info into db.

func (*Cache) CacheReputationStats added in v0.18.0

func (cache *Cache) CacheReputationStats(ctx context.Context) (err error)

CacheReputationStats queries node stats from all the satellites known to the storagenode and stores information into db.

func (*Cache) CacheSpaceUsage added in v0.18.0

func (cache *Cache) CacheSpaceUsage(ctx context.Context) (err error)

CacheSpaceUsage queries disk space usage from all the satellites known to the storagenode and stores information into db.

func (*Cache) Close added in v0.18.0

func (cache *Cache) Close() error

Close closes underlying cycles.

func (*Cache) Run added in v0.18.0

func (cache *Cache) Run(ctx context.Context) error

Run runs loop.

type CacheStorage added in v0.18.0

type CacheStorage struct {
	Reputation   reputation.DB
	StorageUsage storageusage.DB
	Payout       payout.DB
	Pricing      pricing.DB
	Satellites   satellites.DB
}

CacheStorage encapsulates cache DBs.

type Client

type Client struct {
	pb.DRPCNodeStatsClient
	// contains filtered or unexported fields
}

Client encapsulates NodeStatsClient with underlying connection

architecture: Client

func (*Client) Close

func (c *Client) Close() error

Close closes underlying client connection.

type Config added in v0.18.0

type Config struct {
	MaxSleep       time.Duration `help:"maximum duration to wait before requesting data" releaseDefault:"300s" devDefault:"1s"`
	ReputationSync time.Duration `help:"how often to sync reputation" releaseDefault:"4h" devDefault:"1m"`
	StorageSync    time.Duration `help:"how often to sync storage" releaseDefault:"12h" devDefault:"2m"`
}

Config defines nodestats cache configuration.

type Service

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

Service retrieves info from satellites using an rpc client

architecture: Service

func NewService

func NewService(log *zap.Logger, dialer rpc.Dialer, trust *trust.Pool) *Service

NewService creates new instance of service.

func (*Service) GetDailyStorageUsage added in v0.18.0

func (s *Service) GetDailyStorageUsage(ctx context.Context, satelliteID storj.NodeID, from, to time.Time) (_ []storageusage.Stamp, err error)

GetDailyStorageUsage returns daily storage usage over a period of time for a particular satellite.

func (*Service) GetPricingModel added in v1.3.2

func (s *Service) GetPricingModel(ctx context.Context, satelliteID storj.NodeID) (_ *pricing.Pricing, err error)

GetPricingModel returns pricing model of specific satellite.

func (*Service) GetReputationStats added in v0.18.0

func (s *Service) GetReputationStats(ctx context.Context, satelliteID storj.NodeID) (_ *reputation.Stats, err error)

GetReputationStats retrieves reputation stats from particular satellite.

Jump to

Keyboard shortcuts

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