mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/backup: retrieve only the required metadata when reading GCS objects
This commit is contained in:
parent
355ccba81a
commit
cfb9fa2100
1 changed files with 9 additions and 0 deletions
|
@ -67,6 +67,12 @@ func (fs *FS) String() string {
|
|||
return fmt.Sprintf("GCS{bucket: %q, dir: %q}", fs.Bucket, fs.Dir)
|
||||
}
|
||||
|
||||
// selectAttrs contains object attributes to select in ListParts.
|
||||
var selectAttrs = []string{
|
||||
"Name",
|
||||
"Size",
|
||||
}
|
||||
|
||||
// ListParts returns all the parts for fs.
|
||||
func (fs *FS) ListParts() ([]common.Part, error) {
|
||||
dir := fs.Dir
|
||||
|
@ -74,6 +80,9 @@ func (fs *FS) ListParts() ([]common.Part, error) {
|
|||
q := &storage.Query{
|
||||
Prefix: dir,
|
||||
}
|
||||
if err := q.SetAttrSelection(selectAttrs); err != nil {
|
||||
return nil, fmt.Errorf("error in SetAttrSelection: %s", err)
|
||||
}
|
||||
it := fs.bkt.Objects(ctx, q)
|
||||
var parts []common.Part
|
||||
for {
|
||||
|
|
Loading…
Reference in a new issue