memoryprovider

package
v1.27.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTaskTypeRequired = errors.New("memoryprovider: task type cannot be empty")
	ErrNilHandler       = errors.New("memoryprovider: handler cannot be nil")
	// ErrUnsupportedQueue reports an EnqueuePolicy.Queue this provider has
	// no queue for: it runs a single in-process queue. Naming another one
	// used to be accepted and ignored (NU-12).
	ErrUnsupportedQueue = errors.New("memoryprovider: named queues are not supported (only the default queue exists)")
)
View Source
var (
	ErrNilScheduler = errors.New("memoryprovider: scheduler is nil")
)

Functions

This section is empty.

Types

type Inspector

type Inspector struct {
	// contains filtered or unexported fields
}

func NewInspector

func NewInspector(manager *Manager) *Inspector

func (*Inspector) InspectRuntime

func (i *Inspector) InspectRuntime() tasks.RuntimeSnapshot

func (*Inspector) OperateQueue

func (i *Inspector) OperateQueue(queue, action string) (tasks.QueueActionResult, error)

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(cfg tasks.Config, logger *slog.Logger) (*Manager, error)

func (*Manager) Close

func (m *Manager) Close() error

func (*Manager) EnqueueJSON

func (m *Manager) EnqueueJSON(taskType string, payload any) (string, error)

func (*Manager) EnqueueJSONCtx

func (m *Manager) EnqueueJSONCtx(ctx context.Context, taskType string, payload any) (string, error)

func (*Manager) EnqueueJSONCtxWithPolicy

func (m *Manager) EnqueueJSONCtxWithPolicy(ctx context.Context, taskType string, payload any, policy tasks.EnqueuePolicy) (string, error)

func (*Manager) EnqueueJSONWithPolicy

func (m *Manager) EnqueueJSONWithPolicy(taskType string, payload any, policy tasks.EnqueuePolicy) (string, error)

func (*Manager) HandleFunc

func (m *Manager) HandleFunc(taskType string, handler tasks.HandlerFunc) error

func (*Manager) Retried

func (m *Manager) Retried() int64

Retried reports how many handler attempts were retried after a failure.

func (*Manager) Run

func (m *Manager) Run(ctx context.Context) error

type Scheduler

type Scheduler struct {
	// contains filtered or unexported fields
}

func NewScheduler

func NewScheduler(cfg SchedulerConfig) (*Scheduler, error)

func (*Scheduler) Close

func (s *Scheduler) Close() error

func (*Scheduler) Dropped

func (s *Scheduler) Dropped() int64

Dropped reports how many scheduled ticks failed to enqueue.

func (*Scheduler) RegisterJSON

func (s *Scheduler) RegisterJSON(spec, taskType string, payload any, policy tasks.EnqueuePolicy) (string, error)

func (*Scheduler) Start

func (s *Scheduler) Start() error

func (*Scheduler) Unregister

func (s *Scheduler) Unregister(entryID string) error

type SchedulerConfig

type SchedulerConfig struct {
	Manager  *Manager
	Location *time.Location
	// Logger receives the ticks that could not be enqueued; nil uses
	// the manager's logger.
	Logger *slog.Logger
}

type Task

type Task struct {
	// contains filtered or unexported fields
}

func (*Task) Payload

func (t *Task) Payload() []byte

func (*Task) Type

func (t *Task) Type() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL