Documentation ¶
Index ¶
- Variables
- type DiskSpace
- type Service
- func (service *Service) DiskSpace(ctx context.Context, nodeID storj.NodeID) (_ DiskSpace, err error)
- func (service *Service) TotalDiskSpace(ctx context.Context) (totalDiskSpace DiskSpace, err error)
- func (service *Service) TotalUsage(ctx context.Context, from, to time.Time) (_ Usage, err error)
- func (service *Service) TotalUsageSatellite(ctx context.Context, satelliteID storj.NodeID, from, to time.Time) (_ Usage, err error)
- func (service *Service) Usage(ctx context.Context, nodeID storj.NodeID, from, to time.Time) (_ Usage, err error)
- func (service *Service) UsageSatellite(ctx context.Context, nodeID, satelliteID storj.NodeID, from, to time.Time) (_ Usage, err error)
- type Usage
- type UsageStamp
- type UsageStampDailyCache
Constants ¶
This section is empty.
Variables ¶
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 int64 `json:"free"` Available int64 `json:"available"` Overused int64 `json:"overused"` }
DiskSpace stores all info about storagenode disk space usage.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service exposes all storage related logic.
architecture: Service
func NewService ¶
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 ¶
TotalDiskSpace returns all info about all storagenodes disk space usage.
func (*Service) TotalUsage ¶
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.
type Usage ¶ added in v1.34.1
type Usage struct { Stamps []UsageStamp `json:"stamps"` Summary float64 `json:"summary"` }
Usage holds storage usage stamps and summary for a particular period.
type UsageStamp ¶
type UsageStamp struct { AtRestTotal float64 `json:"atRestTotal"` 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.