Documentation ¶
Index ¶
- Constants
- Variables
- func Publish(r redis.Conn, event pubsubEvent, message string) error
- func RedisIsLoading(err error) bool
- func SendPublish(r redis.Conn, event pubsubEvent, message string) error
- type Lock
- type NetReadyError
- type NotReadyError
- func (e *NotReadyError) Close() error
- func (e *NotReadyError) Do(commandName string, args ...interface{}) (reply interface{}, err error)
- func (e *NotReadyError) Err() error
- func (e *NotReadyError) Flush() error
- func (e *NotReadyError) Receive() (reply interface{}, err error)
- func (e *NotReadyError) Send(commandName string, args ...interface{}) error
- type Pubsub
- type Redis
- func (r *Redis) AcquireLock(name string) (*Lock, error)
- func (r *Redis) CheckVersion() error
- func (r *Redis) Close()
- func (r *Redis) Connect() (redis.Conn, error)
- func (r *Redis) ConnectPubsub()
- func (r *Redis) Failure() bool
- func (r *Redis) Get() redis.Conn
- func (r *Redis) GetDBFormatVersion() (int, error)
- func (r *Redis) GetListOfMirrors() (map[int]string, error)
- func (r *Redis) UnblockedGet() redis.Conn
- func (r *Redis) Upgrade() error
- func (r *Redis) UpgradeNeeded() (bool, error)
Constants ¶
const ( CLUSTER pubsubEvent = "_mirrorbits_cluster" FILE_UPDATE pubsubEvent = "_mirrorbits_file_update" MIRROR_UPDATE pubsubEvent = "_mirrorbits_mirror_update" MIRROR_FILE_UPDATE pubsubEvent = "_mirrorbits_mirror_file_update" PUBSUB_RECONNECTED pubsubEvent = "_mirrorbits_pubsub_reconnected" )
Variables ¶
var ( ErrInvalidLockName = errors.New("invalid lock name") ErrAlreadyLocked = errors.New("lock already acquired") )
var ( // ErrUnreachable is returned when the endpoint is not reachable ErrUnreachable = errors.New("redis endpoint unreachable") // ErrRedisUpgradeRequired is returned when the redis server is running an unsupported version ErrRedisUpgradeRequired = errors.New("unsupported Redis version") )
var (
ErrUnsupportedVersion = errors.New("unsupported database version, please upgrade mirrorbits")
)
Functions ¶
func RedisIsLoading ¶
RedisIsLoading returns true if the error is of type LOADING
Types ¶
type NetReadyError ¶
type NetReadyError struct {
// contains filtered or unexported fields
}
func NewNetTemporaryError ¶
func NewNetTemporaryError() NetReadyError
func (*NetReadyError) Temporary ¶
func (n *NetReadyError) Temporary() bool
func (*NetReadyError) Timeout ¶
func (n *NetReadyError) Timeout() bool
type NotReadyError ¶
type NotReadyError struct{}
func (*NotReadyError) Close ¶
func (e *NotReadyError) Close() error
func (*NotReadyError) Do ¶
func (e *NotReadyError) Do(commandName string, args ...interface{}) (reply interface{}, err error)
func (*NotReadyError) Err ¶
func (e *NotReadyError) Err() error
func (*NotReadyError) Flush ¶
func (e *NotReadyError) Flush() error
func (*NotReadyError) Receive ¶
func (e *NotReadyError) Receive() (reply interface{}, err error)
func (*NotReadyError) Send ¶
func (e *NotReadyError) Send(commandName string, args ...interface{}) error
type Pubsub ¶
type Pubsub struct {
// contains filtered or unexported fields
}
Pubsub is the internal structure of the publish/subscribe handler
func (*Pubsub) SubscribeEvent ¶
SubscribeEvent allows subscription to a particular kind of events and receive a notification when an event is dispatched on the given channel.
type Redis ¶
type Redis struct { Pubsub *Pubsub // contains filtered or unexported fields }
Redis is the instance object of the redis database
func NewRedisCustomPool ¶
func NewRedisCustomPool(pool redisPool) *Redis
NewRedisCustomPool returns a new instance of the redis database using a custom pool
func (*Redis) CheckVersion ¶
CheckVersion checks if the redis server version is supported
func (*Redis) ConnectPubsub ¶
func (r *Redis) ConnectPubsub()
ConnectPubsub initiates the connection to the pubsub
func (*Redis) GetDBFormatVersion ¶
GetDBFormatVersion return the current database format version
func (*Redis) UnblockedGet ¶
UnblockedGet returns a redis connection from the pool even if the database checks and/or upgrade are not finished.
func (*Redis) UpgradeNeeded ¶
UpgradeNeeded returns true if a database upgrade is needed