Documentation ¶
Overview ¶
Package policy provides utilities for the union implementation.
Index ¶
- type All
- type EpAll
- func (p *EpAll) Action(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
- func (p *EpAll) ActionEntries(entries ...upstream.Entry) ([]upstream.Entry, error)
- func (p *EpAll) Create(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
- func (p *EpAll) CreateEntries(entries ...upstream.Entry) ([]upstream.Entry, error)
- type EpFF
- func (p *EpFF) Action(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
- func (p *EpFF) ActionEntries(entries ...upstream.Entry) ([]upstream.Entry, error)
- func (p *EpFF) Create(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
- func (p *EpFF) CreateEntries(entries ...upstream.Entry) ([]upstream.Entry, error)
- func (p *EpFF) Search(ctx context.Context, upstreams []*upstream.Fs, path string) (*upstream.Fs, error)
- func (p *EpFF) SearchEntries(entries ...upstream.Entry) (upstream.Entry, error)
- type EpLfs
- func (p *EpLfs) Action(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
- func (p *EpLfs) ActionEntries(entries ...upstream.Entry) ([]upstream.Entry, error)
- func (p *EpLfs) Create(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
- func (p *EpLfs) CreateEntries(entries ...upstream.Entry) ([]upstream.Entry, error)
- func (p *EpLfs) Search(ctx context.Context, upstreams []*upstream.Fs, path string) (*upstream.Fs, error)
- func (p *EpLfs) SearchEntries(entries ...upstream.Entry) (upstream.Entry, error)
- type EpLno
- func (p *EpLno) Action(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
- func (p *EpLno) ActionEntries(entries ...upstream.Entry) ([]upstream.Entry, error)
- func (p *EpLno) Create(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
- func (p *EpLno) CreateEntries(entries ...upstream.Entry) ([]upstream.Entry, error)
- func (p *EpLno) Search(ctx context.Context, upstreams []*upstream.Fs, path string) (*upstream.Fs, error)
- func (p *EpLno) SearchEntries(entries ...upstream.Entry) (upstream.Entry, error)
- type EpLus
- func (p *EpLus) Action(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
- func (p *EpLus) ActionEntries(entries ...upstream.Entry) ([]upstream.Entry, error)
- func (p *EpLus) Create(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
- func (p *EpLus) CreateEntries(entries ...upstream.Entry) ([]upstream.Entry, error)
- func (p *EpLus) Search(ctx context.Context, upstreams []*upstream.Fs, path string) (*upstream.Fs, error)
- func (p *EpLus) SearchEntries(entries ...upstream.Entry) (upstream.Entry, error)
- type EpMfs
- func (p *EpMfs) Action(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
- func (p *EpMfs) ActionEntries(entries ...upstream.Entry) ([]upstream.Entry, error)
- func (p *EpMfs) Create(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
- func (p *EpMfs) CreateEntries(entries ...upstream.Entry) ([]upstream.Entry, error)
- func (p *EpMfs) Search(ctx context.Context, upstreams []*upstream.Fs, path string) (*upstream.Fs, error)
- func (p *EpMfs) SearchEntries(entries ...upstream.Entry) (upstream.Entry, error)
- type EpRand
- func (p *EpRand) Action(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
- func (p *EpRand) ActionEntries(entries ...upstream.Entry) ([]upstream.Entry, error)
- func (p *EpRand) Create(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
- func (p *EpRand) CreateEntries(entries ...upstream.Entry) ([]upstream.Entry, error)
- func (p *EpRand) Search(ctx context.Context, upstreams []*upstream.Fs, path string) (*upstream.Fs, error)
- func (p *EpRand) SearchEntries(entries ...upstream.Entry) (upstream.Entry, error)
- type FF
- type Lfs
- type Lno
- type Lus
- type Mfs
- type Newest
- func (p *Newest) Action(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
- func (p *Newest) ActionEntries(entries ...upstream.Entry) ([]upstream.Entry, error)
- func (p *Newest) Create(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
- func (p *Newest) CreateEntries(entries ...upstream.Entry) ([]upstream.Entry, error)
- func (p *Newest) Search(ctx context.Context, upstreams []*upstream.Fs, path string) (*upstream.Fs, error)
- func (p *Newest) SearchEntries(entries ...upstream.Entry) (upstream.Entry, error)
- type Policy
- type Rand
- func (p *Rand) Action(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
- func (p *Rand) ActionEntries(entries ...upstream.Entry) ([]upstream.Entry, error)
- func (p *Rand) Create(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
- func (p *Rand) CreateEntries(entries ...upstream.Entry) ([]upstream.Entry, error)
- func (p *Rand) Search(ctx context.Context, upstreams []*upstream.Fs, path string) (*upstream.Fs, error)
- func (p *Rand) SearchEntries(entries ...upstream.Entry) (upstream.Entry, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type All ¶
type All struct {
EpAll
}
All policy behaves the same as EpAll except for the CREATE category Action category: same as epall. Create category: apply to all branches. Search category: same as epall.
type EpAll ¶
type EpAll struct {
EpFF
}
EpAll stands for existing path, all Action category: apply to all found. Create category: apply to all found. Search category: same as epff.
func (*EpAll) Action ¶
func (p *EpAll) Action(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
Action category policy, governing the modification of files and directories
func (*EpAll) ActionEntries ¶
ActionEntries is ACTION category policy but receiving a set of candidate entries
type EpFF ¶
type EpFF struct{}
EpFF stands for existing path, first found Given the order of the candidates, act on the first one found where the relative path exists.
func (*EpFF) Action ¶
func (p *EpFF) Action(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
Action category policy, governing the modification of files and directories
func (*EpFF) ActionEntries ¶
ActionEntries is ACTION category policy but receiving a set of candidate entries
func (*EpFF) Create ¶
func (p *EpFF) Create(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
Create category policy, governing the creation of files and directories
func (*EpFF) CreateEntries ¶
CreateEntries is CREATE category policy but receiving a set of candidate entries
type EpLfs ¶
type EpLfs struct {
EpAll
}
EpLfs stands for existing path, least free space Of all the candidates on which the path exists choose the one with the least free space.
func (*EpLfs) Action ¶
func (p *EpLfs) Action(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
Action category policy, governing the modification of files and directories
func (*EpLfs) ActionEntries ¶
ActionEntries is ACTION category policy but receiving a set of candidate entries
func (*EpLfs) Create ¶
func (p *EpLfs) Create(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
Create category policy, governing the creation of files and directories
func (*EpLfs) CreateEntries ¶
CreateEntries is CREATE category policy but receiving a set of candidate entries
type EpLno ¶
type EpLno struct {
EpAll
}
EpLno stands for existing path, least number of objects Of all the candidates on which the path exists choose the one with the least number of objects
func (*EpLno) Action ¶
func (p *EpLno) Action(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
Action category policy, governing the modification of files and directories
func (*EpLno) ActionEntries ¶
ActionEntries is ACTION category policy but receiving a set of candidate entries
func (*EpLno) Create ¶
func (p *EpLno) Create(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
Create category policy, governing the creation of files and directories
func (*EpLno) CreateEntries ¶
CreateEntries is CREATE category policy but receiving a set of candidate entries
type EpLus ¶
type EpLus struct {
EpAll
}
EpLus stands for existing path, least used space Of all the candidates on which the path exists choose the one with the least used space.
func (*EpLus) Action ¶
func (p *EpLus) Action(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
Action category policy, governing the modification of files and directories
func (*EpLus) ActionEntries ¶
ActionEntries is ACTION category policy but receiving a set of candidate entries
func (*EpLus) Create ¶
func (p *EpLus) Create(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
Create category policy, governing the creation of files and directories
func (*EpLus) CreateEntries ¶
CreateEntries is CREATE category policy but receiving a set of candidate entries
type EpMfs ¶
type EpMfs struct {
EpAll
}
EpMfs stands for existing path, most free space Of all the candidates on which the path exists choose the one with the most free space.
func (*EpMfs) Action ¶
func (p *EpMfs) Action(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
Action category policy, governing the modification of files and directories
func (*EpMfs) ActionEntries ¶
ActionEntries is ACTION category policy but receiving a set of candidate entries
func (*EpMfs) Create ¶
func (p *EpMfs) Create(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
Create category policy, governing the creation of files and directories
func (*EpMfs) CreateEntries ¶
CreateEntries is CREATE category policy but receiving a set of candidate entries
type EpRand ¶
type EpRand struct {
EpAll
}
EpRand stands for existing path, random Calls epall and then randomizes. Returns one candidate.
func (*EpRand) Action ¶
func (p *EpRand) Action(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
Action category policy, governing the modification of files and directories
func (*EpRand) ActionEntries ¶
ActionEntries is ACTION category policy but receiving a set of candidate entries
func (*EpRand) Create ¶
func (p *EpRand) Create(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
Create category policy, governing the creation of files and directories
func (*EpRand) CreateEntries ¶
CreateEntries is CREATE category policy but receiving a set of candidate entries
type FF ¶
type FF struct {
EpFF
}
FF stands for first found Search category: same as epff. Action category: same as epff. Create category: Given the order of the candidates, act on the first one found.
type Lfs ¶
type Lfs struct {
EpLfs
}
Lfs stands for least free space Search category: same as eplfs. Action category: same as eplfs. Create category: Pick the drive with the least free space.
type Lno ¶
type Lno struct {
EpLno
}
Lno stands for least number of objects Search category: same as eplno. Action category: same as eplno. Create category: Pick the drive with the least number of objects.
type Lus ¶
type Lus struct {
EpLus
}
Lus stands for least used space Search category: same as eplus. Action category: same as eplus. Create category: Pick the drive with the least used space.
type Mfs ¶
type Mfs struct {
EpMfs
}
Mfs stands for most free space Search category: same as epmfs. Action category: same as epmfs. Create category: Pick the drive with the most free space.
type Newest ¶
type Newest struct {
EpAll
}
Newest policy picks the file / directory with the largest mtime It implies the existence of a path
func (*Newest) Action ¶
func (p *Newest) Action(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
Action category policy, governing the modification of files and directories
func (*Newest) ActionEntries ¶
ActionEntries is ACTION category policy but receiving a set of candidate entries
func (*Newest) Create ¶
func (p *Newest) Create(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
Create category policy, governing the creation of files and directories
func (*Newest) CreateEntries ¶
CreateEntries is CREATE category policy but receiving a set of candidate entries
type Policy ¶
type Policy interface { // Action category policy, governing the modification of files and directories Action(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error) // Create category policy, governing the creation of files and directories Create(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error) // Search category policy, governing the access to files and directories Search(ctx context.Context, upstreams []*upstream.Fs, path string) (*upstream.Fs, error) // ActionEntries is ACTION category policy but receiving a set of candidate entries ActionEntries(entries ...upstream.Entry) ([]upstream.Entry, error) // CreateEntries is CREATE category policy but receiving a set of candidate entries CreateEntries(entries ...upstream.Entry) ([]upstream.Entry, error) // SearchEntries is SEARCH category policy but receiving a set of candidate entries SearchEntries(entries ...upstream.Entry) (upstream.Entry, error) }
Policy is the interface of a set of defined behavior choosing the upstream Fs to operate on
type Rand ¶
type Rand struct {
All
}
Rand stands for random Calls all and then randomizes. Returns one candidate.
func (*Rand) Action ¶
func (p *Rand) Action(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
Action category policy, governing the modification of files and directories
func (*Rand) ActionEntries ¶
ActionEntries is ACTION category policy but receiving a set of candidate entries
func (*Rand) Create ¶
func (p *Rand) Create(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)
Create category policy, governing the creation of files and directories
func (*Rand) CreateEntries ¶
CreateEntries is CREATE category policy but receiving a set of candidate entries