storj/satellite/console/usagerollups.go

86 lines
1.8 KiB
Go
Raw Normal View History

2019-04-04 15:56:20 +01:00
// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package console
import (
"context"
"time"
"github.com/skyrings/skyring-common/tools/uuid"
)
// UsageRollups defines how console works with usage rollups
type UsageRollups interface {
GetProjectTotal(ctx context.Context, projectID uuid.UUID, since, before time.Time) (*ProjectUsage, error)
GetBucketUsageRollups(ctx context.Context, projectID uuid.UUID, since, before time.Time) ([]BucketUsageRollup, error)
2019-05-16 11:43:46 +01:00
GetBucketTotals(ctx context.Context, projectID uuid.UUID, cursor BucketUsageCursor, since, before time.Time) (*BucketUsagePage, error)
2019-04-04 15:56:20 +01:00
}
// ProjectUsage consist of period total storage, egress
// and objects count per hour for certain Project
type ProjectUsage struct {
Storage float64
Egress float64
ObjectCount float64
Since time.Time
Before time.Time
}
2019-05-16 11:43:46 +01:00
// BucketUsage consist of total bucket usage for period
type BucketUsage struct {
ProjectID uuid.UUID
BucketName string
Storage float64
Egress float64
ObjectCount float64
Since time.Time
Before time.Time
}
// BucketUsageCursor holds info for bucket usage
// cursor pagination
type BucketUsageCursor struct {
Search string
Limit uint
Page uint
}
// BucketUsagePage represents bucket usage page result
type BucketUsagePage struct {
BucketUsages []BucketUsage
Search string
Limit uint
Offset uint64
PageCount uint
CurrentPage uint
TotalCount uint64
}
// BucketUsageRollup is total bucket usage info
// for certain period
type BucketUsageRollup struct {
ProjectID uuid.UUID
BucketName []byte
RemoteStoredData float64
InlineStoredData float64
RemoteSegments float64
InlineSegments float64
ObjectCount float64
MetadataSize float64
RepairEgress float64
GetEgress float64
AuditEgress float64
2019-04-04 15:56:20 +01:00
Since time.Time
Before time.Time
}