hook

package
v0.0.0-...-1c24e5a Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2015 License: GPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DOCKER_START   = "start"
	DOCKER_DIE     = "die"
	DOCKER_CREATED = "created"
	DOCKER_DESTROY = "destroy"
)
View Source
const (
	HOOK_KEYS = "KEYS"
	HOOK_FILE = "FILE"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigHook

type ConfigHook interface {
	// close down any resources
	Close()
}

func NewConfigHook

func NewConfigHook() (ConfigHook, error)

type ConfigHookService

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

func (*ConfigHookService) Close

func (r *ConfigHookService) Close()

type DockerEvent

type DockerEvent chan string

type DockerService

type DockerService struct {
	sync.RWMutex
	sync.Once
	// contains filtered or unexported fields
}

The implementation of the above

func (*DockerService) Close

func (r *DockerService) Close()

func (*DockerService) Environment

func (r *DockerService) Environment(containerId string) (map[string]string, error)

func (*DockerService) GetFile

func (r *DockerService) GetFile(containerID, filename string) (string, error)

func (*DockerService) HasFile

func (r *DockerService) HasFile(containerID, filename string) (bool, error)

func (*DockerService) List

func (r *DockerService) List() ([]string, error)

Retrieve a listing of the containers

func (*DockerService) Watch

func (r *DockerService) Watch(channel DockerEvent, event string)

type DockerStore

type DockerStore interface {
	// retrieve the contents of a file in a container
	GetFile(containerID, filename string) (string, error)
	// Get a listing of containers
	List() ([]string, error)
	// watch for docker events
	Watch(channel DockerEvent, event_type string)
	// retrieve the environment variables for a container
	Environment(containerID string) (map[string]string, error)
	// Close down the resources
	Close()
}

The interface to docker

func NewDockerStore

func NewDockerStore() (DockerStore, error)

type HookExec

type HookExec struct {
	// the last time the exec was ran
	LastRun time.Time
	// the last exit code
	LastExitCode int
	// the exec command which should be run
	Exec string `json:"command"`
	// the check command which should be performed before hand
	Check string `json:"check"`
}

func (HookExec) String

func (r HookExec) String() string

type HookFile

type HookFile struct {
	// the id which is associated to the config
	ID string `json:"id"`
	// the file which holds the content
	File string `json:"file"`
	// the key which this file should be stored at
	Key string `json:"key"`
	// the exec which should be run when content changed
	Exec *HookExec `json:"exec"`
	// the flags associated to the config
	Flags string `json:"flags"`
}

func NewHookFile

func NewHookFile(id string) *HookFile

func (*HookFile) Set

func (r *HookFile) Set(element string, value interface{})

func (HookFile) String

func (r HookFile) String() string

func (HookFile) Valid

func (r HookFile) Valid() error

type HookKeys

type HookKeys struct {
	// the id which is associated to the keys
	ID string `json:"id"`
	// the file which holds the content
	File string `json:"file"`
	// the flags associated to the config
	Flags string `json:"flags"`
}

func NewHookKeys

func NewHookKeys(id string) *HookKeys

func (HookKeys) String

func (r HookKeys) String() string

func (HookKeys) Valid

func (r HookKeys) Valid() (bool, error)

type HookParser

type HookParser interface {
	// parser the hook key
	ParseKey(key string) (string, string, error)
	// is a config hook
	IsHook(key string) bool
	// check if the config has any hooks
	HasHooks() bool
	// retrieve the files
	Files(name string) *HookFile
	// retrieve the keys
	Keys(name string) *HookKeys
	// validate the hooks
	Validate() error
}

type Hooks

type Hooks struct {
	HookParser
	// contains filtered or unexported fields
}

func NewHooksConfig

func NewHooksConfig() *Hooks

func (*Hooks) Files

func (r *Hooks) Files(id string) *HookFile

func (Hooks) HasHooks

func (r Hooks) HasHooks() bool

func (Hooks) IsHook

func (r Hooks) IsHook(key string) bool

func (*Hooks) Keys

func (r *Hooks) Keys(id string) *HookKeys

func (Hooks) ParseKey

func (r Hooks) ParseKey(key string) (string, string, string, error)

Parses the key and extracts the type, the name and the element if has it

key: 	the config hook key

func (Hooks) String

func (r Hooks) String() string

func (Hooks) Validate

func (r Hooks) Validate() error

type ShutdownChannel

type ShutdownChannel chan bool

Jump to

Keyboard shortcuts

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