Documentation ¶
Overview ¶
Package monitor is responsible for monitoring the disk is well-behaved. It checks whether there's sufficient space and whether directories are writable.
Index ¶
- Variables
- type Config
- type DedicatedDisk
- type DiskSpace
- type DiskVerification
- type Service
- func (service *Service) AvailableSpace(ctx context.Context) (_ int64, err error)
- func (service *Service) Close() (err error)
- func (service *Service) DiskSpace(ctx context.Context) (_ DiskSpace, err error)
- func (service *Service) NotifyLowDisk()
- func (service *Service) Run(ctx context.Context) (err error)
- type SharedDisk
- type SpaceReport
Constants ¶
This section is empty.
Variables ¶
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"` VerifyDirReadableTimeout time.Duration `help:"how long to wait for a storage directory readability verification to complete" releaseDefault:"1m" devDefault:"10s"` VerifyDirWritableTimeout time.Duration `help:"how long to wait for a storage directory writability verification to complete" releaseDefault:"1m" devDefault:"10s"` VerifyDirWarnOnly bool `help:"if the storage directory verification check fails, log a warning instead of killing the node" default:"false"` 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"` DedicatedDisk bool `` /* 193-byte string literal not displayed */ ReservedBytes memory.Size `` /* 150-byte string literal not displayed */ }
Config defines parameters for storage node disk and bandwidth usage monitoring.
type DedicatedDisk ¶ added in v1.114.2
type DedicatedDisk struct {
// contains filtered or unexported fields
}
DedicatedDisk is a simplified disk checker for the case when disk is dedicated to the storagenode.
func NewDedicatedDisk ¶ added in v1.114.2
func NewDedicatedDisk(log *zap.Logger, dir string, minimumDiskSpace, reservedBytes int64) *DedicatedDisk
NewDedicatedDisk creates a new DedicatedDisk.
func (*DedicatedDisk) AvailableSpace ¶ added in v1.114.2
func (d *DedicatedDisk) AvailableSpace(ctx context.Context) (_ int64, err error)
AvailableSpace implements SpaceReport interface.
func (*DedicatedDisk) DiskSpace ¶ added in v1.114.2
func (d *DedicatedDisk) DiskSpace(ctx context.Context) (_ DiskSpace, err error)
DiskSpace implements SpaceReport interface.
func (*DedicatedDisk) PreFlightCheck ¶ added in v1.114.2
func (d *DedicatedDisk) PreFlightCheck(ctx context.Context) error
PreFlightCheck implements SpaceReport interface.
type DiskSpace ¶ added in v1.20.1
type DiskSpace struct { // Allocated is the amount of disk space allocated to the storage node, in bytes. Allocated int64 // Total is the total amount of disk space on the whole disk, not just allocated disk space, in bytes. Total int64 // UsedForPieces is the amount of disk space used for pieces, in bytes. UsedForPieces int64 // UsedForTrash is the amount of disk space used for trash, in bytes. UsedForTrash int64 // Free is the actual amount of free space on the whole disk, not just allocated disk space, in bytes. Free int64 // Available is the amount of free space on the allocated disk space, in bytes. Available int64 // Overused is the amount of disk space overused by the storage node, in bytes. Overused int64 }
DiskSpace consolidates monitored disk space statistics.
type DiskVerification ¶ added in v1.114.2
type DiskVerification interface { VerifyStorageDirWithTimeout(ctx context.Context, id storj.NodeID, timeout time.Duration) error CheckWritabilityWithTimeout(ctx context.Context, timeout time.Duration) error }
DiskVerification is an interface for verifying disk storage healthiness during startup.
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, verifier DiskVerification, contact *contact.Service, interval time.Duration, spaceReport SpaceReport, config Config) *Service
NewService creates a new storage node monitoring service.
func (*Service) AvailableSpace ¶ added in v0.10.0
AvailableSpace returns available disk space for upload.
func (*Service) NotifyLowDisk ¶ added in v0.34.6
func (service *Service) NotifyLowDisk()
NotifyLowDisk reports disk space to satellites if cooldown timer has expired.
type SharedDisk ¶ added in v1.114.2
type SharedDisk struct {
// contains filtered or unexported fields
}
SharedDisk is the default way to check disk space (using usage-space walker).
func NewSharedDisk ¶ added in v1.114.2
func NewSharedDisk(log *zap.Logger, store *pieces.Store, minimumDiskSpace, allocatedDiskSpace int64) *SharedDisk
NewSharedDisk creates a new SharedDisk.
func (*SharedDisk) AvailableSpace ¶ added in v1.114.2
func (s *SharedDisk) AvailableSpace(ctx context.Context) (_ int64, err error)
AvailableSpace returns available disk space for upload.
func (*SharedDisk) DiskSpace ¶ added in v1.114.2
func (s *SharedDisk) DiskSpace(ctx context.Context) (_ DiskSpace, err error)
DiskSpace returns consolidated disk space state info.
func (*SharedDisk) PreFlightCheck ¶ added in v1.114.2
func (s *SharedDisk) PreFlightCheck(ctx context.Context) error
PreFlightCheck checks if the disk is ready to use.
type SpaceReport ¶ added in v1.114.2
type SpaceReport interface { // PreFlightCheck checks if the disk is ready to use. PreFlightCheck(ctx context.Context) error // AvailableSpace returns available disk space. // Used for reporting it to satellite + checking it before upload. AvailableSpace(ctx context.Context) (_ int64, err error) // DiskSpace returns consolidated disk space state info. // Used by reporting only. DiskSpace(ctx context.Context) (_ DiskSpace, err error) }
SpaceReport is an interface for reporting disk usage.