redis

package
v0.0.0-...-ff29edb Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2023 License: Apache-2.0 Imports: 19 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PingServer

func PingServer(instance *Instance) error

Types

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

	Exec iexec.Exec
}

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 WaitUntilConnectableFunc

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

Directories

Path Synopsis
fakes
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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