config

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2015 License: MIT Imports: 13 Imported by: 17

Documentation

Index

Constants

View Source
const (
	DefaultTTL = 60
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	// ID is used for ordering and conflict resolution.
	// Usualy set to time.Now().UnixNano()
	Name string `redis:"name"`
	// contains filtered or unexported fields
}

func NewAppConfig

func NewAppConfig(app, version string) *AppConfig

func NewAppConfigWithEnv

func NewAppConfigWithEnv(app, version string, env map[string]string) *AppConfig

func (*AppConfig) AddPort

func (s *AppConfig) AddPort(port, portType string)

func (*AppConfig) ClearPorts

func (s *AppConfig) ClearPorts()

func (*AppConfig) ContainerName

func (s *AppConfig) ContainerName() string

func (*AppConfig) Env

func (s *AppConfig) Env() map[string]string

Env returns a map representing the runtime environment for the container. Changes to this map have no effect.

func (*AppConfig) EnvGet

func (s *AppConfig) EnvGet(key string) string

func (*AppConfig) EnvSet

func (s *AppConfig) EnvSet(key, value string)

func (*AppConfig) GetCPUShares

func (s *AppConfig) GetCPUShares(pool string) string

func (*AppConfig) GetMemory

func (s *AppConfig) GetMemory(pool string) string

func (*AppConfig) GetProcesses

func (s *AppConfig) GetProcesses(pool string) int

func (*AppConfig) ID

func (s *AppConfig) ID() int64

func (*AppConfig) Ports

func (s *AppConfig) Ports() map[string]string

func (*AppConfig) RuntimePools

func (s *AppConfig) RuntimePools() []string

func (*AppConfig) SetCPUShares

func (s *AppConfig) SetCPUShares(pool string, cpu string)

func (*AppConfig) SetMemory

func (s *AppConfig) SetMemory(pool string, mem string)

func (*AppConfig) SetProcesses

func (s *AppConfig) SetProcesses(pool string, count int)

func (*AppConfig) SetVersion

func (s *AppConfig) SetVersion(version string)

func (*AppConfig) SetVersionID

func (s *AppConfig) SetVersionID(versionID string)

func (*AppConfig) Version

func (s *AppConfig) Version() string

func (*AppConfig) VersionID

func (s *AppConfig) VersionID() string

type Backend

type Backend interface {
	// Apps
	AppExists(app, env string) (bool, error)
	CreateApp(app, env string) (bool, error)
	ListApps(env string) ([]*AppConfig, error)
	GetApp(app, env string) (*AppConfig, error)
	UpdateApp(svcCfg *AppConfig, env string) (bool, error)
	DeleteApp(svcCfg *AppConfig, env string) (bool, error)

	// Pools
	AssignApp(app, env, pool string) (bool, error)
	UnassignApp(app, env, pool string) (bool, error)
	ListAssignments(env, pool string) ([]string, error)
	CreatePool(env, pool string) (bool, error)
	DeletePool(env, pool string) (bool, error)
	ListPools(env string) ([]string, error)

	// Envs
	ListEnvs() ([]string, error)

	// Host
	UpdateHost(env, pool string, host HostInfo) error
	ListHosts(env, pool string) ([]HostInfo, error)
	DeleteHost(env, pool string, host HostInfo) error

	//Pub/Sub
	Subscribe(key string) chan string
	Notify(key, value string) (int, error)

	Connect()
	Reconnect()
}

type ConfigChange

type ConfigChange struct {
	AppConfig *AppConfig
	Restart   bool
	Error     error
}

type HostInfo

type HostInfo struct {
	HostIP string
}

type MemoryBackend

type MemoryBackend struct {
	AppExistsFunc       func(app, env string) (bool, error)
	CreateAppFunc       func(app, env string) (bool, error)
	GetAppFunc          func(app, env string) (*AppConfig, error)
	UpdateAppFunc       func(svcCfg *AppConfig, env string) (bool, error)
	DeleteAppFunc       func(svcCfg *AppConfig, env string) (bool, error)
	ListAppFunc         func(env string) ([]AppConfig, error)
	AssignAppFunc       func(app, env, pool string) (bool, error)
	UnassignAppFunc     func(app, env, pool string) (bool, error)
	ListAssignmentsFunc func(env, pool string) ([]string, error)
	CreatePoolFunc      func(env, pool string) (bool, error)
	DeletePoolFunc      func(env, pool string) (bool, error)
	ListPoolsFunc       func(env string) ([]string, error)
	ListEnvsFunc        func() ([]string, error)
	ListHostsFunc       func(env, pool string) ([]HostInfo, error)

	MembersFunc      func(key string) ([]string, error)
	KeysFunc         func(key string) ([]string, error)
	AddMemberFunc    func(key, value string) (int, error)
	RemoveMemberFunc func(key, value string) (int, error)
	NotifyFunc       func(key, value string) (int, error)
	SetMultiFunc     func(key string, values map[string]string) (string, error)
	// contains filtered or unexported fields
}

func NewMemoryBackend

func NewMemoryBackend() *MemoryBackend

func (*MemoryBackend) AddMember

func (r *MemoryBackend) AddMember(key, value string) (int, error)

func (*MemoryBackend) AppExists

func (r *MemoryBackend) AppExists(app, env string) (bool, error)

func (*MemoryBackend) AssignApp

func (r *MemoryBackend) AssignApp(app, env, pool string) (bool, error)

func (*MemoryBackend) Connect

func (r *MemoryBackend) Connect()

func (*MemoryBackend) CreateApp

func (r *MemoryBackend) CreateApp(app, env string) (bool, error)

func (*MemoryBackend) CreatePool

func (r *MemoryBackend) CreatePool(env, pool string) (bool, error)

func (*MemoryBackend) Delete

func (r *MemoryBackend) Delete(key string) (int, error)

func (*MemoryBackend) DeleteApp

func (r *MemoryBackend) DeleteApp(svcCfg *AppConfig, env string) (bool, error)

func (*MemoryBackend) DeleteHost

func (r *MemoryBackend) DeleteHost(env, pool string, host HostInfo) error

func (*MemoryBackend) DeleteMulti

func (r *MemoryBackend) DeleteMulti(key string, fields ...string) (int, error)

func (*MemoryBackend) DeletePool

func (r *MemoryBackend) DeletePool(env, pool string) (bool, error)

func (*MemoryBackend) Expire

func (r *MemoryBackend) Expire(key string, ttl uint64) (int, error)

func (*MemoryBackend) Get

func (r *MemoryBackend) Get(key, field string) (string, error)

func (*MemoryBackend) GetAll

func (r *MemoryBackend) GetAll(key string) (map[string]string, error)

func (*MemoryBackend) GetApp

func (r *MemoryBackend) GetApp(app, env string) (*AppConfig, error)

func (*MemoryBackend) Keys

func (r *MemoryBackend) Keys(key string) ([]string, error)

func (*MemoryBackend) ListApps

func (r *MemoryBackend) ListApps(env string) ([]*AppConfig, error)

func (*MemoryBackend) ListAssignments

func (r *MemoryBackend) ListAssignments(env, pool string) ([]string, error)

func (*MemoryBackend) ListEnvs

func (r *MemoryBackend) ListEnvs() ([]string, error)

func (*MemoryBackend) ListHosts

func (r *MemoryBackend) ListHosts(env, pool string) ([]HostInfo, error)

func (*MemoryBackend) ListPools

func (r *MemoryBackend) ListPools(env string) ([]string, error)

func (*MemoryBackend) Members

func (r *MemoryBackend) Members(key string) ([]string, error)

func (*MemoryBackend) Notify

func (r *MemoryBackend) Notify(key, value string) (int, error)

func (*MemoryBackend) Reconnect

func (r *MemoryBackend) Reconnect()

func (*MemoryBackend) RemoveMember

func (r *MemoryBackend) RemoveMember(key, value string) (int, error)

func (*MemoryBackend) Set

func (r *MemoryBackend) Set(key, field string, value string) (string, error)

func (*MemoryBackend) SetMulti

func (r *MemoryBackend) SetMulti(key string, values map[string]string) (string, error)

func (*MemoryBackend) Subscribe

func (r *MemoryBackend) Subscribe(key string) chan string

func (*MemoryBackend) Ttl

func (r *MemoryBackend) Ttl(key string) (int, error)

func (*MemoryBackend) UnassignApp

func (r *MemoryBackend) UnassignApp(app, env, pool string) (bool, error)

func (*MemoryBackend) UpdateApp

func (r *MemoryBackend) UpdateApp(svcCfg *AppConfig, env string) (bool, error)

func (*MemoryBackend) UpdateHost

func (r *MemoryBackend) UpdateHost(env, pool string, host HostInfo) error

type RedisBackend

type RedisBackend struct {
	RedisHost string
	// contains filtered or unexported fields
}

func (*RedisBackend) AddMember

func (r *RedisBackend) AddMember(key, value string) (int, error)

func (*RedisBackend) AppExists

func (r *RedisBackend) AppExists(app, env string) (bool, error)

func (*RedisBackend) AssignApp

func (r *RedisBackend) AssignApp(app, env, pool string) (bool, error)

func (*RedisBackend) Connect

func (r *RedisBackend) Connect()

func (*RedisBackend) CreateApp

func (r *RedisBackend) CreateApp(app, env string) (bool, error)

func (*RedisBackend) CreatePool

func (r *RedisBackend) CreatePool(env, pool string) (bool, error)

func (*RedisBackend) Delete

func (r *RedisBackend) Delete(key string) (int, error)

func (*RedisBackend) DeleteApp

func (r *RedisBackend) DeleteApp(svcCfg *AppConfig, env string) (bool, error)

func (*RedisBackend) DeleteHost

func (r *RedisBackend) DeleteHost(env, pool string, host HostInfo) error

func (*RedisBackend) DeleteMulti

func (r *RedisBackend) DeleteMulti(key string, fields ...string) (int, error)

func (*RedisBackend) DeletePool

func (r *RedisBackend) DeletePool(env, pool string) (bool, error)

func (*RedisBackend) Expire

func (r *RedisBackend) Expire(key string, ttl uint64) (int, error)

func (*RedisBackend) GcVMap

func (r *RedisBackend) GcVMap(key string, vmap *utils.VersionedMap) error

func (*RedisBackend) Get

func (r *RedisBackend) Get(key, field string) (string, error)

func (*RedisBackend) GetAll

func (r *RedisBackend) GetAll(key string) (map[string]string, error)

func (*RedisBackend) GetApp

func (r *RedisBackend) GetApp(app, env string) (*AppConfig, error)

func (*RedisBackend) Keys

func (r *RedisBackend) Keys(key string) ([]string, error)

func (*RedisBackend) ListApps

func (r *RedisBackend) ListApps(env string) ([]*AppConfig, error)

func (*RedisBackend) ListAssignments

func (r *RedisBackend) ListAssignments(env, pool string) ([]string, error)

func (*RedisBackend) ListEnvs

func (r *RedisBackend) ListEnvs() ([]string, error)

func (*RedisBackend) ListHosts

func (r *RedisBackend) ListHosts(env, pool string) ([]HostInfo, error)

func (*RedisBackend) ListPools

func (r *RedisBackend) ListPools(env string) ([]string, error)

func (*RedisBackend) LoadVMap

func (r *RedisBackend) LoadVMap(key string, dest *utils.VersionedMap) error

func (*RedisBackend) Members

