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)
|
2019-04-10 00:14:19 +01:00
|
|
|
GetBucketUsageRollups(ctx context.Context, projectID uuid.UUID, since, before time.Time) ([]BucketUsageRollup, 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 {
|
2019-04-10 00:14:19 +01:00
|
|
|
Storage float64
|
|
|
|
Egress float64
|
|
|
|
ObjectCount float64
|
|
|
|
|
|
|
|
Since time.Time
|
|
|
|
Before time.Time
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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
|
|
|
|
}
|