Documentation
¶
Index ¶
Constants ¶
View Source
const ( OptionTypeTimeout = 0x600 OptionTypeLogger = 0x601 )
View Source
const GlobalKeyPrefix = "distributed-cron:"
GlobalKeyPrefix is a global redis key prefix
Variables ¶
This section is empty.
Functions ¶
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) // register node to remote server (like etcd/redis), // will create a goroutine to keep the connection. // And then continue for other work. Start(ctx context.Context) (err error) // stop the goroutine of keep connection. Stop(ctx context.Context) (err error) WithOption(opt Option) (err error) }
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.
type LoggerOption ¶
func NewLoggerOption ¶
func NewLoggerOption(logger dlog.Logger) LoggerOption
func (LoggerOption) Type ¶
func (to LoggerOption) Type() int
type TimeoutOption ¶
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.