Documentation
¶
Index ¶
- Variables
- func ContextWithTaskService(ctx context.Context) context.Context
- func RegisterImplementor(c Task)
- func RegisterLockerImplementor(locker Locker)
- func StreamServerInterceptor() grpc.StreamServerInterceptor
- func UnaryServerInterceptor() grpc.UnaryServerInterceptor
- type Executor
- type ExecutorFunc
- type Locker
- type Option
- type Options
- type Task
Constants ¶
This section is empty.
Variables ¶
View Source
var EmptyOptions = func() *Options { return &Options{ Singleton: false, Argument: nil, } }
Functions ¶
func RegisterImplementor ¶
func RegisterImplementor(c Task)
RegisterImplementor registers the task service implementor.
func RegisterLockerImplementor ¶
func RegisterLockerImplementor(locker Locker)
RegisterLockerImplementor registers the task locker service implementor.
func StreamServerInterceptor ¶
func StreamServerInterceptor() grpc.StreamServerInterceptor
StreamServerInterceptor returns a new streaming server interceptor for crontab task.
func UnaryServerInterceptor ¶
func UnaryServerInterceptor() grpc.UnaryServerInterceptor
UnaryServerInterceptor returns a new unary server interceptor for crontab task.
Types ¶
type ExecutorFunc ¶
type Locker ¶
type Locker interface {
// Lock tries to get the locker of the scheduler,
// should be blocked before acquired the locker.
Lock(ctx context.Context, scheduler string) context.Context
// Unlock gives up the schedule locker.
Unlock(scheduler string)
}
Locker interface.
func LockerImplementor ¶
func LockerImplementor() Locker
LockerImplementor return the task locker service implementor.
type Option ¶
type Option func(options *Options)
func WithArgument ¶
func WithArgument(arg interface{}) Option
func WithComponent ¶
func WithProduct ¶
func WithSingleton ¶
func WithSingleton() Option
type Task ¶
type Task interface {
// Schedule a task.
// Supported spec, refer: https://github.com/robfig/cron/tree/v3.0.1
Schedule(spec string, exec Executor, opts ...Option) error
}
func ContextTaskService ¶
Click to show internal directories.
Click to hide internal directories.