Documentation ¶
Overview ¶
Package leaderredis provides a redis driver for package leader
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(driver *RedisDriver)
Option is type of the options to config *RedisDriver
func WithExpiration ¶
WithExpiration is an option that configures the expiration of redis key. A new round of leader election will start after the key expires.
func WithPollInterval ¶
WithPollInterval is an option that configures the poll interval of followers. The followers will periodically try to overthrown the leader, but only succeed when the leader key is missing in redis.
type RedisDriver ¶
type RedisDriver struct {
// contains filtered or unexported fields
}
RedisDriver is a simple redis leader election implementation.
func NewRedisDriver ¶
func NewRedisDriver(client redis.UniversalClient, keyer contract.Keyer, opts ...Option) *RedisDriver
NewRedisDriver creates the newly created *RedisDriver with the given configuration.
Click to show internal directories.
Click to hide internal directories.