fli

package
v0.0.0-...-c5655c4 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2017 License: Apache-2.0 Imports: 50 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LogDir ...
	LogDir = "/var/log/fli"

	// CmdLogFilename ...
	CmdLogFilename = "cmd.log"

	// FliLogFilename ...
	FliLogFilename = "fli.log"
)

Variables

This section is empty.

Functions

func Execute

func Execute()

Execute ...

func FindAll

func FindAll(mds metastore.Client, search string) ([]*snapshot.Snapshot, []*branch.Branch, []*volume.Volume, error)

FindAll ...

func FindBranches

func FindBranches(mds metastore.Syncable, search string) ([]*branch.Branch, error)

FindBranches reports whether the search matches the Branches in mds search syntax is

search:
	{volumeset}:{branch}
	{branch}
volumeset:
	c8980031-b0ba
	e6296a4a-b481-406c-9d33-ae074c6df78b
	/chq/volset/name
	/chq/volset*
	/chq/volset?
	(empty string)
branch:
	br*
	*
	(empty string)

func FindSnapshots

func FindSnapshots(mds metastore.Syncable, search string) ([]*snapshot.Snapshot, error)

FindSnapshots reports whether the search matches the Snapshots in mds search syntax is

search:
	{volumeset}:{snapshot}
	{snapshot}
volumeset:
	c8980031-b0ba
	e6296a4a-b481-406c-9d33-ae074c6df78b
	/chq/volset/name
	/chq/volset*
	/chq/volset?
	(empty string)
snapshot:
	c8980031-b0ba
	e6296a4a-b481-406c-9d33-ae074c6df78b
	snap*
	*
	(empty string)

func FindVolumes

func FindVolumes(mds metastore.Client, search string) ([]*volume.Volume, error)

FindVolumes reports whether the search matches the Volume in mds search syntax is

search:
	{volumeset}:{volume}
	{volume}
volumeset:
	c8980031-b0ba
	e6296a4a-b481-406c-9d33-ae074c6df78b
	/chq/volset/name
	/chq/volset*
	/chq/volset?
	(empty string)
volume:
	c8980031-b0ba
	e6296a4a-b481-406c-9d33-ae074c6df78b
	vol*
	*
	(empty string)

func FindVolumesets

func FindVolumesets(mds metastore.Syncable, search string) ([]*volumeset.VolumeSet, error)

FindVolumesets reports whether the search matches the VolumeSets in mds search syntax is

search:
	c8980031-b0ba
	e6296a4a-b481-406c-9d33-ae074c6df78b
	/chq/volset/name
	/chq/volset*
	/chq/volset?
	(empty string)

Types

type AnalyticsLogger

type AnalyticsLogger struct {
	// contains filtered or unexported fields
}

AnalyticsLogger logs analytics related information to FlockerHub

func NewAnalyticsLogger

func NewAnalyticsLogger(server string, tokenfile string) *AnalyticsLogger

NewAnalyticsLogger ...

func (*AnalyticsLogger) LogConfig

func (al *AnalyticsLogger) LogConfig() error

LogConfig log fli config event

type CmdOutput

type CmdOutput struct {
	Op []CmdResult
}

CmdOutput is the default Result.

func (CmdOutput) JSON

func (out CmdOutput) JSON() string

JSON is unimplemented for now.

func (CmdOutput) String

func (out CmdOutput) String() string

type CmdResult

type CmdResult struct {
	Str string
	Tab [][]string
}

CmdResult ...

type CommandHandler

type CommandHandler interface {
	Clone(attributes string, full bool, args []string) (Result, error)
	Config(url string, token string, offline bool, args []string) (Result, error)
	Create(attributes string, full bool, args []string) (Result, error)
	Init(attributes string, description string, args []string) (Result, error)
	List(all bool, volume bool, snapshot bool, branch bool, full bool, args []string) (Result, error)
	Pull(url string, token string, full bool, args []string) (Result, error)
	Push(url string, token string, full bool, args []string) (Result, error)
	Remove(full bool, args []string) (Result, error)
	Setup(zpool string, force bool, args []string) (Result, error)
	Snapshot(branch string, newbranch bool, attributes string, description string, full bool, args []string) (Result, error)
	Sync(url string, token string, all bool, full bool, args []string) (Result, error)
	Fetch(url string, token string, all bool, full bool, args []string) (Result, error)
	Update(name string, attributes string, description string, full bool, args []string) (Result, error)
	Version(args []string) (Result, error)
	Info(args []string) (Result, error)
	Diagnostics(args []string) (Result, error)
}

CommandHandler inteface that implements handlers for cli commands

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config ...

func NewConfig

func NewConfig(filepath string) *Config

NewConfig creates a YAML based file configuration

func (*Config) CreateFile

func (y *Config) CreateFile() error

CreateFile creates a configuration file

func (*Config) Exists

func (y *Config) Exists() bool

Exists ...

func (*Config) ReadConfig

func (y *Config) ReadConfig() (ConfigParams, error)

ReadConfig reads the configuration

func (*Config) UpdateConfig

func (y *Config) UpdateConfig(cfg ConfigParams) error

UpdateConfig updates on the on-disk configuration with the in-memory configuration updates

type ConfigParams

