policy

package
v1.52.3-0...-16af9ab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

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.

func (*All) Create

func (p *All) Create(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)

Create category policy, governing the creation of files and directories

func (*All) CreateEntries

func (p *All) CreateEntries(entries ...upstream.Entry) ([]upstream.Entry, error)

CreateEntries is CREATE category policy but receiving a set of candidate entries

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

func (p *EpAll) ActionEntries(entries ...upstream.Entry) ([]upstream.Entry, error)

ActionEntries is ACTION category policy but receivng a set of candidate entries

func (*EpAll) Create

func (p *EpAll) Create(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)

Create category policy, governing the creation of files and directories

func (*EpAll) CreateEntries

func (p *EpAll) CreateEntries(entries ...upstream.Entry) ([]upstream.Entry, error)

CreateEntries is CREATE 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

func (p *EpFF) ActionEntries(entries ...upstream.Entry) ([]upstream.Entry, error)

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

func (p *EpFF) CreateEntries(entries ...upstream.Entry) ([]upstream.Entry, error)

CreateEntries is CREATE category policy but receiving a set of candidate entries

func (*EpFF) Search

func (p *EpFF) Search(ctx context.Context, upstreams []*upstream.Fs, path string) (*upstream.Fs, error)

Search category policy, governing the access to files and directories

func (*EpFF) SearchEntries

func (p *EpFF) SearchEntries(entries ...upstream.Entry) (upstream.Entry, error)

SearchEntries is SEARCH 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

func (p *EpLfs) ActionEntries(entries ...upstream.Entry) ([]upstream.Entry, error)

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

func (p *EpLfs) CreateEntries(entries ...upstream.Entry) ([]upstream.Entry, error)

CreateEntries is CREATE category policy but receiving a set of candidate entries

func (*EpLfs) Search

func (p *EpLfs) Search(ctx context.Context, upstreams []*upstream.Fs, path string) (*upstream.Fs, error)

Search category policy, governing the access to files and directories

func (*EpLfs) SearchEntries

func (p *EpLfs) SearchEntries(entries ...upstream.Entry) (upstream.Entry, error)

SearchEntries is SEARCH 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

func (p *EpLno) ActionEntries(entries ...upstream.Entry) ([]upstream.Entry, error)

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

func (p *EpLno) CreateEntries(entries ...upstream.Entry) ([]upstream.Entry, error)

CreateEntries is CREATE category policy but receiving a set of candidate entries

func (*EpLno) Search

func (p *EpLno) Search(ctx context.Context, upstreams []*upstream.Fs, path string) (*upstream.Fs, error)

Search category policy, governing the access to files and directories

func (*EpLno) SearchEntries

func (p *EpLno) SearchEntries(entries ...upstream.Entry) (upstream.Entry, error)

SearchEntries is SEARCH 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

func (p *EpLus) ActionEntries(entries ...upstream.Entry) ([]upstream.Entry, error)

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

func (p *EpLus) CreateEntries(entries ...upstream.Entry) ([]upstream.Entry, error)

CreateEntries is CREATE category policy but receiving a set of candidate entries

func (*EpLus) Search

func (p *EpLus) Search(ctx context.Context, upstreams []*upstream.Fs, path string) (*upstream.Fs, error)

Search category policy, governing the access to files and directories

func (*EpLus) SearchEntries

func (p *EpLus) SearchEntries(entries ...upstream.Entry) (upstream.Entry, error)

SearchEntries is SEARCH 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

func (p *EpMfs) ActionEntries(entries ...upstream.Entry) ([]upstream.Entry, error)

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

func (p *EpMfs) CreateEntries(entries ...upstream.Entry) ([]upstream.Entry, error)

CreateEntries is CREATE category policy but receiving a set of candidate entries

func (*EpMfs) Search

func (p *EpMfs) Search(ctx context.Context, upstreams []*upstream.Fs, path string) (*upstream.Fs, error)

Search category policy, governing the access to files and directories

func (*EpMfs) SearchEntries

func (p *EpMfs) SearchEntries(entries ...upstream.Entry) (upstream.Entry, error)

SearchEntries is SEARCH category policy but receivng 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

func (p *EpRand) ActionEntries(entries ...upstream.Entry) ([]upstream.Entry, error)

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

func (p *EpRand) CreateEntries(entries ...upstream.Entry) ([]upstream.Entry, error)

CreateEntries is CREATE category policy but receiving a set of candidate entries

func (*EpRand) Search

func (p *EpRand) Search(ctx context.Context, upstreams []*upstream.Fs, path string) (*upstream.Fs, error)

Search category policy, governing the access to files and directories

func (*EpRand) SearchEntries

func (p *EpRand) SearchEntries(entries ...upstream.Entry) (upstream.Entry, error)

SearchEntries is SEARCH 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 candiates, act on the first one found.

func (*FF) Create

func (p *FF) Create(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)

Create category policy, governing the creation of files and directories

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.

func (*Lfs) Create

func (p *Lfs) Create(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)

Create category policy, governing the creation of files and directories

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.

func (*Lno) Create

func (p *Lno) Create(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)

Create category policy, governing the creation of files and directories

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.

func (*Lus) Create

func (p *Lus) Create(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)

Create category policy, governing the creation of files and directories

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.

func (*Mfs) Create

func (p *Mfs) Create(ctx context.Context, upstreams []*upstream.Fs, path string) ([]*upstream.Fs, error)

Create category policy, governing the creation of files and directories

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

func (p *Newest) ActionEntries(entries ...upstream.Entry) ([]upstream.Entry, error)

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

func (p *Newest) CreateEntries(entries ...upstream.Entry) ([]upstream.Entry, error)

CreateEntries is CREATE category policy but receiving a set of candidate entries

func (*Newest) Search

func (p *Newest) Search(ctx context.Context, upstreams []*upstream.Fs, path string) (*upstream.Fs, error)

Search category policy, governing the access to files and directories

func (*Newest) SearchEntries

func (p *Newest) SearchEntries(entries ...upstream.Entry) (upstream.Entry, error)

SearchEntries is SEARCH 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

func Get

func Get(name string) (Policy, error)

Get a Policy from the list

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

func (p *Rand) ActionEntries(entries ...upstream.Entry) ([]upstream.Entry, error)

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

func (p *Rand) CreateEntries(entries ...upstream.Entry) ([]upstream.Entry, error)

CreateEntries is CREATE category policy but receiving a set of candidate entries

func (*Rand) Search

func (p *Rand) Search(ctx context.Context, upstreams []*upstream.Fs, path string) (*upstream.Fs, error)

Search category policy, governing the access to files and directories

func (*Rand) SearchEntries

func (p *Rand) SearchEntries(entries ...upstream.Entry) (upstream.Entry, error)

SearchEntries is SEARCH category policy but receiving a set of candidate entries

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL