src

package
v0.0.0-...-0252857 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2016 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterReloader

func RegisterReloader(name string, reloader Reloader)

func RegisterReloaderFlags

func RegisterReloaderFlags()

func RegisterRenderer

func RegisterRenderer(name string, renderer Renderer)

func RegisterRendererFlags

func RegisterRendererFlags()

Types

type Env

type Env struct {
	// Etcd address
	Etcd *string
	// Directory inside etcd that contains the configuration
	EtcdDir *string
	// Structure that holds the configuration data in memory
	Data map[string]interface{}
	// An instance of a renderer
	Renderer Renderer
	// An instance of a reloader
	Reloader Reloader
}

Env represents all the necessary data the core needs to run

func (*Env) BuildData

func (env *Env) BuildData(node client.Node, prefix string, data map[string]interface{})

Taking a etcd node and a prefix, updates the in memory data. If the etcd node represents a nested directory, this function calls recursively with the new prefix, trying to create a tree structure in memory.

func (*Env) Cycle

func (env *Env) Cycle()

Cycles the rails environemnt, by rendering a new configuration file and reloading the Rails processes. Uses the existing renderer and reloader instances.

func (*Env) NakedKey

func (env *Env) NakedKey(key string, prefix string) string

Removes the prefix from a key, including trailing slashes

func (*Env) UpdateData

func (env *Env) UpdateData(parts []string, value string, action string, data map[string]interface{})

Updates the data from an etcd watch update. Takes into consideration the type of action (set or delete) and navigates through the parts until if finds the correct node to update.

type Reloader

type Reloader interface {
	Reload()
	RegisterFlags()
}

func OpenReloader

func OpenReloader(reloaderName string) (Reloader, error)

type Renderer

type Renderer interface {
	Render(env Env)
	RegisterFlags()
}

func OpenRenderer

func OpenRenderer(rendererName string) (Renderer, error)

type TouchReloader

type TouchReloader struct {
	TouchFile *string
}

func (*TouchReloader) RegisterFlags

func (reloader *TouchReloader) RegisterFlags()

func (*TouchReloader) Reload

func (reloader *TouchReloader) Reload()

type Watcher

type Watcher struct {
	EtcdWatcher client.Watcher
}

Watcher is responsible for watching a directory structure on etcd

func (*Watcher) Loop

func (w *Watcher) Loop(ctx context.Context) chan *client.Response

Loop starts the watcher, returning new responses on the returned channel

type YamlRenderer

type YamlRenderer struct {
	YamlFile *string
}

func (*YamlRenderer) RegisterFlags

func (renderer *YamlRenderer) RegisterFlags()

func (*YamlRenderer) Render

func (renderer *YamlRenderer) Render(env Env)

Jump to

Keyboard shortcuts

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