satellite/metabase: add TotalEncryptedSize to LoopObjectEntry
We gonna need TotalEncryptedSize for buckets tally migrated to objects iterator from metaloop. Change-Id: I64774fdbda47abdaf5fbd370bd015b14bac9afdf
This commit is contained in:
parent
d53aacc058
commit
4335b21332
@ -47,9 +47,15 @@ type LoopObjectEntry struct {
|
||||
CreatedAt time.Time // temp used by metabase-createdat-migration
|
||||
ExpiresAt *time.Time // tally
|
||||
SegmentCount int32 // metrics
|
||||
TotalEncryptedSize int64 // tally
|
||||
EncryptedMetadataSize int // tally
|
||||
}
|
||||
|
||||
// Expired checks if object is expired relative to now.
|
||||
func (o LoopObjectEntry) Expired(now time.Time) bool {
|
||||
return o.ExpiresAt != nil && o.ExpiresAt.Before(now)
|
||||
}
|
||||
|
||||
// IterateLoopObjects iterates through all objects in metabase.
|
||||
func (db *DB) IterateLoopObjects(ctx context.Context, opts IterateLoopObjects, fn func(context.Context, LoopObjectsIterator) error) (err error) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
@ -166,7 +172,7 @@ func (it *loopIterator) doNextQuery(ctx context.Context) (_ tagsql.Rows, err err
|
||||
object_key, stream_id, version,
|
||||
status,
|
||||
created_at, expires_at,
|
||||
segment_count,
|
||||
segment_count, total_encrypted_size,
|
||||
LENGTH(COALESCE(encrypted_metadata,''))
|
||||
FROM objects
|
||||
`+it.db.asOfTime(it.asOfSystemTime, it.asOfSystemInterval)+`
|
||||
@ -186,7 +192,7 @@ func (it *loopIterator) scanItem(item *LoopObjectEntry) error {
|
||||
&item.ObjectKey, &item.StreamID, &item.Version,
|
||||
&item.Status,
|
||||
&item.CreatedAt, &item.ExpiresAt,
|
||||
&item.SegmentCount,
|
||||
&item.SegmentCount, &item.TotalEncryptedSize,
|
||||
&item.EncryptedMetadataSize,
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user