redis

package
v0.0.0-...-33635b2 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2017 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PingServer

func PingServer(instance *Instance) error

Types

type AgentClient

type AgentClient interface {
	Reset(hostIP string) error
	Credentials(hostIP string) (Credentials, error)
}

type Credentials

type Credentials struct {
	Port     int    `json:"port"`
	Password string `json:"password"`
}

type Instance

type Instance struct {
	ID       string
	Host     string
	Port     int
	Password string
}

func (Instance) Address

func (instance Instance) Address() *net.TCPAddr

type InstanceInformer

type InstanceInformer interface {
	InstancePid(string) (int, error)
}

type LocalInstanceCreator

type LocalInstanceCreator struct {
	LocalInstanceRepository
	FindFreePort       func() (int, error)
	ProcessController  ProcessController
	RedisConfiguration brokerconfig.ServiceConfiguration
}

func (*LocalInstanceCreator) Create

func (localInstanceCreator *LocalInstanceCreator) Create(instanceID string) error

func (*LocalInstanceCreator) Destroy

func (localInstanceCreator *LocalInstanceCreator) Destroy(instanceID string) error

type LocalInstanceRepository

type LocalInstanceRepository interface {
	FindByID(instanceID string) (*Instance, error)
	InstanceExists(instanceID string) (bool, error)
	Setup(instance *Instance) error
	Delete(instanceID string) error
	InstanceDataDir(instanceID string) string
	InstanceConfigPath(instanceID string) string
	InstanceLogFilePath(instanceID string) string
	InstancePidFilePath(instanceID string) string
	InstanceCount() (int, []error)
	Lock(instance *Instance) error
	Unlock(instance *Instance) error
}

type LocalRepository

type LocalRepository struct {
	RedisConf brokerconfig.ServiceConfiguration
	Logger    lager.Logger
}

func NewLocalRepository

func NewLocalRepository(redisConf brokerconfig.ServiceConfiguration, logger lager.Logger) *LocalRepository

func (*LocalRepository) AllInstances

func (repo *LocalRepository) AllInstances() ([]*Instance, []error)

func (*LocalRepository) AllInstancesVerbose

func (repo *LocalRepository) AllInstancesVerbose() ([]*Instance, []error)

func (*LocalRepository) Bind

func (repo *LocalRepository) Bind(instanceID string, bindingID string) (broker.InstanceCredentials, error)

func (*LocalRepository) Delete

func (repo *LocalRepository) Delete(instanceID string) error

func (*LocalRepository) EnsureDirectoriesExist

func (repo *LocalRepository) EnsureDirectoriesExist(instance *Instance) error

func (*LocalRepository) FindByID

func (repo *LocalRepository) FindByID(instanceID string) (*Instance, error)

func (*LocalRepository) InstanceBaseDir

func (repo *LocalRepository) InstanceBaseDir(instanceID string) string

func (*LocalRepository) InstanceConfigPath

func (repo *LocalRepository) InstanceConfigPath(instanceID string) string

func (*LocalRepository) InstanceCount

func (repo *LocalRepository) InstanceCount() (int, []error)

func (*LocalRepository) InstanceDataDir

func (repo *LocalRepository) InstanceDataDir(instanceID string) string

func (*LocalRepository) InstanceExists

func (repo *LocalRepository) InstanceExists(instanceID string) (bool, error)

func (*LocalRepository) InstanceLogDir

func (repo *LocalRepository) InstanceLogDir(instanceID string) string

func (*LocalRepository) InstanceLogFilePath

func (repo *LocalRepository) InstanceLogFilePath(instanceID string) string

func (*LocalRepository) InstancePid

func (repo *LocalRepository) InstancePid(instanceID string) (pid int, err error)

func (*LocalRepository) InstancePidFilePath

func (repo *LocalRepository) InstancePidFilePath(instanceID string) string

func (*LocalRepository) Lock

func (repo *LocalRepository) Lock(instance *Instance) error

func (*LocalRepository) Setup

func (repo *LocalRepository) Setup(instance *Instance) error

func (*LocalRepository) Unbind

func (repo *LocalRepository) Unbind(instanceID string, bindingID string) error

func (*LocalRepository) Unlock

func (repo *LocalRepository) Unlock(instance *Instance) error

func (*LocalRepository) WriteConfigFile

func (repo *LocalRepository) WriteConfigFile(instance *Instance) error

type OSProcessController

type OSProcessController struct {
	Logger                    lager.Logger
	InstanceInformer          InstanceInformer
	ProcessChecker            ProcessChecker
	ProcessKiller             ProcessKiller
	PingFunc                  PingServerFunc
	WaitUntilConnectableFunc  WaitUntilConnectableFunc
	RedisServerExecutablePath string
	// contains filtered or unexported fields
}

func NewOSProcessController

func NewOSProcessController(
	logger lager.Logger,
	instanceInformer InstanceInformer,
	processChecker ProcessChecker,
	processKiller ProcessKiller,
	pingFunc PingServerFunc,
	waitUntilConnectableFunc WaitUntilConnectableFunc,
	redisServerExecutablePath string,
) *OSProcessController

func (*OSProcessController) EnsureRunning

func (controller *OSProcessController) EnsureRunning(instance *Instance, configPath, instanceDataDir, pidfilePath, logfilePath string) error

func (*OSProcessController) Kill

func (controller *OSProcessController) Kill(instance *Instance) error

func (*OSProcessController) StartAndWaitUntilReady

func (controller *OSProcessController) StartAndWaitUntilReady(instance *Instance, configPath, instanceDataDir, logfilePath string, timeout time.Duration) error

func (*OSProcessController) StartAndWaitUntilReadyWithConfig

func (controller *OSProcessController) StartAndWaitUntilReadyWithConfig(instance *Instance, instanceCommandArgs []string, timeout time.Duration) error

type PingServerFunc

type PingServerFunc func(instance *Instance) error

type ProcessChecker

type ProcessChecker interface {
	Alive(pid int) bool
}

type ProcessController

type ProcessController interface {
	StartAndWaitUntilReady(instance *Instance, configPath, instanceDataDir, logfilePath string, timeout time.Duration) error
	Kill(instance *Instance) error
}

type ProcessKiller

type ProcessKiller interface {
	Kill(pid int) error
}

type RemoteAgentClient

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

func NewRemoteAgentClient

func NewRemoteAgentClient(port, username, password string, secure bool) *RemoteAgentClient

func (*RemoteAgentClient) Credentials

func (client *RemoteAgentClient) Credentials(host string) (Credentials, error)

func (*RemoteAgentClient) Keycount

func (client *RemoteAgentClient) Keycount(host string) (int, error)

func (*RemoteAgentClient) Reset

func (client *RemoteAgentClient) Reset(host string) error

type RemoteRepository

type RemoteRepository struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewRemoteRepository

func NewRemoteRepository(agentClient AgentClient, config brokerconfig.Config, logger lager.Logger) (*RemoteRepository, error)

func (*RemoteRepository) AllInstances

func (repo *RemoteRepository) AllInstances() ([]*Instance, error)

func (*RemoteRepository) AvailableInstances

func (repo *RemoteRepository) AvailableInstances() []*Instance

func (*RemoteRepository) Bind

func (repo *RemoteRepository) Bind(instanceID string, bindingID string) (broker.InstanceCredentials, error)

func (*RemoteRepository) BindingsForInstance

func (repo *RemoteRepository) BindingsForInstance(instanceID string) ([]string, error)

func (*RemoteRepository) Create

func (repo *RemoteRepository) Create(instanceID string) error

func (*RemoteRepository) Destroy

func (repo *RemoteRepository) Destroy(instanceID string) error

func (*RemoteRepository) FindByID

func (repo *RemoteRepository) FindByID(instanceID string) (*Instance, error)

func (*RemoteRepository) IDForHost

func (repo *RemoteRepository) IDForHost(host string) string

func (*RemoteRepository) InstanceCount

func (repo *RemoteRepository) InstanceCount() (int, error)

func (*RemoteRepository) InstanceExists

func (repo *RemoteRepository) InstanceExists(instanceID string) (bool, error)

func (*RemoteRepository) InstanceLimit

func (repo *RemoteRepository) InstanceLimit() int

func (*RemoteRepository) PersistStatefile

func (repo *RemoteRepository) PersistStatefile() error

func (*RemoteRepository) StateFromFile

func (repo *RemoteRepository) StateFromFile() (Statefile, error)

func (*RemoteRepository) Unbind

func (repo *RemoteRepository) Unbind(instanceID string, bindingID string) error

type Statefile

type Statefile struct {
	AvailableInstances []*Instance         `json:"available_instances"`
	AllocatedInstances []*Instance         `json:"allocated_instances"`
	InstanceBindings   map[string][]string `json:"instance_bindings"`
}

type WaitUntilConnectableFunc

type WaitUntilConnectableFunc func(address *net.TCPAddr, timeout time.Duration) error

Directories

Path Synopsis
This file was generated by counterfeiter
This file was generated by counterfeiter

Jump to

Keyboard shortcuts

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