util

package
v0.11.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2015 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DockerClient *docker.Client

Docker Client initialization

View Source
var (
	ErrMergeParameters = errors.New("parameters are not pointers to struct")
)
View Source
var MaxHead = 100

Maximum entries in the HEAD file

Functions

func AutoMagic

func AutoMagic(cNum int, typ string, newCont bool) int

AutoMagic will return the highest container number which would represent the most recent container to work on unless newCont == true in which case it would return the highest container number plus one.

func ChainContainerFullNames

func ChainContainerFullNames(running bool) []string

func ChainContainerNames

func ChainContainerNames(running bool) []string

func ChainContainersName

func ChainContainersName(name string, number int) string

func ChainToDataContainer

func ChainToDataContainer(chainContainerName string) string

func ChainsPathChecker added in v0.10.3

func ChainsPathChecker(name string) (string, error)

func ChangeDirectory added in v0.10.2

func ChangeDirectory()

func ChangeHead

func ChangeHead(name string) error

Add a new entry (name) to the top of the HEAD file Expects the chain type and head (id) to be full (already resolved)

func CheckDockerClient

func CheckDockerClient() error

func CheckGitAndGo added in v0.10.2

func CheckGitAndGo(git, gO bool)

func CheckoutBranch added in v0.10.2

func CheckoutBranch(branch string)

func Clean

func Clean(prompt, all, rmd, images bool) error

func ContainersName

func ContainersName(typ, name string, number int) string

func ContainersNumber

func ContainersNumber(containerName string) int

func ContainersShortName

func ContainersShortName(containerName string) string

func ContainersType

func ContainersType(containerName string) string

func DataContainerFullNames

func DataContainerFullNames() []string

func DataContainerNames

func DataContainerNames() []string

func DataContainerToChain

func DataContainerToChain(dataContainerName string) string

func DataContainerToService

func DataContainerToService(dataContainerName string) string

func DataContainersName

func DataContainersName(name string, number int) string

func DockerAPIVersion

func DockerAPIVersion() (float64, error)

func DockerClientVersion

func DockerClientVersion() (float64, error)

func DockerConnect

func DockerConnect(verbose bool, machName string)

func DoesDirExist

func DoesDirExist(dir string) bool

func Edit

func Edit(conf *viper.Viper, configVals []string) error

func FixDirs

func FixDirs(arg []string) ([]string, error)

$(pwd) doesn't execute properly in golangs subshells; replace it use $eris as a shortcut

func GetFileByNameAndType

func GetFileByNameAndType(typ, name string) string

func GetFromGithub

func GetFromGithub(org, repo, branch, path, fileName string, w io.Writer) error

func GetGlobalLevelConfigFilesByType

func GetGlobalLevelConfigFilesByType(typ string, withExt bool) []string

note this function fails silently.

func GetHead

func GetHead() (string, error)

Get the current active chain (top of the HEAD file) Returns chain name

func HowManyContainers

func HowManyContainers(name, typ string, running bool) int

func HowManyContainersExisting

func HowManyContainersExisting(name, typ string) int

func HowManyContainersRunning

func HowManyContainersRunning(name, typ string) int

func InstallEris added in v0.10.2

func InstallEris()

func IsChainContainer

func IsChainContainer(name string, number int, running bool) bool

func IsDataContainer

func IsDataContainer(name string, number int) bool

func IsKnownChain

func IsKnownChain(name string) bool

check if given chain is known

func IsServiceContainer

func IsServiceContainer(name string, number int, running bool) bool

TODO: populate the ContainerID during this portion of the general sequence

func Labels

func Labels(name string, ops *def.Operation) map[string]string

Labels returns a map with container labels, based on the container short name and ops settings.

ops.SrvContainerName  - container name
ops.ContainerNumber   - container number
ops.ContainerType     - container type

func ListAll

func ListAll(do *definitions.Do, typ string) (err error)

func ListKnown

func ListKnown(typ string) (result string, err error)

looks for definition files in ~/.eris/typ

func ListRunningOrExisting

