registry

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: May 4, 2015 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTTL = 60
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryBackend

type MemoryBackend struct {
	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) Connect

func (r *MemoryBackend) Connect()

func (*MemoryBackend) Delete

func (r *MemoryBackend) Delete(key string) (int, 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) Keys

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

func (*MemoryBackend) Reconnect

func (r *MemoryBackend) Reconnect()

func (*MemoryBackend) Set

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

func (*MemoryBackend) Ttl

func (r *MemoryBackend) Ttl(key string) (int, 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) Connect

func (r *RedisBackend) Connect()

func (*RedisBackend) Delete

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

func (*RedisBackend) DeleteMulti

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

func (*RedisBackend) Expire

func (r *RedisBackend) Expire(key string, ttl uint64) (int, 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) Keys

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

func (*RedisBackend) Members

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

func (*RedisBackend) Reconnect

func (r *RedisBackend) Reconnect()

func (*RedisBackend) RemoveMember

func (r *RedisBackend) RemoveMember(key, value string) (int, 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) Ttl

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

type RegistryBackend

type RegistryBackend interface {

	// Keys
	Keys(key string) ([]string, error)
	Delete(key string) (int, error)
	Expire(key string, ttl uint64) (int, error)
	Ttl(key string) (int, error)

	Connect()
	Reconnect()

	// Maps
	Set(key, field string, value string) (string, error)
	Get(key, field string) (string, error)
}

type ServiceRegistration

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"`
}

func (*ServiceRegistration) Equals

func (s *ServiceRegistration) Equals(other ServiceRegistration) bool

func (*ServiceRegistration) ExternalAddr

func (s *ServiceRegistration) ExternalAddr() string

func (*ServiceRegistration) InternalAddr

func (s *ServiceRegistration) InternalAddr() string

type ServiceRegistry

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

func NewServiceRegistry

func NewServiceRegistry(ttl uint64) *ServiceRegistry

func (*ServiceRegistry) Connect

func (r *ServiceRegistry) Connect(registryURL string)

Build the Redis Pool

func (*ServiceRegistry) EnvFor

func (s *ServiceRegistry) EnvFor(container *docker.Container) map[string]string

func (*ServiceRegistry) GetServiceRegistration

func (r *ServiceRegistry) GetServiceRegistration(env, pool, hostIP string, container *docker.Container) (*ServiceRegistration, error)

func (*ServiceRegistry) IsRegistered

func (r *ServiceRegistry) IsRegistered(env, pool, hostIP string, container *docker.Container) (bool, error)

func (*ServiceRegistry) ListRegistrations

func (r *ServiceRegistry) ListRegistrations(env string) ([]ServiceRegistration, error)

TODO: get all ServiceRegistrations

func (*ServiceRegistry) RegisterService

func (r *ServiceRegistry) RegisterService(env, pool, hostIP string, container *docker.Container) (*ServiceRegistration, error)

func (*ServiceRegistry) UnRegisterService

func (r *ServiceRegistry) UnRegisterService(env, pool, hostIP string, container *docker.Container) (*ServiceRegistration, error)

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