monitor

package
v1.38.0-rc Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Error is the default error class for piecestore monitor errors.
	Error = errs.Class("piecestore monitor")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Interval                  time.Duration `help:"how frequently Kademlia bucket should be refreshed with node stats" default:"1h0m0s"`
	VerifyDirReadableInterval time.Duration `help:"how frequently to verify the location and readability of the storage directory" releaseDefault:"1m" devDefault:"30s"`
	VerifyDirWritableInterval time.Duration `help:"how frequently to verify writability of storage directory" releaseDefault:"5m" devDefault:"30s"`
	MinimumDiskSpace          memory.Size   `help:"how much disk space a node at minimum has to advertise" default:"500GB"`
	MinimumBandwidth          memory.Size   `help:"how much bandwidth a node at minimum has to advertise (deprecated)" default:"0TB"`
	NotifyLowDiskCooldown     time.Duration `help:"minimum length of time between capacity reports" default:"10m" hidden:"true"`
}

Config defines parameters for storage node disk and bandwidth usage monitoring.

type DiskSpace added in v1.20.1

type DiskSpace struct {
	Allocated     int64
	UsedForPieces int64
	UsedForTrash  int64
	Free          int64
	Available     int64
	Overused      int64
}

DiskSpace consolidates monitored disk space statistics.

type Service

type Service struct {
	Loop                  *sync2.Cycle
	VerifyDirReadableLoop *sync2.Cycle
	VerifyDirWritableLoop *sync2.Cycle
	Config                Config
	// contains filtered or unexported fields
}

Service which monitors disk usage.

architecture: Service

func NewService

func NewService(log *zap.Logger, store *pieces.Store, contact *contact.Service, usageDB bandwidth.DB, allocatedDiskSpace int64, interval time.Duration, reportCapacity func(context.Context), config Config) *Service

NewService creates a new storage node monitoring service.

func (*Service) AvailableSpace added in v0.10.0

func (service *Service) AvailableSpace(ctx context.Context) (_ int64, err error)

AvailableSpace returns available disk space for upload.

func (*Service) Close added in v0.11.0

func (service *Service) Close() (err error)

Close stops the monitor service.

func (*Service) DiskSpace added in v1.20.1

func (service *Service) DiskSpace(ctx context.Context) (_ DiskSpace, err error)

DiskSpace returns consolidated disk space state info.

func (*Service) NotifyLowDisk added in v0.34.6

func (service *Service) NotifyLowDisk()

NotifyLowDisk reports disk space to satellites if cooldown timer has expired.

func (*Service) Run

func (service *Service) Run(ctx context.Context) (err error)

Run runs monitor service.

Jump to

Keyboard shortcuts

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