2023-02-23 12:39:43 +00:00
|
|
|
// bucket_bandwidth_roolup contains per bucket infromation about bandwidth used.
|
2023-02-23 12:35:32 +00:00
|
|
|
model bucket_bandwidth_rollup (
|
2023-03-02 10:06:15 +00:00
|
|
|
key project_id bucket_name interval_start action
|
2023-02-23 12:35:32 +00:00
|
|
|
index (
|
|
|
|
name bucket_bandwidth_rollups_project_id_action_interval_index
|
|
|
|
fields project_id action interval_start
|
|
|
|
)
|
|
|
|
index (
|
|
|
|
name bucket_bandwidth_rollups_action_interval_project_id_index
|
|
|
|
fields action interval_start project_id
|
|
|
|
)
|
|
|
|
|
2023-02-23 12:39:43 +00:00
|
|
|
|
2023-02-23 12:35:32 +00:00
|
|
|
field bucket_name blob
|
2023-02-23 12:39:43 +00:00
|
|
|
// project_id is an UUID that refers to project.id.
|
2023-02-23 12:35:32 +00:00
|
|
|
field project_id blob
|
|
|
|
|
2023-02-23 12:39:43 +00:00
|
|
|
// interval_start is when the measurement interval started.
|
2023-02-23 12:35:32 +00:00
|
|
|
field interval_start timestamp
|
2023-02-23 12:39:43 +00:00
|
|
|
// interval_seconds is the duration of the measurement interval in seconds.
|
2023-02-23 12:35:32 +00:00
|
|
|
field interval_seconds uint
|
2023-02-23 12:39:43 +00:00
|
|
|
// action is the bandwidth operation, which refers to storj.io/common/pb.PieceAction.
|
|
|
|
// It is one of put = 1, get = 2, get audit = 3, get repair = 4, put repair = 5, delete = 6 or put graceful exit = 7.
|
2023-02-23 12:35:32 +00:00
|
|
|
field action uint
|
|
|
|
|
2023-02-23 12:39:43 +00:00
|
|
|
// inline is the number of bytes of inline traffic.
|
2023-02-23 12:35:32 +00:00
|
|
|
field inline uint64 ( updatable )
|
2023-02-23 12:39:43 +00:00
|
|
|
// allocated is the number of bytes that the satellite has budgeted for.
|
|
|
|
// It's unlikely that the uplink will use all the bandwidth that they requested.
|
2023-02-23 12:35:32 +00:00
|
|
|
field allocated uint64 ( updatable )
|
2023-02-23 12:39:43 +00:00
|
|
|
// settled is the number of bytes of traffic that the storagenodes have reported back to the satellite.
|
2023-02-23 12:35:32 +00:00
|
|
|
field settled uint64 ( updatable )
|
|
|
|
)
|
|
|
|
|
|
|
|
read paged (
|
|
|
|
select bucket_bandwidth_rollup
|
|
|
|
where bucket_bandwidth_rollup.interval_start >= ?
|
|
|
|
)
|
|
|
|
|
2023-02-23 12:39:43 +00:00
|
|
|
// bucket_bandwidth_rollup_archive contains historical condensed data from bucket_bandwidth_rollup table.
|
2023-02-23 12:35:32 +00:00
|
|
|
model bucket_bandwidth_rollup_archive (
|
|
|
|
key bucket_name project_id interval_start action
|
|
|
|
index (
|
|
|
|
name bucket_bandwidth_rollups_archive_project_id_action_interval_index
|
|
|
|
fields project_id action interval_start
|
|
|
|
)
|
|
|
|
index (
|
|
|
|
name bucket_bandwidth_rollups_archive_action_interval_project_id_index
|
|
|
|
fields action interval_start project_id
|
|
|
|
)
|
|
|
|
|
2023-02-23 12:39:43 +00:00
|
|
|
// bucket_name refers to buckets.name table.
|
2023-02-23 12:35:32 +00:00
|
|
|
field bucket_name blob
|
2023-02-23 12:39:43 +00:00
|
|
|
// project_id is an UUID that refers to project.id.
|
2023-02-23 12:35:32 +00:00
|
|
|
field project_id blob
|
|
|
|
|
2023-02-23 12:39:43 +00:00
|
|
|
// interval_start is when the measurement interval started.
|
2023-02-23 12:35:32 +00:00
|
|
|
field interval_start timestamp
|
2023-02-23 12:39:43 +00:00
|
|
|
// interval_seconds is the duration of the measurement interval in seconds.
|
2023-02-23 12:35:32 +00:00
|
|
|
field interval_seconds uint
|
2023-02-23 12:39:43 +00:00
|
|
|
// action is the bandwidth operation, which refers to storj.io/common/pb.PieceAction.
|
|
|
|
// It is one of put = 1, get = 2, get audit = 3, get repair = 4, put repair = 5, delete = 6 or put graceful exit = 7.
|
2023-02-23 12:35:32 +00:00
|
|
|
field action uint
|
|
|
|
|
2023-02-23 12:39:43 +00:00
|
|
|
// inline is the number of bytes of inline traffic.
|
2023-02-23 12:35:32 +00:00
|
|
|
field inline uint64 ( updatable )
|
2023-02-23 12:39:43 +00:00
|
|
|
// allocated is the number of bytes that the satellite has budgeted for.
|
|
|
|
// It's unlikely that the uplink will use all the bandwidth that they requested.
|
2023-02-23 12:35:32 +00:00
|
|
|
field allocated uint64 ( updatable )
|
2023-02-23 12:39:43 +00:00
|
|
|
// settled is the number of bytes of traffic that the storagenodes have reported back to the satellite.
|
2023-02-23 12:35:32 +00:00
|
|
|
field settled uint64 ( updatable )
|
|
|
|
)
|
|
|
|
|
|
|
|
read paged (
|
|
|
|
select bucket_bandwidth_rollup_archive
|
|
|
|
where bucket_bandwidth_rollup_archive.interval_start >= ?
|
|
|
|
)
|
|
|
|
|
2023-02-23 12:39:43 +00:00
|
|
|
// project_bandwidth_daily_rollup contains the total traffic for a given project.
|
2023-02-23 12:35:32 +00:00
|
|
|
model project_bandwidth_daily_rollup (
|
|
|
|
key project_id interval_day
|
|
|
|
index (
|
|
|
|
name project_bandwidth_daily_rollup_interval_day_index
|
|
|
|
fields interval_day
|
|
|
|
)
|
|
|
|
|
2023-02-23 12:39:43 +00:00
|
|
|
// project_id is an UUID that refers to projects.id.
|
2023-02-23 12:35:32 +00:00
|
|
|
field project_id blob
|
2023-02-23 12:39:43 +00:00
|
|
|
// interval_day is the total for a given day.
|
2023-02-23 12:35:32 +00:00
|
|
|
field interval_day date
|
2023-02-23 12:39:43 +00:00
|
|
|
// egress_allocated is the total budgeted download traffic.
|
2023-02-23 12:35:32 +00:00
|
|
|
field egress_allocated uint64 ( updatable )
|
2023-02-23 12:39:43 +00:00
|
|
|
// egress_settled is the total download traffic that the storagenodes have reported.
|
2023-02-23 12:35:32 +00:00
|
|
|
field egress_settled uint64 ( updatable )
|
2023-02-23 12:39:43 +00:00
|
|
|
// egress_dead is the amount of traffic that the uplink did not use.
|
2023-02-23 12:35:32 +00:00
|
|
|
field egress_dead uint64 ( updatable, default 0 )
|
|
|
|
)
|
|
|
|
|
2023-02-23 12:39:43 +00:00
|
|
|
// bucket_storage_tally is the total at rest traffic for a given date.
|
2023-02-23 12:35:32 +00:00
|
|
|
model bucket_storage_tally (
|
|
|
|
key bucket_name project_id interval_start
|
|
|
|
|
|
|
|
index (
|
|
|
|
name bucket_storage_tallies_project_id_interval_start_index
|
|
|
|
fields project_id interval_start
|
|
|
|
)
|
|
|
|
|
2023-02-23 12:39:43 +00:00
|
|
|
// bucket_name refers to buckets.name table.
|
2023-02-23 12:35:32 +00:00
|
|
|
field bucket_name blob
|
2023-02-23 12:39:43 +00:00
|
|
|
// project_id is an UUID that refers to projects.id.
|
2023-02-23 12:35:32 +00:00
|
|
|
field project_id blob
|
|
|
|
|
2023-02-23 12:39:43 +00:00
|
|
|
// interval_start is when the measurement started.
|
|
|
|
// The measurement is collected over several hours, so it is not consistent.
|
2023-02-23 12:35:32 +00:00
|
|
|
field interval_start timestamp
|
|
|
|
|
2023-02-23 12:39:43 +00:00
|
|
|
// total_bytes is the total bytes at rest.
|
2023-02-23 12:35:32 +00:00
|
|
|
field total_bytes uint64 ( default 0)
|
2023-02-23 12:39:43 +00:00
|
|
|
// inline is the amount of bytes stored in inline segments.
|
2023-02-23 12:35:32 +00:00
|
|
|
field inline uint64
|
2023-02-23 12:39:43 +00:00
|
|
|
// remote is the amount of bytes stored on storagenodes, pre-expansion.
|
2023-02-23 12:35:32 +00:00
|
|
|
field remote uint64
|
|
|
|
|
2023-02-23 12:39:43 +00:00
|
|
|
// total_segments_count is the count of all segments.
|
2023-02-23 12:35:32 +00:00
|
|
|
field total_segments_count uint ( default 0)
|
2023-02-23 12:39:43 +00:00
|
|
|
// remote_segments_count is the count of segments that refer to storagenodes.
|
2023-02-23 12:35:32 +00:00
|
|
|
field remote_segments_count uint
|
2023-02-23 12:39:43 +00:00
|
|
|
// inline_segments_count is the count of segments that have inline data.
|
2023-02-23 12:35:32 +00:00
|
|
|
field inline_segments_count uint
|
2023-02-23 12:39:43 +00:00
|
|
|
// object_count is the count of objects.
|
2023-02-23 12:35:32 +00:00
|
|
|
field object_count uint
|
|
|
|
|
2023-02-23 12:39:43 +00:00
|
|
|
// metadata_size is the total bytes used by encrypted metadata.
|
2023-02-23 12:35:32 +00:00
|
|
|
field metadata_size uint64
|
|
|
|
)
|
|
|
|
|
|
|
|
read all (
|
|
|
|
select bucket_storage_tally
|
|
|
|
orderby desc bucket_storage_tally.interval_start
|
|
|
|
)
|
|
|
|
|
|
|
|
read all (
|
|
|
|
select bucket_storage_tally
|
|
|
|
where bucket_storage_tally.project_id = ?
|
|
|
|
where bucket_storage_tally.bucket_name = ?
|
|
|
|
where bucket_storage_tally.interval_start >= ?
|
|
|
|
where bucket_storage_tally.interval_start <= ?
|
|
|
|
orderby desc bucket_storage_tally.interval_start
|
|
|
|
)
|