storage

package
v1.111.0-rc Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Error is an error class for storage service error.
	Error = errs.Class("storage")
)

Functions

This section is empty.

Types

type DiskSpace

type DiskSpace struct {
	Allocated int64 `json:"allocated"`
	Used      int64 `json:"usedPieces"`
	Trash     int64 `json:"usedTrash"`
	// Free is the actual amount of free space on the whole disk, not just allocated disk space, in bytes.
	Free int64 `json:"free"`
	// Available is the amount of free space on the allocated disk space, in bytes.
	Available int64 `json:"available"`
	Overused  int64 `json:"overused"`
}

DiskSpace stores all info about storagenode disk space usage.

func (*DiskSpace) Add

func (diskSpace *DiskSpace) Add(space DiskSpace)

Add combines disk space with another one.

type Service

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

Service exposes all storage related logic.

architecture: Service

func NewService

func NewService(log *zap.Logger, dialer rpc.Dialer, nodes nodes.DB) *Service

NewService creates new instance of Service.

func (*Service) DiskSpace

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

DiskSpace returns all info about concrete storagenode disk space usage.

func (*Service) TotalDiskSpace

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

TotalDiskSpace returns all info about all storagenodes disk space usage.

func (*Service) TotalUsage

func (service *Service) TotalUsage(ctx context.Context, from, to time.Time) (_ Usage, err error)

TotalUsage retrieves aggregated daily storage usage for provided interval.

func (*Service) TotalUsageSatellite

func (service *Service) TotalUsageSatellite(ctx context.Context, satelliteID storj.NodeID, from, to time.Time) (_ Usage, err error)

TotalUsageSatellite retrieves aggregated daily storage usage for provided interval and satellite.

func (*Service) Usage

func (service *Service) Usage(ctx context.Context, nodeID storj.NodeID, from, to time.Time) (_ Usage, err error)

Usage retrieves node's daily storage usage for provided interval.

func (*Service) UsageSatellite

func (service *Service) UsageSatellite(ctx context.Context, nodeID, satelliteID storj.NodeID, from, to time.Time) (_ Usage, err error)

UsageSatellite retrieves node's daily storage usage for provided interval and satellite.

type Usage added in v1.34.1

type Usage struct {
	Stamps       []UsageStamp `json:"stamps"`
	Summary      float64      `json:"summary"`
	SummaryBytes float64      `json:"summaryBytes"`
}

Usage holds storage usage stamps and summary for a particular period.

type UsageStamp

type UsageStamp struct {
	AtRestTotal      float64   `json:"atRestTotal"`
	AtRestTotalBytes float64   `json:"atRestTotalBytes"`
	IntervalStart    time.Time `json:"intervalStart"`
}

UsageStamp holds data at rest total for an interval beginning at interval start.

type UsageStampDailyCache

type UsageStampDailyCache map[time.Time]UsageStamp

UsageStampDailyCache caches storage usage stamps by interval date.

func (*UsageStampDailyCache) Add

func (cache *UsageStampDailyCache) Add(stamp UsageStamp)

Add adds usage stamp to cache aggregating at rest data by date.

func (*UsageStampDailyCache) Sorted

func (cache *UsageStampDailyCache) Sorted() []UsageStamp

Sorted returns usage stamp slice sorted by interval start.

Jump to

Keyboard shortcuts

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