Documentation
¶
Overview ¶
Package list contains list functions
Index ¶
- func DirSorted(ctx context.Context, f fs.Fs, includeAll bool, dir string) (entries fs.DirEntries, err error)
- func DirSortedFn(ctx context.Context, f fs.Fs, includeAll bool, dir string, ...) (err error)
- func SortToChan(out chan<- fs.DirEntry) fs.ListRCallback
- func WithListP(ctx context.Context, dir string, list fs.ListPer) (entries fs.DirEntries, err error)
- type Helper
- type KeyFn
- type NewObjecter
- type Sorter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DirSorted ¶
func DirSorted(ctx context.Context, f fs.Fs, includeAll bool, dir string) (entries fs.DirEntries, err error)
DirSorted reads Object and *Dir into entries for the given Fs.
dir is the start directory, "" for root
If includeAll is specified all files will be added, otherwise only files and directories passing the filter will be added.
Files will be returned in sorted order
func DirSortedFn ¶ added in v1.70.0
func DirSortedFn(ctx context.Context, f fs.Fs, includeAll bool, dir string, callback fs.ListRCallback, keyFn KeyFn) (err error)
DirSortedFn reads Object and *Dir into entries for the given Fs.
dir is the start directory, "" for root
If includeAll is specified all files will be added, otherwise only files and directories passing the filter will be added.
Files will be returned through callback in sorted order
func SortToChan ¶ added in v1.70.0
func SortToChan(out chan<- fs.DirEntry) fs.ListRCallback
SortToChan makes a callback for the Sorter which sends the output to the channel provided.
Types ¶
type Helper ¶ added in v1.70.0
type Helper struct {
// contains filtered or unexported fields
}
Helper is used in the implementation of ListR to accumulate DirEntries
func NewHelper ¶ added in v1.70.0
func NewHelper(callback fs.ListRCallback) *Helper
NewHelper should be called from ListR with the callback passed in
type NewObjecter ¶ added in v1.70.0
type NewObjecter interface { // NewObject finds the Object at remote. If it can't be found // it returns the error ErrorObjectNotFound. NewObject(ctx context.Context, remote string) (fs.Object, error) }
NewObjecter is the minimum facilities we need from the fs.Fs passed into NewSorter.
type Sorter ¶ added in v1.70.0
type Sorter struct {
// contains filtered or unexported fields
}
Sorter implements an efficient mechanism for sorting list entries.
If there are a large number of entries (above `--list-cutoff`), this may be done on disk instead of in memory.
Supply entries with the Add method, call Send at the end to deliver the sorted entries and finalise with CleanUp regardless of whether you called Add or Send.
Sorted entries are delivered to the callback supplied to NewSorter when the Send method is called.
func NewSorter ¶ added in v1.70.0
func NewSorter(ctx context.Context, f NewObjecter, callback fs.ListRCallback, keyFn KeyFn) (*Sorter, error)
NewSorter creates a new Sorter with callback for sorted entries to be delivered to. keyFn is used to process each entry to get a key function, if nil then it will just use entry.Remote()
func (*Sorter) Add ¶ added in v1.70.0
func (ls *Sorter) Add(entries fs.DirEntries) error
Add entries to the list sorter.
Does not call the callback.
Safe to call from concurrent go routines