Documentation
¶
Index ¶
- func Clamp[...](value, min, max T) T
- func Debug(level int, args ...interface{})
- func Debugf(level int, format string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Fail(code int, args ...interface{})
- func Failf(code int, format string, args ...interface{})
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func IsDebug() bool
- func Live(args ...interface{}) error
- func Logger(level int, path string)
- func LoggerRestart()
- func Notice(args ...interface{})
- func Noticef(format string, args ...interface{})
- func Output(level int, args ...interface{})
- func Outputf(level int, format string, args ...interface{})
- func Range[...](value, min, max T) bool
- func Reload(args ...interface{}) error
- func Status(string) error
- func Stop(args ...interface{}) error
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- func Watchdog() error
- type Algo
- type Duration
- type Future
- type Hash
- type Ring64
- type ShutdownStrategy
- type TaskPool
- func (pool *TaskPool) Context() context.Context
- func (pool *TaskPool) Dispatch(fn func(args ...interface{}), args ...interface{}) bool
- func (pool *TaskPool) Done() <-chan struct{}
- func (pool *TaskPool) Shutdown()
- func (pool *TaskPool) TryDispatch(fn func(args ...interface{}), args ...interface{}) bool
- type TaskQueue
- func (tq *TaskQueue) Context() context.Context
- func (tq *TaskQueue) Dispatch(fn func(args ...interface{}), args ...interface{}) bool
- func (tq *TaskQueue) Done() <-chan struct{}
- func (tq *TaskQueue) Notify() bool
- func (tq *TaskQueue) Reset(timer time.Duration) bool
- func (tq *TaskQueue) SetShutdown(handler context.CancelFunc)
- func (tq *TaskQueue) SetTimeout(handler TimeoutStrategy)
- func (tq *TaskQueue) Shutdown()
- func (tq *TaskQueue) TryDispatch(fn func(args ...interface{}), args ...interface{}) bool
- type Time
- type TimeoutStrategy
- type Timer
- func (t *Timer) At(expires time.Time, fn func(...interface{}), args ...interface{}) uint64
- func (t *Timer) Cancel(id uint64) bool
- func (t *Timer) Context() context.Context
- func (t *Timer) Done() <-chan struct{}
- func (t *Timer) Find(id uint64) time.Time
- func (t *Timer) Periodic(period time.Duration, fn func(...interface{}), args ...interface{}) uint64
- func (t *Timer) Stop()
- type TimerQueue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Duration ¶ added in v1.1.0
service.Duration allows json marshalling and prefers second intervals
func NewDuration ¶ added in v1.1.0
We convert from int to duration by seconds...
func (Duration) MarshalJSON ¶ added in v1.1.0
Marshall as duration string
func (*Duration) UnmarshalJSON ¶ added in v1.1.0
Unmarshal from float or string form
type Future ¶ added in v1.2.2
type Future[T any] struct { // contains filtered or unexported fields }
func MakeFuture ¶ added in v1.2.2
type ShutdownStrategy ¶ added in v1.1.0
type ShutdownStrategy context.CancelFunc
type TaskPool ¶ added in v1.3.0
type TaskPool struct {
Size int
// contains filtered or unexported fields
}
TaskPool struct to manage tasks
func NewTaskPool ¶ added in v1.3.0
NewTaskQueue creates a new TaskPool with cancel and starts processing tasks
func (*TaskPool) Done ¶ added in v1.3.0
func (pool *TaskPool) Done() <-chan struct{}
Get the done channel of the task scheduler
func (*TaskPool) TryDispatch ¶ added in v1.3.0
Try to dispatch a task to the queue
type TaskQueue ¶ added in v1.1.0
type TaskQueue struct {
// contains filtered or unexported fields
}
TaskQueue struct to manage tasks
func NewTaskQueue ¶ added in v1.1.0
func NewTaskQueue(bufferSize int, timeoutStrategy TimeoutStrategy, shutdownStrategy context.CancelFunc) *TaskQueue
NewTaskQueue creates a new TaskQueue and starts processing tasks
func NewTaskQueueFromContext ¶ added in v1.2.2
func NewTaskQueueFromContext(base context.Context, bufferSize int, timeoutStrategy TimeoutStrategy) *TaskQueue
NewTaskQueue creates a new TaskQueue with cancel and starts processing tasks
func (*TaskQueue) Done ¶ added in v1.2.2
func (tq *TaskQueue) Done() <-chan struct{}
Get the done channel of the task scheduler
func (*TaskQueue) SetShutdown ¶ added in v1.1.0
func (tq *TaskQueue) SetShutdown(handler context.CancelFunc)
func (*TaskQueue) SetTimeout ¶ added in v1.1.0
func (tq *TaskQueue) SetTimeout(handler TimeoutStrategy)
func (*TaskQueue) Shutdown ¶ added in v1.1.0
func (tq *TaskQueue) Shutdown()
Shutdown stops the queue and waits for all tasks to complete
func (*TaskQueue) TryDispatch ¶ added in v1.2.1
Try to dispatch a task to the queue
type Time ¶ added in v1.1.0
service.Time reports utc and truncates to nearest second
func (Time) MarshalJSON ¶ added in v1.1.0
Marshall as time string (zulu time) nearest second
func (*Time) UnmarshalJSON ¶ added in v1.1.0
Unmarshal from float or string form
type TimeoutStrategy ¶ added in v1.1.0
TimeoutStrategy is a function type that returns a duration
type Timer ¶ added in v1.2.0
type Timer struct {
// contains filtered or unexported fields
}
func NewTimerWithCancel ¶ added in v1.2.2
NewTimer creates a new timer with cancel
type TimerQueue ¶ added in v1.2.0
type TimerQueue []*timerItem
TaskQueue is a priority queue of tasks based on their execution time
func (TimerQueue) Len ¶ added in v1.2.0
func (tq TimerQueue) Len() int
func (TimerQueue) Less ¶ added in v1.2.0
func (tq TimerQueue) Less(i, j int) bool
func (*TimerQueue) Pop ¶ added in v1.2.0
func (tq *TimerQueue) Pop() interface{}
func (*TimerQueue) Push ¶ added in v1.2.0
func (tq *TimerQueue) Push(x interface{})
func (TimerQueue) Swap ¶ added in v1.2.0
func (tq TimerQueue) Swap(i, j int)