nodestats

package
v1.113.4 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 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("nodestats")
)

Functions

This section is empty.

Types

type Cache added in v0.18.0

type Cache struct {
	Reputation *sync2.Cycle
	Storage    *sync2.Cycle

	UsageStat *UsageStat
	// 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 *payouts.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       payouts.DB
	Pricing      pricing.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.

type UsageStat added in v1.98.1

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

UsageStat caches last space usage value for each satellite, to make it available for monkit.

func NewUsageStat added in v1.98.1

func NewUsageStat() *UsageStat

NewUsageStat initializes a UsageState.

func (*UsageStat) Stats added in v1.98.1

func (u *UsageStat) Stats(cb func(key monkit.SeriesKey, field string, val float64))

Stats implements monkit.StatSource.

func (*UsageStat) Update added in v1.98.1

func (u *UsageStat) Update(satellite storj.NodeID, usedSpace float64)

Update updates the cached value.

Jump to

Keyboard shortcuts

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