Retrieve all the objects using pagination

Signed-off-by: Sylvain Baubeau <sbaubeau@redhat.com>
This commit is contained in:
Sylvain Baubeau 2015-07-02 18:27:13 +02:00
parent 49582a6188
commit 15d567671b

View File

@ -433,7 +433,7 @@ func (d *driver) List(ctx context.Context, path string) ([]string, error) {
Delimiter: '/', Delimiter: '/',
} }
objects, err := d.Conn.Objects(d.Container, opts) objects, err := d.Conn.ObjectsAll(d.Container, opts)
for _, obj := range objects { for _, obj := range objects {
files = append(files, strings.TrimPrefix(strings.TrimSuffix(obj.Name, "/"), d.swiftPath("/"))) files = append(files, strings.TrimPrefix(strings.TrimSuffix(obj.Name, "/"), d.swiftPath("/")))
} }
@ -459,7 +459,7 @@ func (d *driver) Delete(ctx context.Context, path string) error {
Prefix: d.swiftPath(path) + "/", Prefix: d.swiftPath(path) + "/",
} }
objects, err := d.Conn.Objects(d.Container, &opts) objects, err := d.Conn.ObjectsAll(d.Container, &opts)
if err != nil { if err != nil {
return parseError(path, err) return parseError(path, err)
} }
@ -531,7 +531,7 @@ func (d *driver) getContentType() string {
} }
func (d *driver) getAllSegments(path string) ([]swift.Object, error) { func (d *driver) getAllSegments(path string) ([]swift.Object, error) {
return d.Conn.Objects(d.Container, &swift.ObjectsOpts{Prefix: d.swiftSegmentPath(path)}) return d.Conn.ObjectsAll(d.Container, &swift.ObjectsOpts{Prefix: d.swiftSegmentPath(path)})
} }
func (d *driver) createManifest(path string) (*swift.ObjectCreateFile, error) { func (d *driver) createManifest(path string) (*swift.ObjectCreateFile, error) {