mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-01-20 07:19:17 +01:00
lib/backup: retrieve only the required metadata when reading GCS objects
This commit is contained in:
parent
ccf3d143c5
commit
17eca31989
@ -67,6 +67,12 @@ func (fs *FS) String() string {
|
|||||||
return fmt.Sprintf("GCS{bucket: %q, dir: %q}", fs.Bucket, fs.Dir)
|
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.
|
// ListParts returns all the parts for fs.
|
||||||
func (fs *FS) ListParts() ([]common.Part, error) {
|
func (fs *FS) ListParts() ([]common.Part, error) {
|
||||||
dir := fs.Dir
|
dir := fs.Dir
|
||||||
@ -74,6 +80,9 @@ func (fs *FS) ListParts() ([]common.Part, error) {
|
|||||||
q := &storage.Query{
|
q := &storage.Query{
|
||||||
Prefix: dir,
|
Prefix: dir,
|
||||||
}
|
}
|
||||||
|
if err := q.SetAttrSelection(selectAttrs); err != nil {
|
||||||
|
return nil, fmt.Errorf("error in SetAttrSelection: %s", err)
|
||||||
|
}
|
||||||
it := fs.bkt.Objects(ctx, q)
|
it := fs.bkt.Objects(ctx, q)
|
||||||
var parts []common.Part
|
var parts []common.Part
|
||||||
for {
|
for {
|
||||||
|
Loading…
Reference in New Issue
Block a user