114
115
// Query, retieves file names by provided storage query
116
>
func (s *storageWrapper) Query(ctx context.Context, URI archiver.URI, fileNamePrefix string) (fileNames []string, err error) {
client.go
117
>
fileNames = make([]string, 0)
118
>
bucket := s.client.Bucket(URI.Hostname())
119
>
var attrs = new(storage.ObjectAttrs)
120
>
it := bucket.Objects(ctx, &storage.Query{
121
>
Prefix: formatSinkPath(URI.Path()) + "/" + fileNamePrefix,
122
>
})
123
>
124
>
for {
125
>
attrs, err = it.Next()
126
>
if err == iterator.Done {
127
>
return fileNames, nil
128
>
}
129
>
fileNames = append(fileNames, attrs.Name)
130
}
131