|
|
@ -95,8 +95,9 @@ type listPathOptions struct { |
|
|
|
// A transient result will never be returned from the cache so knowing the list id is required.
|
|
|
|
// A transient result will never be returned from the cache so knowing the list id is required.
|
|
|
|
Transient bool |
|
|
|
Transient bool |
|
|
|
|
|
|
|
|
|
|
|
// singleObject will assume that prefix refers to an exact single object.
|
|
|
|
// discardResult will not persist the cache to storage.
|
|
|
|
singleObject bool |
|
|
|
// When the initial results are returned listing will be canceled.
|
|
|
|
|
|
|
|
discardResult bool |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func init() { |
|
|
|
func init() { |
|
|
@ -545,7 +546,7 @@ func (er *erasureObjects) listPath(ctx context.Context, o listPathOptions) (entr |
|
|
|
o.debugf("listPath with options: %#v\n", o) |
|
|
|
o.debugf("listPath with options: %#v\n", o) |
|
|
|
|
|
|
|
|
|
|
|
// See if we have the listing stored.
|
|
|
|
// See if we have the listing stored.
|
|
|
|
if !o.Create && !o.singleObject { |
|
|
|
if !o.Create && !o.discardResult { |
|
|
|
entries, err := er.streamMetadataParts(ctx, o) |
|
|
|
entries, err := er.streamMetadataParts(ctx, o) |
|
|
|
if IsErr(err, []error{ |
|
|
|
if IsErr(err, []error{ |
|
|
|
nil, |
|
|
|
nil, |
|
|
@ -627,6 +628,11 @@ func (er *erasureObjects) listPath(ctx context.Context, o listPathOptions) (entr |
|
|
|
close(filterCh) |
|
|
|
close(filterCh) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Cancel listing on return if non-saved list.
|
|
|
|
|
|
|
|
if o.discardResult { |
|
|
|
|
|
|
|
defer cancel() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
go func() { |
|
|
|
go func() { |
|
|
|
defer cancel() |
|
|
|
defer cancel() |
|
|
|
// Save continuous updates
|
|
|
|
// Save continuous updates
|
|
|
@ -658,7 +664,7 @@ func (er *erasureObjects) listPath(ctx context.Context, o listPathOptions) (entr |
|
|
|
|
|
|
|
|
|
|
|
// Write results to disk.
|
|
|
|
// Write results to disk.
|
|
|
|
bw := newMetacacheBlockWriter(cacheCh, func(b *metacacheBlock) error { |
|
|
|
bw := newMetacacheBlockWriter(cacheCh, func(b *metacacheBlock) error { |
|
|
|
if o.singleObject { |
|
|
|
if o.discardResult { |
|
|
|
// Don't save single object listings.
|
|
|
|
// Don't save single object listings.
|
|
|
|
return nil |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|