2019-11-30 14:41:39 +00:00
|
|
|
package policy
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/rclone/rclone/backend/union/upstream"
|
|
|
|
"github.com/rclone/rclone/fs"
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
registerPolicy("ff", &FF{})
|
|
|
|
}
|
|
|
|
|
|
|
|
// FF stands for first found
|
|
|
|
// Search category: same as epff.
|
|
|
|
// Action category: same as epff.
|
Spelling fixes
Fix spelling of: above, already, anonymous, associated,
authentication, bandwidth, because, between, blocks, calculate,
candidates, cautious, changelog, cleaner, clipboard, command,
completely, concurrently, considered, constructs, corrupt, current,
daemon, dependencies, deprecated, directory, dispatcher, download,
eligible, ellipsis, encrypter, endpoint, entrieslist, essentially,
existing writers, existing, expires, filesystem, flushing, frequently,
hierarchy, however, implementation, implements, inaccurate,
individually, insensitive, longer, maximum, metadata, modified,
multipart, namedirfirst, nextcloud, obscured, opened, optional,
owncloud, pacific, passphrase, password, permanently, persimmon,
positive, potato, protocol, quota, receiving, recommends, referring,
requires, revisited, satisfied, satisfies, satisfy, semver,
serialized, session, storage, strategies, stringlist, successful,
supported, surprise, temporarily, temporary, transactions, unneeded,
update, uploads, wrapped
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2020-10-09 00:17:24 +00:00
|
|
|
// Create category: Given the order of the candidates, act on the first one found.
|
2019-11-30 14:41:39 +00:00
|
|
|
type FF struct {
|
|
|
|
EpFF
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create category policy, governing the creation of files and directories
|
|
|
|
func (p *FF) Create(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error) {
|
|
|
|
if len(upstreams) == 0 {
|
|
|
|
return nil, fs.ErrorObjectNotFound
|
|
|
|
}
|
|
|
|
upstreams = filterNC(upstreams)
|
|
|
|
if len(upstreams) == 0 {
|
|
|
|
return upstreams, fs.ErrorPermissionDenied
|
|
|
|
}
|
|
|
|
return upstreams[:1], nil
|
|
|
|
}
|