type ConfigParams struct {
	SQLMdsCurrent string `yaml:"current,omitempty"`
	SQLMdsInitial string `yaml:"initial,omitempty"`
	FlockerHubURL string `yaml:"url,omitempty"`
	AuthTokenFile string `yaml:"token,omitempty"`
	Zpool         string `yaml:"zpool,omitempty"`
	Version       string `yaml:"version,omitempty"`
}

ConfigParams ...

type ErrBranchNotFound

type ErrBranchNotFound struct {
	Name string
}

ErrBranchNotFound ...

func (ErrBranchNotFound) Error

func (e ErrBranchNotFound) Error() string

type ErrConfigFileNotFound

type ErrConfigFileNotFound struct{}

ErrConfigFileNotFound ...

func (ErrConfigFileNotFound) Error

func (e ErrConfigFileNotFound) Error() string

type ErrInvalidArgs

type ErrInvalidArgs struct{}

ErrInvalidArgs ...

func (ErrInvalidArgs) Error

func (e ErrInvalidArgs) Error() string

type ErrInvalidAttrFormat

type ErrInvalidAttrFormat struct {
	// contains filtered or unexported fields
}

ErrInvalidAttrFormat ...

func (ErrInvalidAttrFormat) Error

func (e ErrInvalidAttrFormat) Error() string

type ErrInvalidSearch

type ErrInvalidSearch struct {
	// contains filtered or unexported fields
}

ErrInvalidSearch ..

func (ErrInvalidSearch) Error

func (e ErrInvalidSearch) Error() string

type ErrMissingFlag

type ErrMissingFlag struct {
	FlagName string
}

ErrMissingFlag ...

func (ErrMissingFlag) Error

func (e ErrMissingFlag) Error() string

type ErrSnapshotNotFound

type ErrSnapshotNotFound struct {
	Name string
}

ErrSnapshotNotFound ...

func (ErrSnapshotNotFound) Error

func (e ErrSnapshotNotFound) Error() string

type ErrVolSetNotFound

type ErrVolSetNotFound struct {
	Name string
}

ErrVolSetNotFound ...

func (ErrVolSetNotFound) Error

func (e ErrVolSetNotFound) Error() string

type ErrVolumeNotFound

type ErrVolumeNotFound struct {
	Name string
}

ErrVolumeNotFound ...

func (ErrVolumeNotFound) Error

func (e ErrVolumeNotFound) Error() string

type Handler

type Handler struct {
	CfgParams      ConfigParams
	ConfigFile     string
	MdsPathCurrent string
	MdsPathInitial string

	FliLogFile string
	// contains filtered or unexported fields
}

Handler ...

func NewHandler

func NewHandler(params ConfigParams, cfgFile, mdsCurr, mdsInit string) *Handler

NewHandler ...

func (*Handler) Clone

func (c *Handler) Clone(attributes string, full bool, args []string) (Result, error)

Clone create a volume from source which could be a snapshot or a branch if more than 1 match found for branch & snapshot together should return the matching result found

func (*Handler) Config

func (c *Handler) Config(url string, token string, offline bool, args []string) (Result, error)

Config ...

func (*Handler) Create

func (c *Handler) Create(attributes string, full bool, args []string) (Result, error)

Create ...

func (*Handler) Diagnostics

func (c *Handler) Diagnostics(args []string) (Result, error)

Diagnostics ...

func (*Handler) Fetch

func (c *Handler) Fetch(url string, token string, all bool, full bool, args []string) (Result, error)

Fetch ...

func (*Handler) Info

func (c *Handler) Info(args []string) (Result, error)

Info ...

func (*Handler) Init

func (c *Handler) Init(attributes string, description string, args []string) (Result, error)

Init ...

func (*Handler) List

func (c *Handler) List(
	all bool,
	volumeFlag bool,
	snapshotFlag bool,
	branchFlag bool,
	full bool,
	args []string,
) (Result, error)

List ...

func (*Handler) Pull

func (c *Handler) Pull(url string, token string, full bool, args []string) (Result, error)

Pull ...

func (*Handler) Push

func (c *Handler) Push(url string, token string, full bool, args []string) (Result, error)

Push ...

func (*Handler) Remove

func (c *Handler) Remove(full bool, args []string) (Result, error)

Remove ...

func (*Handler) Setup

func (c *Handler) Setup(zpool string, force bool, args []string) (Result, error)

Setup is called when fli is setting up the system

func (*Handler) Snapshot

func (c *Handler) Snapshot(branchName string, newBranch bool, attributes string, description string, full bool, args []string) (Result, error)

Snapshot ...

func (*Handler) Sync

func (c *Handler) Sync(url string, token string, all bool, full bool, args []string) (Result, error)

Sync ...

func (*Handler) Update

func (c *Handler) Update(name string, attributes string, description string, full bool, args []string) (Result, error)

Update ...

func (*Handler) Version

func (c *Handler) Version(args []string) (Result, error)

Version ...

type ListResult

type ListResult struct {
	// contains filtered or unexported fields
}

ListResult represent the result from list command.

func (ListResult) JSON

func (r ListResult) JSON() string

JSON translates the list result to JSON string.

func (ListResult) String

func (r ListResult) String() string

type Result

type Result interface {
	// String turns result into regular human readable string.
	String() string
	// JSON turns result into JSON string.
	JSON() string
}

Result interfaces the cmd output of each of the handlers. Each of the handlers should write their own cmd output format and should be able to output it as string or JSON string.

Jump to

Keyboard shortcuts

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