Documentation
¶
Overview ¶
Package memory is an in-process jobsync storage driver.
It is not for production: jobs do not survive a restart, and every operation takes a process-wide lock. It exists as the control for the conformance suite. When a real driver fails a test, the memory driver answers the question "is the test wrong, or is the driver wrong?" — if the simplest possible implementation cannot satisfy it, the test is the thing to fix.
It is also genuinely useful in application tests, where a real queue is usually more infrastructure than the test needed.
Index ¶
- type Storage
- func (s *Storage) AdvanceSchedule(ctx context.Context, id string, lastRun, nextRun time.Time) error
- func (s *Storage) Close() error
- func (s *Storage) Counts(ctx context.Context) (jobsync.Counts, error)
- func (s *Storage) Delete(ctx context.Context, ids []string) error
- func (s *Storage) DueSchedules(ctx context.Context, now time.Time) ([]jobsync.Schedule, error)
- func (s *Storage) Enqueue(ctx context.Context, jobs []*jobsync.Job) error
- func (s *Storage) Extend(ctx context.Context, ids []string, owner string, lease time.Duration) error
- func (s *Storage) Fetch(ctx context.Context, queues []string, n int, owner string, lease time.Duration) ([]*jobsync.Job, error)
- func (s *Storage) Finish(ctx context.Context, id, owner string, r jobsync.Result) error
- func (s *Storage) Heartbeat(ctx context.Context, info jobsync.ServerInfo, ttl time.Duration) error
- func (s *Storage) JobHistory(ctx context.Context, id string) (*jobsync.Job, []jobsync.Transition, error)
- func (s *Storage) ListJobs(ctx context.Context, f jobsync.Filter) ([]*jobsync.Job, int64, error)
- func (s *Storage) ListSchedules(ctx context.Context) ([]jobsync.Schedule, error)
- func (s *Storage) Lock(ctx context.Context, key string, ttl time.Duration) (string, error)
- func (s *Storage) PauseQueue(ctx context.Context, name string) error
- func (s *Storage) PausedQueues(ctx context.Context) ([]string, error)
- func (s *Storage) QueueStats(ctx context.Context) ([]jobsync.QueueStat, error)
- func (s *Storage) Reclaim(ctx context.Context) (int, error)
- func (s *Storage) RemoveSchedule(ctx context.Context, id string) error
- func (s *Storage) Requeue(ctx context.Context, ids []string) error
- func (s *Storage) ResumeQueue(ctx context.Context, name string) error
- func (s *Storage) SaveSchedule(ctx context.Context, sc jobsync.Schedule) error
- func (s *Storage) Servers(ctx context.Context) ([]jobsync.ServerInfo, error)
- func (s *Storage) SetSchedulePaused(ctx context.Context, id string, paused bool) error
- func (s *Storage) Throughput(ctx context.Context, since time.Time, bucket time.Duration) ([]jobsync.Bucket, error)
- func (s *Storage) Unlock(ctx context.Context, key, token string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
func (*Storage) AdvanceSchedule ¶
func (*Storage) DueSchedules ¶
func (*Storage) JobHistory ¶
func (*Storage) ListSchedules ¶
func (*Storage) PauseQueue ¶
PauseQueue implements jobsync.QueueControl.
func (*Storage) PausedQueues ¶
func (*Storage) QueueStats ¶
func (*Storage) RemoveSchedule ¶
func (*Storage) SaveSchedule ¶
SaveSchedule implements jobsync.Schedules. It is an upsert: every deploy re-registers its schedules, and appending would fire a job once per deploy that had ever happened.
func (*Storage) Servers ¶
Servers reports nothing: an in-process storage has exactly one server and it is the one reading this. Returning an empty list is the contract's answer for a driver that keeps no registry.
func (*Storage) SetSchedulePaused ¶
SetSchedulePaused implements jobsync.Schedules.