Documentation ¶
Index ¶
- Constants
- func GetKeyPre(serviceName string) string
- func GetNodeId(serviceName string) string
- func GetStableJobStore(serviceName string) string
- func GetStableJobStoreTxKey(serviceName string) string
- func TimePre(t time.Time, preDuration time.Duration) int64
- type DriverV2
- type EtcdDriver
- type LoggerOption
- type Option
- type RedisDriver
- func (rd *RedisDriver) GetNodes(ctx context.Context) (nodes []string, err error)
- func (rd *RedisDriver) Init(serviceName string, opts ...Option)
- func (rd *RedisDriver) NodeID() string
- func (rd *RedisDriver) Start(ctx context.Context) (err error)
- func (rd *RedisDriver) Stop(ctx context.Context) (err error)
- type RedisZSetDriver
- func (rd *RedisZSetDriver) GetNodes(ctx context.Context) (nodes []string, err error)
- func (rd *RedisZSetDriver) Init(serviceName string, opts ...Option)
- func (rd *RedisZSetDriver) NodeID() string
- func (rd *RedisZSetDriver) Start(ctx context.Context) (err error)
- func (rd *RedisZSetDriver) Stop(ctx context.Context) (err error)
- type TimeoutOption
Constants ¶
View Source
const ( OptionTypeTimeout = 0x600 OptionTypeLogger = 0x601 )
View Source
const GlobalKeyPrefix = "distributed-cron:"
GlobalKeyPrefix is global redis key preifx
Variables ¶
This section is empty.
Functions ¶
func GetStableJobStore ¶
func GetStableJobStoreTxKey ¶
Types ¶
type DriverV2 ¶
type DriverV2 interface { // init driver Init(serviceName string, opts ...Option) // get nodeID NodeID() string // get nodes GetNodes(ctx context.Context) (nodes []string, err error) Start(ctx context.Context) (err error) Stop(ctx context.Context) (err error) // contains filtered or unexported methods }
There is only one driver for one dcron. Tips for write a user-defined Driver by yourself.
- Confirm that `Stop` and `Start` can be called for more times.
- Must make `GetNodes` will return error when timeout.
func NewEtcdDriver ¶
func NewRedisDriver ¶
func NewRedisDriver(redisClient *redis.Client) DriverV2
func NewRedisZSetDriver ¶
func NewRedisZSetDriver(redisClient *redis.Client) DriverV2
type EtcdDriver ¶
type EtcdDriver struct {
// contains filtered or unexported fields
}
func (*EtcdDriver) GetNodes ¶
func (e *EtcdDriver) GetNodes(ctx context.Context) (nodes []string, err error)
func (*EtcdDriver) Init ¶
func (e *EtcdDriver) Init(serverName string, opts ...Option)
func (*EtcdDriver) NodeID ¶
func (e *EtcdDriver) NodeID() string
type LoggerOption ¶
type LoggerOption struct {
// contains filtered or unexported fields
}
func NewLoggerOption ¶
func NewLoggerOption(logger dlog.Logger) LoggerOption
func (LoggerOption) Type ¶
func (to LoggerOption) Type() int
type RedisDriver ¶
func (*RedisDriver) GetNodes ¶
func (rd *RedisDriver) GetNodes(ctx context.Context) (nodes []string, err error)
func (*RedisDriver) Init ¶
func (rd *RedisDriver) Init(serviceName string, opts ...Option)
func (*RedisDriver) NodeID ¶
func (rd *RedisDriver) NodeID() string
type RedisZSetDriver ¶
func (*RedisZSetDriver) GetNodes ¶
func (rd *RedisZSetDriver) GetNodes(ctx context.Context) (nodes []string, err error)
func (*RedisZSetDriver) Init ¶
func (rd *RedisZSetDriver) Init(serviceName string, opts ...Option)
func (*RedisZSetDriver) NodeID ¶
func (rd *RedisZSetDriver) NodeID() string
type TimeoutOption ¶
type TimeoutOption struct {
// contains filtered or unexported fields
}
func NewTimeoutOption ¶
func NewTimeoutOption(timeout time.Duration) TimeoutOption
func (TimeoutOption) Type ¶
func (to TimeoutOption) Type() int
Click to show internal directories.
Click to hide internal directories.