func (r *RedisBackend) Members(key string) ([]string, error)

func (*RedisBackend) Notify

func (r *RedisBackend) Notify(key, value string) (int, error)

func (*RedisBackend) Reconnect

func (r *RedisBackend) Reconnect()

func (*RedisBackend) RemoveMember

func (r *RedisBackend) RemoveMember(key, value string) (int, error)

func (*RedisBackend) SaveVMap

func (r *RedisBackend) SaveVMap(key string, vmap *utils.VersionedMap) error

func (*RedisBackend) Set

func (r *RedisBackend) Set(key, field string, value string) (string, error)

func (*RedisBackend) SetMulti

func (r *RedisBackend) SetMulti(key string, values map[string]string) (string, error)

func (*RedisBackend) Subscribe

func (r *RedisBackend) Subscribe(key string) chan string

func (*RedisBackend) Ttl

func (r *RedisBackend) Ttl(key string) (int, error)

func (*RedisBackend) UnassignApp

func (r *RedisBackend) UnassignApp(app, env, pool string) (bool, error)

func (*RedisBackend) UpdateApp

func (r *RedisBackend) UpdateApp(svcCfg *AppConfig, env string) (bool, error)

func (*RedisBackend) UpdateHost

func (r *RedisBackend) UpdateHost(env, pool string, host HostInfo) error

type Store

type Store struct {
	Backend      Backend
	Hostname     string
	TTL          uint64
	OutputBuffer *utils.OutputBuffer
	// contains filtered or unexported fields
}

func NewStore

func NewStore(ttl uint64) *Store

func (*Store) AppExists

func (r *Store) AppExists(app, env string) (bool, error)

func (*Store) AssignApp

func (r *Store) AssignApp(app, env, pool string) (bool, error)

func (*Store) CheckForChangesNow

func (r *Store) CheckForChangesNow()

func (*Store) Connect

func (r *Store) Connect(registryURL string)

Build the Redis Pool

func (*Store) CreateApp

func (r *Store) CreateApp(app, env string) (bool, error)

func (*Store) CreatePool

func (r *Store) CreatePool(name, env string) (bool, error)

func (*Store) DeleteApp

func (r *Store) DeleteApp(app, env string) (bool, error)

func (*Store) DeleteHost

func (r *Store) DeleteHost(env, pool string, host HostInfo) error

func (*Store) DeletePool

func (r *Store) DeletePool(pool, env string) (bool, error)

func (*Store) GetApp

func (r *Store) GetApp(app, env string) (*AppConfig, error)

func (*Store) ListApps

func (r *Store) ListApps(env string) ([]*AppConfig, error)

func (*Store) ListAssignedPools

func (r *Store) ListAssignedPools(env, app string) ([]string, error)

func (*Store) ListAssignments

func (r *Store) ListAssignments(env, pool string) ([]string, error)

func (*Store) ListEnvs

func (r *Store) ListEnvs() ([]string, error)

func (*Store) ListHosts

func (r *Store) ListHosts(env, pool string) ([]HostInfo, error)

func (*Store) ListPools

func (r *Store) ListPools(env string) ([]string, error)

func (*Store) NotifyEnvChanged

func (r *Store) NotifyEnvChanged(env string) error

func (*Store) NotifyRestart

func (r *Store) NotifyRestart(app, env string) error

func (*Store) PoolExists

func (r *Store) PoolExists(env, pool string) (bool, error)

func (*Store) UnassignApp

func (r *Store) UnassignApp(app, env, pool string) (bool, error)

func (*Store) UpdateApp

func (r *Store) UpdateApp(svcCfg *AppConfig, env string) (bool, error)

func (*Store) UpdateHost

func (r *Store) UpdateHost(env, pool string, host HostInfo) error

func (*Store) Watch

func (r *Store) Watch(env string, stop chan struct{}) chan *ConfigChange

type Value

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

Jump to

Keyboard shortcuts

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