Documentation ¶
Index ¶
- Constants
- func IsRunning() bool
- func NewConnector(config Config, scope metrics.Scope) dosa.Connector
- type Config
- type Connector
- func (c *Connector) CreateIfNotExists(ctx context.Context, ei *dosa.EntityInfo, values map[string]dosa.FieldValue) error
- func (c *Connector) MultiRead(ctx context.Context, ei *dosa.EntityInfo, keys []map[string]dosa.FieldValue, ...) (results []*dosa.FieldValuesOrError, err error)
- func (c *Connector) MultiRemove(ctx context.Context, ei *dosa.EntityInfo, ...) (result []error, err error)
- func (c *Connector) MultiUpsert(ctx context.Context, ei *dosa.EntityInfo, ...) (result []error, err error)
- func (c *Connector) Range(ctx context.Context, ei *dosa.EntityInfo, ...) ([]map[string]dosa.FieldValue, string, error)
- func (c *Connector) Read(ctx context.Context, ei *dosa.EntityInfo, keys map[string]dosa.FieldValue, ...) (map[string]dosa.FieldValue, error)
- func (c *Connector) Remove(ctx context.Context, ei *dosa.EntityInfo, keys map[string]dosa.FieldValue) error
- func (c *Connector) RemoveRange(ctx context.Context, ei *dosa.EntityInfo, ...) error
- func (c *Connector) Scan(ctx context.Context, ei *dosa.EntityInfo, minimumFields []string, token string, ...) (multiValues []map[string]dosa.FieldValue, nextToken string, err error)
- func (c *Connector) Shutdown() error
- func (c *Connector) Upsert(ctx context.Context, ei *dosa.EntityInfo, values map[string]dosa.FieldValue) error
- type ErrInvalidEntity
- type ErrNotImplemented
- type ServerConfig
- type SimpleRedis
Constants ¶
const RedisPort = 6379
RedisPort is the default port for talking to Redis
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { // ServerSettings are the settings specific to redis server ServerSettings ServerConfig // TTL for how long values should live in the cache TTL time.Duration // KeyPrefix is used as the prefix to construct redis key KeyPrefix string }
Config holds the settings for a RedisConnector
type Connector ¶
Connector for redis database
func (*Connector) CreateIfNotExists ¶
func (c *Connector) CreateIfNotExists(ctx context.Context, ei *dosa.EntityInfo, values map[string]dosa.FieldValue) error
CreateIfNotExists not implemented
func (*Connector) MultiRead ¶
func (c *Connector) MultiRead(ctx context.Context, ei *dosa.EntityInfo, keys []map[string]dosa.FieldValue, minimumFields []string) (results []*dosa.FieldValuesOrError, err error)
MultiRead not implemented
func (*Connector) MultiRemove ¶
func (c *Connector) MultiRemove(ctx context.Context, ei *dosa.EntityInfo, multiKeys []map[string]dosa.FieldValue) (result []error, err error)
MultiRemove not implemented
func (*Connector) MultiUpsert ¶
func (c *Connector) MultiUpsert(ctx context.Context, ei *dosa.EntityInfo, multiValues []map[string]dosa.FieldValue) (result []error, err error)
MultiUpsert not implemented
func (*Connector) Range ¶
func (c *Connector) Range(ctx context.Context, ei *dosa.EntityInfo, columnConditions map[string][]*dosa.Condition, minimumFields []string, token string, limit int) ([]map[string]dosa.FieldValue, string, error)
Range not implemented.
func (*Connector) Read ¶
func (c *Connector) Read(ctx context.Context, ei *dosa.EntityInfo, keys map[string]dosa.FieldValue, fieldsToRead []string) (map[string]dosa.FieldValue, error)
Read reads an object based on primary key
func (*Connector) Remove ¶
func (c *Connector) Remove(ctx context.Context, ei *dosa.EntityInfo, keys map[string]dosa.FieldValue) error
Remove deletes a key
func (*Connector) RemoveRange ¶
func (c *Connector) RemoveRange(ctx context.Context, ei *dosa.EntityInfo, columnConditions map[string][]*dosa.Condition) error
RemoveRange not implemented
type ErrInvalidEntity ¶
type ErrInvalidEntity struct {
// contains filtered or unexported fields
}
ErrInvalidEntity is returned for dosa entities that cannot be categorized as a key-value schema for redis
func NewErrInvalidEntity ¶
func NewErrInvalidEntity(msg string) *ErrInvalidEntity
NewErrInvalidEntity returns an ErrInvalidEntity
func (*ErrInvalidEntity) Error ¶
func (e *ErrInvalidEntity) Error() string
Error returns why the schema does not conform to key-value format
type ErrNotImplemented ¶
type ErrNotImplemented struct{}
ErrNotImplemented is returned for interface methods that do not have an implementation
func (*ErrNotImplemented) Error ¶
func (*ErrNotImplemented) Error() string
Error returns a constant string "Not implemented"
type ServerConfig ¶
type ServerConfig struct { Host string Port int // MaxIdle is the maximum number of idle connections in the pool. MaxIdle int // IdleTimeout directs to close connections after remaining idle for this duration. // If the value is zero, then idle connections are not closed. Applications should set // the timeout to a value less than the server's timeout. IdleTimeout time.Duration // Maximum number of connections allocated by the pool at a given time. // When zero, there is no limit on the number of connections in the pool. MaxActive int ConnectTimeout time.Duration ReadTimeout time.Duration WriteTimeout time.Duration }
ServerConfig holds the settings for redis
type SimpleRedis ¶
type SimpleRedis interface { Get(key string) ([]byte, error) SetEx(key string, value []byte, ttl time.Duration) error Del(key string) error Shutdown() error }
SimpleRedis is a minimal interface to Redis commands
func NewRedigoClient ¶
func NewRedigoClient(config ServerConfig, scope metrics.Scope) SimpleRedis
NewRedigoClient returns a redigo implementation of SimpleRedis