Documentation ¶
Index ¶
- Constants
- Variables
- type App
- type AppAssignment
- type AppConfig
- func (s *AppConfig) AddPort(port, portType string)
- func (s *AppConfig) ClearPorts()
- func (s *AppConfig) ContainerName() string
- func (s *AppConfig) Env() map[string]string
- func (s *AppConfig) EnvGet(key string) string
- func (s *AppConfig) EnvSet(key, value string)
- func (s *AppConfig) GetCPUShares(pool string) string
- func (s *AppConfig) GetMaintenanceMode(pool string) bool
- func (s *AppConfig) GetMemory(pool string) string
- func (s *AppConfig) GetProcesses(pool string) int
- func (s *AppConfig) ID() int64
- func (s *AppConfig) Name() string
- func (s *AppConfig) Ports() map[string]string
- func (s *AppConfig) RuntimePools() []string
- func (s *AppConfig) SetCPUShares(pool string, cpu string)
- func (s *AppConfig) SetMaintenanceMode(pool string, maint bool)
- func (s *AppConfig) SetMemory(pool string, mem string)
- func (s *AppConfig) SetProcesses(pool string, count int)
- func (s *AppConfig) SetVersion(version string)
- func (s *AppConfig) SetVersionID(versionID string)
- func (s *AppConfig) Version() string
- func (s *AppConfig) VersionID() string
- type AppDefinition
- func (a *AppDefinition) ContainerName() string
- func (a *AppDefinition) Env() map[string]string
- func (a *AppDefinition) EnvGet(key string) string
- func (a *AppDefinition) EnvSet(key, value string)
- func (a *AppDefinition) GetCPUShares(pool string) string
- func (a *AppDefinition) GetMaintenanceMode(pool string) bool
- func (a *AppDefinition) GetMemory(pool string) string
- func (a *AppDefinition) GetProcesses(pool string) int
- func (a *AppDefinition) ID() int64
- func (a *AppDefinition) Name() string
- func (a *AppDefinition) RuntimePools() []string
- func (a *AppDefinition) SetCPUShares(pool string, cpu string)
- func (a *AppDefinition) SetMaintenanceMode(pool string, maint bool)
- func (a *AppDefinition) SetMemory(pool string, mem string)
- func (a *AppDefinition) SetProcesses(pool string, count int)
- func (a *AppDefinition) SetVersion(version string)
- func (a *AppDefinition) SetVersionID(versionID string)
- func (a *AppDefinition) Version() string
- func (a *AppDefinition) VersionID() string
- type Backend
- type ConfigChange
- type ConsulBackend
- func (c *ConsulBackend) AppExists(app, env string) (bool, error)
- func (c *ConsulBackend) AssignApp(app, env, pool string) (bool, error)
- func (c *ConsulBackend) CreateApp(app, env string) (bool, error)
- func (c *ConsulBackend) CreatePool(env, pool string) (bool, error)
- func (c *ConsulBackend) DeleteApp(app App, env string) (bool, error)
- func (c *ConsulBackend) DeleteHost(env, pool string, host HostInfo) error
- func (c *ConsulBackend) DeletePool(env, pool string) (bool, error)
- func (c *ConsulBackend) GetApp(app, env string) (App, error)
- func (c *ConsulBackend) GetServiceRegistration(env, pool, hostIP, name, containerID string) (*ServiceRegistration, error)
- func (c *ConsulBackend) ListApps(env string) ([]App, error)
- func (c *ConsulBackend) ListAssignments(env, pool string) ([]string, error)
- func (c *ConsulBackend) ListEnvs() ([]string, error)
- func (c *ConsulBackend) ListHosts(env, pool string) ([]HostInfo, error)
- func (c *ConsulBackend) ListPools(env string) ([]string, error)
- func (c *ConsulBackend) ListRegistrations(env string) ([]ServiceRegistration, error)
- func (c *ConsulBackend) Notify(key, value string) (int, error)
- func (c *ConsulBackend) RegisterService(env, pool string, reg *ServiceRegistration) error
- func (c *ConsulBackend) Subscribe(key string) chan string
- func (c *ConsulBackend) UnassignApp(app, env, pool string) (bool, error)
- func (c *ConsulBackend) UnregisterService(env, pool, hostIP, name, containerID string) (*ServiceRegistration, error)
- func (c *ConsulBackend) UpdateApp(app App, env string) (bool, error)
- func (c *ConsulBackend) UpdateHost(env, pool string, host HostInfo) error
- type HostInfo
- type HostsEntry
- type MemoryBackend
- func (r *MemoryBackend) AddMember(key, value string) (int, error)
- func (r *MemoryBackend) AppExists(app, env string) (bool, error)
- func (r *MemoryBackend) AssignApp(app, env, pool string) (bool, error)
- func (r *MemoryBackend) CreateApp(app, env string) (bool, error)
- func (r *MemoryBackend) CreatePool(env, pool string) (bool, error)
- func (r *MemoryBackend) Delete(key string) (int, error)
- func (r *MemoryBackend) DeleteApp(svcCfg App, env string) (bool, error)
- func (r *MemoryBackend) DeleteHost(env, pool string, host HostInfo) error
- func (r *MemoryBackend) DeleteMulti(key string, fields ...string) (int, error)
- func (r *MemoryBackend) DeletePool(env, pool string) (bool, error)
- func (r *MemoryBackend) Expire(key string, ttl uint64) (int, error)
- func (r *MemoryBackend) Get(key, field string) (string, error)
- func (r *MemoryBackend) GetAll(key string) (map[string]string, error)
- func (r *MemoryBackend) GetApp(app, env string) (App, error)
- func (r *MemoryBackend) GetServiceRegistration(env, pool, hostIP, name, containerID string) (*ServiceRegistration, error)
- func (r *MemoryBackend) Keys(key string) ([]string, error)
- func (r *MemoryBackend) ListApps(env string) ([]App, error)
- func (r *MemoryBackend) ListAssignments(env, pool string) ([]string, error)
- func (r *MemoryBackend) ListEnvs() ([]string, error)
- func (r *MemoryBackend) ListHosts(env, pool string) ([]HostInfo, error)
- func (r *MemoryBackend) ListPools(env string) ([]string, error)
- func (r *MemoryBackend) ListRegistrations(env string) ([]ServiceRegistration, error)
- func (r *MemoryBackend) Members(key string) ([]string, error)
- func (r *MemoryBackend) Notify(key, value string) (int, error)
- func (r *MemoryBackend) RegisterService(env, pool string, reg *ServiceRegistration) error
- func (r *MemoryBackend) RemoveMember(key, value string) (int, error)
- func (r *MemoryBackend) Set(key, field string, value string) (string, error)
- func (r *MemoryBackend) SetMulti(key string, values map[string]string) (string, error)
- func (r *MemoryBackend) Subscribe(key string) chan string
- func (r *MemoryBackend) TTL(key string) (int, error)
- func (r *MemoryBackend) UnassignApp(app, env, pool string) (bool, error)
- func (r *MemoryBackend) UnregisterService(env, pool, hostIP, name, containerID string) (*ServiceRegistration, error)
- func (r *MemoryBackend) UpdateApp(svcCfg App, env string) (bool, error)
- func (r *MemoryBackend) UpdateHost(env, pool string, host HostInfo) error
- type PortMapping
- type RedisBackend
- func (r *RedisBackend) AddMember(key, value string) (int, error)
- func (r *RedisBackend) AppExists(app, env string) (bool, error)
- func (r *RedisBackend) AssignApp(app, env, pool string) (bool, error)
- func (r *RedisBackend) CreateApp(app, env string) (bool, error)
- func (r *RedisBackend) CreatePool(env, pool string) (bool, error)
- func (r *RedisBackend) Delete(key string) (int, error)
- func (r *RedisBackend) DeleteApp(svcCfg App, env string) (bool, error)
- func (r *RedisBackend) DeleteHost(env, pool string, host HostInfo) error
- func (r *RedisBackend) DeleteMulti(key string, fields ...string) (int, error)
- func (r *RedisBackend) DeletePool(env, pool string) (bool, error)
- func (r *RedisBackend) Expire(key string, ttl uint64) (int, error)
- func (r *RedisBackend) GcVMap(key string, vmap *utils.VersionedMap) error
- func (r *RedisBackend) Get(key, field string) (string, error)
- func (r *RedisBackend) GetAll(key string) (map[string]string, error)
- func (r *RedisBackend) GetApp(app, env string) (App, error)
- func (r *RedisBackend) GetServiceRegistration(env, pool, hostIP, name, containerID string) (*ServiceRegistration, error)
- func (r *RedisBackend) Keys(key string) ([]string, error)
- func (r *RedisBackend) ListApps(env string) ([]App, error)
- func (r *RedisBackend) ListAssignments(env, pool string) ([]string, error)
- func (r *RedisBackend) ListEnvs() ([]string, error)
- func (r *RedisBackend) ListHosts(env, pool string) ([]HostInfo, error)
- func (r *RedisBackend) ListPools(env string) ([]string, error)
- func (r *RedisBackend) ListRegistrations(env string) ([]ServiceRegistration, error)
- func (r *RedisBackend) LoadVMap(key string, dest *utils.VersionedMap) error
- func (r *RedisBackend) Members(key string) ([]string, error)
- func (r *RedisBackend) Notify(key, value string) (int, error)
- func (r *RedisBackend) RegisterService(env, pool string, reg *ServiceRegistration) error
- func (r *RedisBackend) RemoveMember(key, value string) (int, error)
- func (r *RedisBackend) SaveVMap(key string, vmap *utils.VersionedMap) error
- func (r *RedisBackend) Set(key, field string, value string) (string, error)
- func (r *RedisBackend) SetMulti(key string, values map[string]string) (string, error)
- func (r *RedisBackend) Subscribe(key string) chan string
- func (r *RedisBackend) TTL(key string) (int, error)
- func (r *RedisBackend) UnassignApp(app, env, pool string) (bool, error)
- func (r *RedisBackend) UnregisterService(env, pool, hostIP, name, containerID string) (*ServiceRegistration, error)
- func (r *RedisBackend) UpdateApp(cfg App, env string) (bool, error)
- func (r *RedisBackend) UpdateHost(env, pool string, host HostInfo) error
- type ServiceRegistration
- type Store
- func (s *Store) AppExists(app, env string) (bool, error)
- func (s *Store) AssignApp(app, env, pool string) (bool, error)
- func (s *Store) CheckForChangesNow()
- func (s *Store) CreateApp(app, env string) (bool, error)
- func (s *Store) CreatePool(name, env string) (bool, error)
- func (s *Store) DeleteApp(app, env string) (bool, error)
- func (s *Store) DeleteHost(env, pool string, host HostInfo) error
- func (s *Store) DeletePool(pool, env string) (bool, error)
- func (s *Store) EnvFor(container *docker.Container) map[string]string
- func (s *Store) GetApp(app, env string) (App, error)
- func (s *Store) GetServiceRegistration(env, pool, hostIP string, container *docker.Container) (*ServiceRegistration, error)
- func (s *Store) IsRegistered(env, pool, hostIP string, container *docker.Container) (bool, error)
- func (s *Store) ListApps(env string) ([]App, error)
- func (s *Store) ListAssignedPools(env, app string) ([]string, error)
- func (s *Store) ListAssignments(env, pool string) ([]string, error)
- func (s *Store) ListEnvs() ([]string, error)
- func (s *Store) ListHosts(env, pool string) ([]HostInfo, error)
- func (s *Store) ListPools(env string) ([]string, error)
- func (s *Store) ListRegistrations(env string) ([]ServiceRegistration, error)
- func (s *Store) NewAppConfig(app, version string) App
- func (s *Store) NotifyEnvChanged(env string) error
- func (s *Store) NotifyRestart(app, env string) error
- func (s *Store) PoolExists(env, pool string) (bool, error)
- func (s *Store) RegisterService(env, pool, hostIP string, container *docker.Container) (*ServiceRegistration, error)
- func (s *Store) UnRegisterService(env, pool, hostIP string, container *docker.Container) (*ServiceRegistration, error)
- func (s *Store) UnassignApp(app, env, pool string) (bool, error)
- func (s *Store) UpdateApp(svcCfg App, env string) (bool, error)
- func (s *Store) UpdateHost(env, pool string, host HostInfo) error
- func (s *Store) Watch(env string, stop chan struct{}) chan *ConfigChange
- type Value
Constants ¶
const (
DefaultTTL = 60
)
Variables ¶
var UnknownApp = fmt.Errorf("unkown app")
Functions ¶
This section is empty.
Types ¶
type App ¶ added in v0.6.0
type App interface { Name() string Env() map[string]string EnvSet(key, value string) EnvGet(key string) string Version() string SetVersion(version string) VersionID() string SetVersionID(versionID string) ID() int64 ContainerName() string SetProcesses(pool string, count int) GetProcesses(pool string) int RuntimePools() []string SetMemory(pool string, mem string) GetMemory(pool string) string SetMaintenanceMode(pool string, maint bool) GetMaintenanceMode(pool string) bool }
Interface to wrap AppConfig, so that it can be swapped out with a different Backend. This should be temporary as many of these methods won't be useful.
func NewAppConfig ¶
type AppAssignment ¶ added in v0.7.0
type AppAssignment struct { // We currently only assign to Pools Pool string // Name of assigned App App string // Docker CPU share constraint: 0-1024 // The default is 0, meaning unconstrained. CPU int // Docker Memory limit (<number><optional unit>, where unit = b, k, m or g) Memory string // MemorySwap is the total memory limit (memory + swap, format: // <number><optional unit>, where unit = b, k, m or g) MemorySwap string // Number of instances to run across all hosts in this grouping Instances int // Minimum number of instances to keep running during a deploy or restart. // Default is 1 if Instances is > 1, else 0. MinInstances int // Whether this app is in maintenance mode MaintenanceMode bool }
AppAssignment provides the location and resource limits for an app to run
type AppConfig ¶
type AppConfig struct {
// contains filtered or unexported fields
}
func (*AppConfig) ClearPorts ¶
func (s *AppConfig) ClearPorts()
func (*AppConfig) ContainerName ¶
func (*AppConfig) Env ¶
Env returns a map representing the runtime environment for the container. Changes to this map have no effect.
func (*AppConfig) GetCPUShares ¶
func (*AppConfig) GetMaintenanceMode ¶ added in v0.7.2
func (*AppConfig) GetProcesses ¶
func (*AppConfig) RuntimePools ¶
func (*AppConfig) SetCPUShares ¶
func (*AppConfig) SetMaintenanceMode ¶ added in v0.7.2
func (*AppConfig) SetProcesses ¶
func (*AppConfig) SetVersion ¶
func (*AppConfig) SetVersionID ¶
type AppDefinition ¶ added in v0.7.0
type AppDefinition struct { // Version of this structure in the config storage as of the last operation // In consul, this would correspond to `ModifyIndex`/. The value stored // would be the previous index, and over-written upon retrieval. ConfigIndex int64 // ("Name" is taken by the interface getter) AppName string // Image is the specific docker image to be run. Image string // Docker Image ID // If "Image" does not contain a tag, or uses "latest", we need a way to // know what version we're running. // TODO: how can we handle this case and not have pull every image on the // host that runs app:deploy? ImageID string // PortMappings defines how ports are mapped from the host to the docker // container. PortMappings []PortMapping // Hosts entries to insert into /etc/hosts inside the container Hosts []HostsEntry // A set of custom DNS servers for the container DNS []string // Entry point arguments for the container EntryPoint []string // Command arguments for the container Command []string // The environment passed to the container Environment map[string]string // Resources are assigned per logical group, e.g. Pool // TODO: This seems awkward -- apps don't know about the env they are // assigned to, but they need to know about the pools. // This is needed while refactoring though, as all the resource // limits are assigned through the config, and rely on the pool. Assignments []AppAssignment }
AppDefintiion contains all the configuration needed to run a container in the galaxy environment.
func (*AppDefinition) ContainerName ¶ added in v0.7.0
func (a *AppDefinition) ContainerName() string
func (*AppDefinition) Env ¶ added in v0.7.0
func (a *AppDefinition) Env() map[string]string
func (*AppDefinition) EnvGet ¶ added in v0.7.0
func (a *AppDefinition) EnvGet(key string) string
func (*AppDefinition) EnvSet ¶ added in v0.7.0
func (a *AppDefinition) EnvSet(key, value string)
func (*AppDefinition) GetCPUShares ¶ added in v0.7.0
func (a *AppDefinition) GetCPUShares(pool string) string
func (*AppDefinition) GetMaintenanceMode ¶ added in v0.7.2
func (a *AppDefinition) GetMaintenanceMode(pool string) bool
func (*AppDefinition) GetMemory ¶ added in v0.7.0
func (a *AppDefinition) GetMemory(pool string) string
func (*AppDefinition) GetProcesses ¶ added in v0.7.0
func (a *AppDefinition) GetProcesses(pool string) int
func (*AppDefinition) ID ¶ added in v0.7.0
func (a *AppDefinition) ID() int64
func (*AppDefinition) Name ¶ added in v0.7.0
func (a *AppDefinition) Name() string
func (*AppDefinition) RuntimePools ¶ added in v0.7.0
func (a *AppDefinition) RuntimePools() []string
func (*AppDefinition) SetCPUShares ¶ added in v0.7.0
func (a *AppDefinition) SetCPUShares(pool string, cpu string)
func (*AppDefinition) SetMaintenanceMode ¶ added in v0.7.2
func (a *AppDefinition) SetMaintenanceMode(pool string, maint bool)
func (*AppDefinition) SetMemory ¶ added in v0.7.0
func (a *AppDefinition) SetMemory(pool string, mem string)
func (*AppDefinition) SetProcesses ¶ added in v0.7.0
func (a *AppDefinition) SetProcesses(pool string, count int)
func (*AppDefinition) SetVersion ¶ added in v0.7.0
func (a *AppDefinition) SetVersion(version string)
func (*AppDefinition) SetVersionID ¶ added in v0.7.0
func (a *AppDefinition) SetVersionID(versionID string)
func (*AppDefinition) Version ¶ added in v0.7.0
func (a *AppDefinition) Version() string
func (*AppDefinition) VersionID ¶ added in v0.7.0
func (a *AppDefinition) VersionID() string
type Backend ¶
type Backend interface { // Apps AppExists(app, env string) (bool, error) CreateApp(app, env string) (bool, error) ListApps(env string) ([]App, error) GetApp(app, env string) (App, error) UpdateApp(svcCfg App, env string) (bool, error) DeleteApp(svcCfg App, 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) // Registration RegisterService(env, pool string, reg *ServiceRegistration) error UnregisterService(env, pool, hostIP, name, containerID string) (*ServiceRegistration, error) GetServiceRegistration(env, pool, hostIP, name, containerID string) (*ServiceRegistration, error) ListRegistrations(env string) ([]ServiceRegistration, error) // contains filtered or unexported methods }
type ConfigChange ¶
type ConsulBackend ¶ added in v0.7.0
type ConsulBackend struct {
// contains filtered or unexported fields
}
TODO: logging!
TODO: use CAS operations so that we don't have any races between
configuration changes
The consul tree looks like:
galaxy/apps/env/app_name galaxy/pools/env/pool_name galaxy/hosts/env/pool/host_ip galaxy/services/env/pool/host_ip/service_name/container_id
The Methods for ConsulBackend are tentatively defined here to satisfy the confing.Backend interface, and may not be appropriate
func NewConsulBackend ¶ added in v0.7.0
func NewConsulBackend() *ConsulBackend
func (*ConsulBackend) AppExists ¶ added in v0.7.0
func (c *ConsulBackend) AppExists(app, env string) (bool, error)
Check that an app exists and has a config
func (*ConsulBackend) AssignApp ¶ added in v0.7.0
func (c *ConsulBackend) AssignApp(app, env, pool string) (bool, error)
Add a pool assignment for this app, and update the config. The pool need not exist, it just won't run until there is a corresponding pool.
func (*ConsulBackend) CreateApp ¶ added in v0.7.0
func (c *ConsulBackend) CreateApp(app, env string) (bool, error)
Create and save an empty AppDefinition for a new app
func (*ConsulBackend) CreatePool ¶ added in v0.7.0
func (c *ConsulBackend) CreatePool(env, pool string) (bool, error)
Create a pool entry Pool are just an empty Key/Value pair, to signify that this pool has been purposely created.
func (*ConsulBackend) DeleteApp ¶ added in v0.7.0
func (c *ConsulBackend) DeleteApp(app App, env string) (bool, error)
Delete the configuration for an app FIXME: Why does this take an App? Everything else takes a string
func (*ConsulBackend) DeleteHost ¶ added in v0.7.0
func (c *ConsulBackend) DeleteHost(env, pool string, host HostInfo) error
func (*ConsulBackend) DeletePool ¶ added in v0.7.0
func (c *ConsulBackend) DeletePool(env, pool string) (bool, error)
Delete the pool entry
func (*ConsulBackend) GetApp ¶ added in v0.7.0
func (c *ConsulBackend) GetApp(app, env string) (App, error)
Retrieve the current config for an application
func (*ConsulBackend) GetServiceRegistration ¶ added in v0.7.0
func (c *ConsulBackend) GetServiceRegistration(env, pool, hostIP, name, containerID string) (*ServiceRegistration, error)
func (*ConsulBackend) ListApps ¶ added in v0.7.0
func (c *ConsulBackend) ListApps(env string) ([]App, error)
List all apps in an environment
func (*ConsulBackend) ListAssignments ¶ added in v0.7.0
func (c *ConsulBackend) ListAssignments(env, pool string) ([]string, error)
List apps assigned to a pool
func (*ConsulBackend) ListEnvs ¶ added in v0.7.0
func (c *ConsulBackend) ListEnvs() ([]string, error)
func (*ConsulBackend) ListHosts ¶ added in v0.7.0
func (c *ConsulBackend) ListHosts(env, pool string) ([]HostInfo, error)
func (*ConsulBackend) ListPools ¶ added in v0.7.0
func (c *ConsulBackend) ListPools(env string) ([]string, error)
List all pools in an environment
func (*ConsulBackend) ListRegistrations ¶ added in v0.7.0
func (c *ConsulBackend) ListRegistrations(env string) ([]ServiceRegistration, error)
func (*ConsulBackend) Notify ¶ added in v0.7.0
func (c *ConsulBackend) Notify(key, value string) (int, error)
FIXME: the int return value is useless here, and not used on the redis
backend either.
func (*ConsulBackend) RegisterService ¶ added in v0.7.0
func (c *ConsulBackend) RegisterService(env, pool string, reg *ServiceRegistration) error
Marshal a ServiceRegistry in consul, and associate it with a session so it is deleted on expiration.
func (*ConsulBackend) Subscribe ¶ added in v0.7.0
func (c *ConsulBackend) Subscribe(key string) chan string
func (*ConsulBackend) UnassignApp ¶ added in v0.7.0
func (c *ConsulBackend) UnassignApp(app, env, pool string) (bool, error)
Remove a pool assignment for this app, and update the config
func (*ConsulBackend) UnregisterService ¶ added in v0.7.0
func (c *ConsulBackend) UnregisterService(env, pool, hostIP, name, containerID string) (*ServiceRegistration, error)
TODO: do we need to return a *ServiceRegistration?
func (*ConsulBackend) UpdateApp ¶ added in v0.7.0
func (c *ConsulBackend) UpdateApp(app App, env string) (bool, error)
Update the current configuration for an app
func (*ConsulBackend) UpdateHost ¶ added in v0.7.0
func (c *ConsulBackend) UpdateHost(env, pool string, host HostInfo) error
TODO: We need to keep the hosts entries for now, to easily correlate the
host with the env and pool, and to schedule apps on appropriate hosts. Rename appropriately to reflect that this only adds a host, and there's nothing to update.
type HostsEntry ¶ added in v0.7.0
type MemoryBackend ¶
type MemoryBackend struct { AppExistsFunc func(app, env string) (bool, error) CreateAppFunc func(app, env string) (bool, error) GetAppFunc func(app, env string) (App, error) UpdateAppFunc func(svcCfg App, env string) (bool, error) DeleteAppFunc func(svcCfg App, 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) AssignApp ¶
func (r *MemoryBackend) AssignApp(app, env, pool string) (bool, error)
func (*MemoryBackend) CreatePool ¶
func (r *MemoryBackend) CreatePool(env, pool string) (bool, error)
func (*MemoryBackend) DeleteApp ¶
func (r *MemoryBackend) DeleteApp(svcCfg App, 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) GetAll ¶
func (r *MemoryBackend) GetAll(key string) (map[string]string, error)
func (*MemoryBackend) GetServiceRegistration ¶ added in v0.7.0
func (r *MemoryBackend) GetServiceRegistration(env, pool, hostIP, name, containerID string) (*ServiceRegistration, 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) ListRegistrations ¶ added in v0.7.0
func (r *MemoryBackend) ListRegistrations(env string) ([]ServiceRegistration, error)
func (*MemoryBackend) RegisterService ¶ added in v0.7.0
func (r *MemoryBackend) RegisterService(env, pool string, reg *ServiceRegistration) error
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) Subscribe ¶
func (r *MemoryBackend) Subscribe(key string) chan string
func (*MemoryBackend) UnassignApp ¶
func (r *MemoryBackend) UnassignApp(app, env, pool string) (bool, error)
func (*MemoryBackend) UnregisterService ¶ added in v0.7.0
func (r *MemoryBackend) UnregisterService(env, pool, hostIP, name, containerID string) (*ServiceRegistration, error)
func (*MemoryBackend) UpdateApp ¶
func (r *MemoryBackend) UpdateApp(svcCfg App, env string) (bool, error)
func (*MemoryBackend) UpdateHost ¶
func (r *MemoryBackend) UpdateHost(env, pool string, host HostInfo) error
type PortMapping ¶ added in v0.7.0
type PortMapping struct { // HostPort is the port that will be bound to the host, directly or through // a proxy. HostPort string // ContainerPort is the port exposed in the docker image ContainerPort string // Network defines the transport used for this port. TCP is the default if // not set. Network string // Hostnames that can can be routed to this HostPort via a virtual host // http handler Hostnames []string // Predefined error pages to return if a backend returns an error, or is // unavailable when access through an http virtual host. ErrorPages map[int]string }
type RedisBackend ¶
type RedisBackend struct { RedisHost string // contains filtered or unexported fields }
func (*RedisBackend) AssignApp ¶
func (r *RedisBackend) AssignApp(app, env, pool string) (bool, error)
func (*RedisBackend) CreatePool ¶
func (r *RedisBackend) CreatePool(env, pool string) (bool, error)
func (*RedisBackend) DeleteApp ¶
func (r *RedisBackend) DeleteApp(svcCfg App, 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) GcVMap ¶
func (r *RedisBackend) GcVMap(key string, vmap *utils.VersionedMap) error
func (*RedisBackend) GetServiceRegistration ¶ added in v0.7.0
func (r *RedisBackend) GetServiceRegistration(env, pool, hostIP, name, containerID string) (*ServiceRegistration, 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) ListRegistrations ¶ added in v0.7.0
func (r *RedisBackend) ListRegistrations(env string) ([]ServiceRegistration, error)
func (*RedisBackend) LoadVMap ¶
func (r *RedisBackend) LoadVMap(key string, dest *utils.VersionedMap) error
func (*RedisBackend) RegisterService ¶ added in v0.7.0
func (r *RedisBackend) RegisterService(env, pool string, reg *ServiceRegistration) error
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) Subscribe ¶
func (r *RedisBackend) Subscribe(key string) chan string
func (*RedisBackend) UnassignApp ¶
func (r *RedisBackend) UnassignApp(app, env, pool string) (bool, error)
func (*RedisBackend) UnregisterService ¶ added in v0.7.0
func (r *RedisBackend) UnregisterService(env, pool, hostIP, name, containerID string) (*ServiceRegistration, error)
func (*RedisBackend) UpdateApp ¶
func (r *RedisBackend) UpdateApp(cfg App, env string) (bool, error)
func (*RedisBackend) UpdateHost ¶
func (r *RedisBackend) UpdateHost(env, pool string, host HostInfo) error
type ServiceRegistration ¶ added in v0.6.0
type ServiceRegistration struct { Name string `json:"NAME,omitempty"` ExternalIP string `json:"EXTERNAL_IP,omitempty"` ExternalPort string `json:"EXTERNAL_PORT,omitempty"` InternalIP string `json:"INTERNAL_IP,omitempty"` InternalPort string `json:"INTERNAL_PORT,omitempty"` ContainerID string `json:"CONTAINER_ID"` ContainerName string `json:"CONTAINER_NAME"` Image string `json:"IMAGE,omitempty"` ImageId string `json:"IMAGE_ID,omitempty"` StartedAt time.Time `json:"STARTED_AT"` Expires time.Time `json:"-"` Path string `json:"-"` VirtualHosts []string `json:"VIRTUAL_HOSTS"` Port string `json:"PORT"` ErrorPages map[string]string `json:"ERROR_PAGES,omitempty"` // pool is inserted only for commander dump and restore Pool string }
func (*ServiceRegistration) Equals ¶ added in v0.6.0
func (s *ServiceRegistration) Equals(other ServiceRegistration) bool
func (*ServiceRegistration) ExternalAddr ¶ added in v0.6.0
func (s *ServiceRegistration) ExternalAddr() string
func (*ServiceRegistration) InternalAddr ¶ added in v0.6.0
func (s *ServiceRegistration) InternalAddr() string
type Store ¶
func (*Store) CheckForChangesNow ¶
func (s *Store) CheckForChangesNow()
func (*Store) GetServiceRegistration ¶ added in v0.6.0
func (s *Store) GetServiceRegistration(env, pool, hostIP string, container *docker.Container) (*ServiceRegistration, error)
func (*Store) IsRegistered ¶ added in v0.6.0
func (*Store) ListAssignedPools ¶
func (*Store) ListRegistrations ¶ added in v0.6.0
func (s *Store) ListRegistrations(env string) ([]ServiceRegistration, error)
func (*Store) NewAppConfig ¶ added in v0.7.0
FIXME: We still have a function that returns just an *AppConfig for the
RedisBackend. Unify these somehow, and preferebly decouple this from config.Store.
func (*Store) NotifyEnvChanged ¶
func (*Store) NotifyRestart ¶
func (*Store) RegisterService ¶ added in v0.6.0
func (s *Store) RegisterService(env, pool, hostIP string, container *docker.Container) (*ServiceRegistration, error)
func (*Store) UnRegisterService ¶ added in v0.6.0
func (s *Store) UnRegisterService(env, pool, hostIP string, container *docker.Container) (*ServiceRegistration, error)
func (*Store) Watch ¶
func (s *Store) Watch(env string, stop chan struct{}) chan *ConfigChange