job

package
v0.3.16 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package job is the Redis-backed model.JobStore (gap #8): persists completed (and, later, in-flight) async job records so GET /v0/jobs and GET /v0/jobs/{id} have something real to serve instead of a dead job_url.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store is a Redis-backed model.JobStore.

func NewStore

func NewStore(rdb *redis.Client) *Store

NewStore returns a Store backed by rdb.

func (*Store) Get

func (s *Store) Get(ctx context.Context, id string) (model.JobRecord, bool, error)

Get returns the job record for id. ok is false (with nil error) when the id is unknown or its record has expired.

func (*Store) List

func (s *Store) List(ctx context.Context, limit int) ([]model.JobRecord, error)

List returns up to limit most-recent job records, newest first. IDs whose record already expired (index outlives data by at most one ttl window, see Put) are skipped rather than erroring.

func (*Store) Put

func (s *Store) Put(ctx context.Context, rec model.JobRecord) error

Put stores rec under "tr:job:<id>" with a TTL, and indexes it by creation time for List. Also prunes index entries older than ttl so the sorted set doesn't grow unbounded as job keys silently expire out from under it.

Jump to

Keyboard shortcuts

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