common

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VolumeTable    = "volumes"
	NameKey        = "name"
	FsKey          = "filesystem"
	PersistenceKey = "persistence_mode"
	ConnKey        = "connections"
	UpdateKey      = "updated_at"
	DatabaseFile   = ".clientdb"
)

Variables

View Source
var (
	OS         ISystem
	FileReader ReadFile
)

Binding this to an exported function for mocking purposes in tests

Functions

func ExecC

func ExecC(name string, arg ...string) *exec.Cmd

func PanicErr

func PanicErr(err error)

func PrepareDB

func PrepareDB()

Types

type ISystem

type ISystem interface {
	Lstat(string) (os.FileInfo, error)
	Stat(string) (os.FileInfo, error)
	IsNotExist(error) bool
	MkdirAll(string, os.FileMode) error
}

"OS" interface to allow for mocking purposes in tests If more OS functions are needed, just add them to this interface and the concrete implementation

type ReadFile

type ReadFile func(f string) ([]byte, error)

type System

type System struct {
}

Concrete OS impelmentation

func (System) IsNotExist

func (s System) IsNotExist(e error) bool

func (System) Lstat

func (s System) Lstat(f string) (os.FileInfo, error)

func (System) MkdirAll

func (s System) MkdirAll(f string, o os.FileMode) error

func (System) Stat

func (s System) Stat(f string) (os.FileInfo, error)

type VolObj

type VolObj struct {
	Name        string
	Filesystem  string
	Connections int
	Persistence string
	UpdatedAt   string
}

func UpsertVolObj

func UpsertVolObj(name, filesystem string, connections int, persistence string) *VolObj

func (*VolObj) AddConnection

func (v *VolObj) AddConnection() error

func (*VolObj) DelConnection

func (v *VolObj) DelConnection() error

func (*VolObj) ResetConnections

func (v *VolObj) ResetConnections() error

Jump to

Keyboard shortcuts

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