func ListRunningOrExisting(quiet, testing, existing bool, typ string) (result string, err error)

lists the containers running for a chain/service [zr] eventually remotes/actions

func Merge

func Merge(base, over interface{}) error

Merge replaces blank fields of base with those from over; also merges maps and slices of both. Base and over are pointers to structs. The result is stored in base. Merge returns ErrMergeParameters if either base or over are not pointers to structs.

func Migrate

func Migrate(dirsToMigrate map[string]string) error

func MigrateDeprecatedDirs

func MigrateDeprecatedDirs(dirsToMigrate map[string]string, prompt bool) error

XXX this command absolutely needs a good test!!

func MoveOutOfDirAndRmDir added in v0.10.3

func MoveOutOfDirAndRmDir(src, dest string) error

func NameAndNumber

func NameAndNumber(name string, num int) string

here temporarily

func NullHead

func NullHead() error

Change the head to null (no head)

func ParseContainers

func ParseContainers(name string, all bool) (docker.APIContainers, bool)

XXX moved from /perform/docker_run.go

func ParseDependency added in v0.10.2

func ParseDependency(nameAndOpts string) (name, internalName string, link, mount bool)

Parse dependencies for internalName (ie. in /etc/hosts), whether to link, and whether to mount volumes-from eg. `tinydns:tiny:l` to link to the tinydns container as tiny

func PortAndProtocol added in v0.10.2

func PortAndProtocol(port string) docker.Port

func PrintInspectionReport

func PrintInspectionReport(cont *docker.Container, field string) error

func PrintLineByContainerID

func PrintLineByContainerID(containerID string, existing bool) ([]string, error)

func PrintLineByContainerName

func PrintLineByContainerName(containerName string, existing bool) ([]string, error)

func PrintPortMappings

func PrintPortMappings(id string, ports []string) error

func PrintTableReport

func PrintTableReport(typ string, existing, all bool) (string, error)

func PullBranch added in v0.10.2

func PullBranch(branch string)

func ServiceContainerFullNames

func ServiceContainerFullNames(running bool) []string

func ServiceContainerNames

func ServiceContainerNames(running bool) []string

func ServiceContainersName

func ServiceContainersName(name string, number int) string

func ServiceToDataContainer

func ServiceToDataContainer(serviceContainerName string) string

func SetLabel

func SetLabel(labels map[string]string, name, value string) map[string]string

SetLabel returns a labels map with additional label name and value.

func Tar

func Tar(path string, compression archive.Compression) (io.ReadCloser, error)

these were in writers.go but that got moved to /ipfs

func Untar

func Untar(reader io.Reader, name, dest string) error

func UpdateEris added in v0.10.2

func UpdateEris(branch string)

Types

type ContainerName

type ContainerName struct {
	FullName    string
	DockersName string
	ShortName   string
	Number      int
	Type        string
	ContainerID string
}

func ChainContainers

func ChainContainers(running bool) []*ContainerName

func ContainerAssemble

func ContainerAssemble(typ, name string, number int) *ContainerName

func ContainerDisassemble

func ContainerDisassemble(containerName string) *ContainerName

func DataContainers

func DataContainers() []*ContainerName

func ErisContainersByType

func ErisContainersByType(typ string, running bool) []*ContainerName

func FindChainContainer

func FindChainContainer(name string, number int, running bool) *ContainerName

func FindDataContainer

func FindDataContainer(name string, number int) *ContainerName

func FindServiceContainer

func FindServiceContainer(srvName string, number int, running bool) *ContainerName

func ServiceContainers

func ServiceContainers(running bool) []*ContainerName

type Parts

type Parts struct {
	ShortName   string //known & existing & running
	Type        string
	Running     bool
	FullName    string
	Number      int
	PortsOutput string
}

currently only used by `eris ls, eris services/chains ls` flags for listing functions do things their own way -> prevents testing clusterf*ck [zr] should struct be implemented throughout?

func AssembleTable

func AssembleTable(typ string) ([]Parts, error)

XXX test with multiple containers of same definition!

Jump to

Keyboard shortcuts

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