Documentation ¶
Overview ¶
Package redisstub is a minimal package providing redis-related (in-memory) implementations meant for testing and dev purposes only.
Index ¶
- type InMemoryRedisProvider
- func (rp *InMemoryRedisProvider) Close() error
- func (rp *InMemoryRedisProvider) DataConnection(index int64) (ardb.Connection, error)
- func (rp *InMemoryRedisProvider) MarkTemplateConnectionInvalid(index int64)
- func (rp *InMemoryRedisProvider) MetadataConnection() (ardb.Connection, error)
- func (rp *InMemoryRedisProvider) PrimaryAddress() string
- func (rp *InMemoryRedisProvider) SetTemplatePool(template *InMemoryRedisProvider)
- func (rp *InMemoryRedisProvider) TemplateAddress() (string, bool)
- func (rp *InMemoryRedisProvider) TemplateConnection(index int64) (ardb.Connection, error)
- type InMemoryRedisProviderMultiServers
- func (rp *InMemoryRedisProviderMultiServers) Close() error
- func (rp *InMemoryRedisProviderMultiServers) ClusterConfig() *config.StorageClusterConfig
- func (rp *InMemoryRedisProviderMultiServers) DataConnection(index int64) (ardb.Connection, error)
- func (rp *InMemoryRedisProviderMultiServers) MarkTemplateConnectionInvalid(index int64)
- func (rp *InMemoryRedisProviderMultiServers) MetadataConnection() (ardb.Connection, error)
- func (rp *InMemoryRedisProviderMultiServers) TemplateConnection(index int64) (ardb.Connection, error)
- type MemoryRedis
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InMemoryRedisProvider ¶
type InMemoryRedisProvider struct {
// contains filtered or unexported fields
}
InMemoryRedisProvider provides a in memory provider for any redis connection. While it is safe to create this struct directly, it is recommended to create it using NewInMemoryRedisProvider. WARNING: should be used for testing/dev purposes only!
func NewInMemoryRedisProvider ¶
func NewInMemoryRedisProvider(template *InMemoryRedisProvider) *InMemoryRedisProvider
NewInMemoryRedisProvider returns an ARDB Connection Provider, which uses an in-memory ARDB for all its purposes. See documentation for NewMemoryRedis more information. WARNING: should be used for testing/dev purposes only!
func (*InMemoryRedisProvider) Close ¶
func (rp *InMemoryRedisProvider) Close() error
Close implements ConnProvider.Close
func (*InMemoryRedisProvider) DataConnection ¶
func (rp *InMemoryRedisProvider) DataConnection(index int64) (ardb.Connection, error)
DataConnection implements ConnProvider.DataConnection
func (*InMemoryRedisProvider) MarkTemplateConnectionInvalid ¶
func (rp *InMemoryRedisProvider) MarkTemplateConnectionInvalid(index int64)
MarkTemplateConnectionInvalid implements ConnProvider.MarkTemplateConnectionInvalid
func (*InMemoryRedisProvider) MetadataConnection ¶
func (rp *InMemoryRedisProvider) MetadataConnection() (ardb.Connection, error)
MetadataConnection implements ConnProvider.MetadataConnection
func (*InMemoryRedisProvider) PrimaryAddress ¶
func (rp *InMemoryRedisProvider) PrimaryAddress() string
PrimaryAddress returns the address of the primary in-memory ardb server.
func (*InMemoryRedisProvider) SetTemplatePool ¶
func (rp *InMemoryRedisProvider) SetTemplatePool(template *InMemoryRedisProvider)
SetTemplatePool allows you to set the template source for this provider, using the primary source of the given provider. The template source of this provider will be unset in case nil is passed in as an argument.
func (*InMemoryRedisProvider) TemplateAddress ¶
func (rp *InMemoryRedisProvider) TemplateAddress() (string, bool)
TemplateAddress returns the address of the template in-memory ardb server, or returns false if no template is defined instead.
func (*InMemoryRedisProvider) TemplateConnection ¶
func (rp *InMemoryRedisProvider) TemplateConnection(index int64) (ardb.Connection, error)
TemplateConnection implements ConnProvider.TemplateConnection
type InMemoryRedisProviderMultiServers ¶
type InMemoryRedisProviderMultiServers struct {
// contains filtered or unexported fields
}
InMemoryRedisProviderMultiServers provides a in memory provider for any redis connection, using multiple in-memory ardb servers. While it is safe to create this struct directly, it is recommended to create it using NewInMemoryRedisProviderMultiServers. WARNING: should be used for testing/dev purposes only!
func NewInMemoryRedisProviderMultiServers ¶
func NewInMemoryRedisProviderMultiServers(dataServers, templateServers int, metaDataServer bool) *InMemoryRedisProviderMultiServers
NewInMemoryRedisProviderMultiServers returns an ARDB Connection Provider, which uses multiple in-memory ARDB for all its purposes. See documentation for NewMemoryRedis more information. WARNING: should be used for testing/dev purposes only!
func (*InMemoryRedisProviderMultiServers) Close ¶
func (rp *InMemoryRedisProviderMultiServers) Close() error
Close implements ConnProvider.Close
func (*InMemoryRedisProviderMultiServers) ClusterConfig ¶
func (rp *InMemoryRedisProviderMultiServers) ClusterConfig() *config.StorageClusterConfig
ClusterConfig returns the cluster config which can be used to connect to the storage cluster which underlies this provider.
func (*InMemoryRedisProviderMultiServers) DataConnection ¶
func (rp *InMemoryRedisProviderMultiServers) DataConnection(index int64) (ardb.Connection, error)
DataConnection implements ConnProvider.DataConnection
func (*InMemoryRedisProviderMultiServers) MarkTemplateConnectionInvalid ¶
func (rp *InMemoryRedisProviderMultiServers) MarkTemplateConnectionInvalid(index int64)
MarkTemplateConnectionInvalid implements ConnProvider.MarkTemplateConnectionInvalid
func (*InMemoryRedisProviderMultiServers) MetadataConnection ¶
func (rp *InMemoryRedisProviderMultiServers) MetadataConnection() (ardb.Connection, error)
MetadataConnection implements ConnProvider.MetadataConnection
func (*InMemoryRedisProviderMultiServers) TemplateConnection ¶
func (rp *InMemoryRedisProviderMultiServers) TemplateConnection(index int64) (ardb.Connection, error)
TemplateConnection implements ConnProvider.TemplateConnection
type MemoryRedis ¶
type MemoryRedis struct {
// contains filtered or unexported fields
}
MemoryRedis is an in memory redis connection implementation
func NewMemoryRedis ¶
func NewMemoryRedis() *MemoryRedis
NewMemoryRedis creates a new in-memory redis stub. It must be noted that the stub only partially redis-compliant, not all commands (such as MULTI/EXEC) are supported. All available commands can be found at: https://github.com/siddontang/ledisdb/blob/master/doc/commands.md WARNING: should be used for testing/dev purposes only!
func (*MemoryRedis) Address ¶
func (mr *MemoryRedis) Address() string
Address returns the tcp (local) address of this MemoryRedis server
func (*MemoryRedis) Close ¶
func (mr *MemoryRedis) Close()
Close the embedded Go Redis Server, and delete the used datadir.
func (*MemoryRedis) Dial ¶
Dial to the embedded Go Redis Server, and return the established connection if possible.
func (*MemoryRedis) Listen ¶
func (mr *MemoryRedis) Listen()
Listen to any incoming TCP requests, and process them in the embedded Go Redis Server.