Documentation
¶
Index ¶
Constants ¶
View Source
const ( TimestampMode = iota CronMode )
Variables ¶
View Source
var ErrMaxEventQueueCapacity = errors.New("the max eventQueue capacity has been reached")
View Source
var ErrMaxRawEventQueueCapacity = errors.New("the max rawEventQueue capacity has been reached")
View Source
var ErrMaxStackCapacity = errors.New("the max stack capacity has been reached")
View Source
var (
ErrNotFound = errors.New("the requested item cannot be found")
)
View Source
var (
ErrNotImplemented = errors.New("this method is not implemented")
)
Functions ¶
This section is empty.
Types ¶
type CacheManager ¶
type CacheManager interface {
PersistenceManager
}
func NewRedisCacheManager ¶
func NewRedisCacheManager(conf RedisCacheManagerConfig) (CacheManager, error)
type DispatchFunc ¶
type DispatchManagerConfig ¶
type Event ¶
type Event struct {
ID ID
// CronExpression allows us to schedule the event based on the cron expression
CronExpression string
// ShouldExecuteAt is the timestamp at which the event must be scheduled
ShouldExecuteAt time.Time
// Mode is the mode in which the event should be scheduled (CronMode or TimestampMode)
Mode EventMode
// Topic is the channel on which the event has to be dispatched
Topic string
// Payload is the content of the event
Payload []byte
}
type PersistenceManager ¶
type PersistenceManager interface {
Add(ctx context.Context, e Event) error
AddBulk(ctx context.Context, evs []Event) error
Delete(ctx context.Context, id ID) error
Get(ctx context.Context, id ID) (Event, error)
GetAll(ctx context.Context) ([]Event, error)
}
func NewSqlPersistenceManager ¶
func NewSqlPersistenceManager(cache CacheManager, conf SqlPersistenceManagerConfig) (PersistenceManager, error)
type RedisCacheManagerConfig ¶
type Scheduler ¶
type Scheduler interface {
Schedule(e Event) (ID, error)
Unschedule(id ID) error
Start() error
Stop()
SetConfig(conf SchedulerConfig) error
// contains filtered or unexported methods
}
func NewScheduler ¶
func NewScheduler(ctx context.Context, conf SchedulerConfig, pers PersistenceManager, cache CacheManager, fn DispatchFunc) Scheduler
type SchedulerConfig ¶
type SchedulerConfig struct {
StackManagerConfig
DispatchManagerConfig
DefaultInputQueueCapacity int
MaxInputQueueCapacity int
MaxBulkLimit int
}
type StackManagerConfig ¶
Click to show internal directories.
Click to hide internal directories.