diff --git a/backend/union/policy/eplfs.go b/backend/union/policy/eplfs.go index 454206b77..9b6107eb2 100644 --- a/backend/union/policy/eplfs.go +++ b/backend/union/policy/eplfs.go @@ -24,7 +24,8 @@ func (p *EpLfs) lfs(upstreams []*upstream.Fs) (*upstream.Fs, error) { for _, u := range upstreams { space, err := u.GetFreeSpace() if err != nil { - return nil, err + fs.LogPrintf(fs.LogLevelNotice, nil, + "Free Space is not supported for upstream %s, treating as infinite", u.Name()) } if space < minFreeSpace { minFreeSpace = space @@ -43,7 +44,8 @@ func (p *EpLfs) lfsEntries(entries []upstream.Entry) (upstream.Entry, error) { for _, e := range entries { space, err := e.UpstreamFs().GetFreeSpace() if err != nil { - return nil, err + fs.LogPrintf(fs.LogLevelNotice, nil, + "Free Space is not supported for upstream %s, treating as infinite", e.UpstreamFs().Name()) } if space < minFreeSpace { minFreeSpace = space diff --git a/backend/union/policy/eplus.go b/backend/union/policy/eplus.go index e3aea8feb..ef8a963b0 100644 --- a/backend/union/policy/eplus.go +++ b/backend/union/policy/eplus.go @@ -24,7 +24,8 @@ func (p *EpLus) lus(upstreams []*upstream.Fs) (*upstream.Fs, error) { for _, u := range upstreams { space, err := u.GetUsedSpace() if err != nil { - return nil, err + fs.LogPrintf(fs.LogLevelNotice, nil, + "Used Space is not supported for upstream %s, treating as 0", u.Name()) } if space < minUsedSpace { minUsedSpace = space @@ -43,7 +44,8 @@ func (p *EpLus) lusEntries(entries []upstream.Entry) (upstream.Entry, error) { for _, e := range entries { space, err := e.UpstreamFs().GetFreeSpace() if err != nil { - return nil, err + fs.LogPrintf(fs.LogLevelNotice, nil, + "Used Space is not supported for upstream %s, treating as 0", e.UpstreamFs().Name()) } if space < minUsedSpace { minUsedSpace = space diff --git a/backend/union/policy/epmfs.go b/backend/union/policy/epmfs.go index 06b195047..1370411c0 100644 --- a/backend/union/policy/epmfs.go +++ b/backend/union/policy/epmfs.go @@ -23,7 +23,8 @@ func (p *EpMfs) mfs(upstreams []*upstream.Fs) (*upstream.Fs, error) { for _, u := range upstreams { space, err := u.GetFreeSpace() if err != nil { - return nil, err + fs.LogPrintf(fs.LogLevelNotice, nil, + "Free Space is not supported for upstream %s, treating as infinite", u.Name()) } if maxFreeSpace < space { maxFreeSpace = space @@ -42,7 +43,8 @@ func (p *EpMfs) mfsEntries(entries []upstream.Entry) (upstream.Entry, error) { for _, e := range entries { space, err := e.UpstreamFs().GetFreeSpace() if err != nil { - return nil, err + fs.LogPrintf(fs.LogLevelNotice, nil, + "Free Space is not supported for upstream %s, treating as infinite", e.UpstreamFs().Name()) } if maxFreeSpace < space { maxFreeSpace = space diff --git a/backend/union/upstream/upstream.go b/backend/union/upstream/upstream.go index 7543cfad0..07ec75661 100644 --- a/backend/union/upstream/upstream.go +++ b/backend/union/upstream/upstream.go @@ -3,6 +3,7 @@ package upstream import ( "context" "io" + "math" "path" "path/filepath" "strings" @@ -254,13 +255,13 @@ func (f *Fs) GetFreeSpace() (int64, error) { if atomic.LoadInt64(&f.cacheExpiry) <= time.Now().Unix() { err := f.updateUsage() if err != nil { - return 0, ErrUsageFieldNotSupported + return math.MaxInt64, ErrUsageFieldNotSupported } } f.cacheMutex.RLock() defer f.cacheMutex.RUnlock() if f.usage.Free == nil { - return 0, ErrUsageFieldNotSupported + return math.MaxInt64, ErrUsageFieldNotSupported } return *f.usage.Free, nil } diff --git a/docs/content/union.md b/docs/content/union.md index 668969535..dac65134e 100644 --- a/docs/content/union.md +++ b/docs/content/union.md @@ -49,6 +49,18 @@ A path preserving policy will only consider upstreams where the relative path be When using non-path preserving policies paths will be created in target upstreams as necessary. +#### Quota Relevant Policies + +Some policies rely on quota information. These policies should be used only if your upstreams support the respective quota fields. + +| Policy | Required Field | +|------------|----------------| +| lfs, eplfs | Free | +| mfs, epmfs | Free | +| lus, eplus | Used | + +To check if your upstream support the field, run `rclone about remote: [flags]` and see if the reuqired field exists. + #### Filters Policies basically search upstream remotes and create a list of files / paths for functions to work on. The policy is responsible for filtering and sorting. The policy type defines the sorting but filtering is mostly uniform as described below.