consul

package
v0.0.0-...-e98e7c4 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2015 License: Apache-2.0 Imports: 6 Imported by: 4

Documentation

Overview

package consul deals with syncing Marathon apps and tasks to Consul.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapApps

func MapApps(source []*apps.App) map[string]*api.KVPair

func MapKVPairs

func MapKVPairs(source api.KVPairs) map[string]*api.KVPair

func MapTasks

func MapTasks(source []*tasks.Task) map[string]*api.KVPair

func WithPrefix

func WithPrefix(prefix, key string) string

func WithoutPrefix

func WithoutPrefix(prefix, key string) string

Types

type Consul

type Consul struct {
	AppsPrefix string
	// contains filtered or unexported fields
}

func NewConsul

func NewConsul(kv KVer, prefix string) Consul

func (*Consul) DeleteApp

func (consul *Consul) DeleteApp(app *apps.App) error

DeleteApp takes an App and deletes it from Consul

func (*Consul) DeleteTask

func (consul *Consul) DeleteTask(task *tasks.Task) error

DeleteTask taske a Task and deletes it from Consul

func (*Consul) SyncApps

func (consul *Consul) SyncApps(apps []*apps.App) error

SyncApps takes a *complete* list of apps from Marathon and compares them against the apps in Consul. It performs any necessary updates, then recursively deletes any apps that are present in Consul but not the given list.

func (*Consul) SyncTasks

func (consul *Consul) SyncTasks(appId string, tasks []*tasks.Task) error

SyncTasks takes a *complete* list of tasks from a Marathon App and compares them against the tasks in Consul. It performs any necessary updates, then deletes any tasks that are present in Consul but not the list.

func (*Consul) UpdateApp

func (consul *Consul) UpdateApp(app *apps.App) error

UpdateApp takes an App and updates it in Consul

func (*Consul) UpdateTask

func (consul *Consul) UpdateTask(task *tasks.Task) error

UpdateTask takes a Task and updates it in Consul

type Deleter

type Deleter interface {
	Delete(string) (*api.WriteMeta, error)
}

type Getter

type Getter interface {
	Get(string) (*api.KVPair, *api.QueryMeta, error)
}

type KV

type KV struct {
	WriteOptions *api.WriteOptions
	QueryOptions *api.QueryOptions
	Prefix       string
	// contains filtered or unexported fields
}

func NewKV

func NewKV(config *api.Config) (*KV, error)

func (KV) Delete

func (kv KV) Delete(key string) (*api.WriteMeta, error)

func (KV) Get

func (kv KV) Get(key string) (*api.KVPair, *api.QueryMeta, error)

func (KV) List

func (kv KV) List(key string) (api.KVPairs, *api.QueryMeta, error)

func (KV) Put

func (kv KV) Put(pair *api.KVPair) (*api.WriteMeta, error)

type KVer

type KVer interface {
	Getter
	Lister
	Putter
	Deleter
}

type Lister

type Lister interface {
	List(string) (api.KVPairs, *api.QueryMeta, error)
}

type Putter

type Putter interface {
	Put(*api.KVPair) (*api.WriteMeta, error)
}

Jump to

Keyboard shortcuts

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