jobsadmin

package
v0.0.0-...-6b432e0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package jobsadmin provides admin/super-admin read-only views over the background jobs queue, including a system-wide view across all orgs (and system jobs where organization_uid IS NULL) and retry-chain traversal.

Index

Constants

This section is empty.

Variables

View Source
var ErrJobNotFound = errors.New("job not found")

ErrJobNotFound is returned when a job cannot be found.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	base.HandlerBase
	// contains filtered or unexported fields
}

Handler exposes admin/super-admin read-only background-job endpoints.

func NewHandler

func NewHandler(svc Service, cfg *config.Config) *Handler

NewHandler creates a new jobsadmin handler.

func (*Handler) GetOrgJob

func (h *Handler) GetOrgJob(writer http.ResponseWriter, req *http.Request) error

GetOrgJob returns a single org job, admin-gated. GET /api/v1/orgs/:org/jobs/:uid/detail.

func (*Handler) GetOrgJobChain

func (h *Handler) GetOrgJobChain(writer http.ResponseWriter, req *http.Request) error

GetOrgJobChain returns the retry chain for an org job, admin-gated. GET /api/v1/orgs/:org/jobs/:uid/chain.

func (*Handler) GetSystemJob

func (h *Handler) GetSystemJob(writer http.ResponseWriter, req *http.Request) error

GetSystemJob returns a single job across all orgs (super-admin). GET /api/v1/system/jobs/:uid.

func (*Handler) GetSystemJobChain

func (h *Handler) GetSystemJobChain(writer http.ResponseWriter, req *http.Request) error

GetSystemJobChain returns the retry chain for a job across all orgs. GET /api/v1/system/jobs/:uid/chain.

func (*Handler) ListOrgJobs

func (h *Handler) ListOrgJobs(writer http.ResponseWriter, req *http.Request) error

ListOrgJobs lists jobs for the org, admin-gated. GET /api/v1/orgs/:org/jobs/admin.

func (*Handler) ListSystemJobs

func (h *Handler) ListSystemJobs(writer http.ResponseWriter, req *http.Request) error

ListSystemJobs lists jobs across all orgs incl. system jobs (super-admin). GET /api/v1/system/jobs.

type ListOptions

type ListOptions struct {
	Status string
	Type   string
	Limit  int
	Offset int
}

ListOptions holds filtering and pagination options.

type Service

type Service interface {
	// ListJobs lists background jobs. When orgUID is empty, all orgs are
	// returned (system mode, including organization_uid IS NULL system jobs).
	ListJobs(ctx context.Context, orgUID string, opts ListOptions) ([]*models.Job, error)
	// GetJob returns a single job. When orgUID is non-empty the job must
	// belong to that org or ErrJobNotFound is returned.
	GetJob(ctx context.Context, orgUID, uid string) (*models.Job, error)
	// RetryChain returns the ordered chain of jobs linked via previous_job_uid,
	// from the earliest ancestor to the latest descendant, that the given job
	// belongs to. The result always includes the job itself.
	RetryChain(ctx context.Context, orgUID, uid string) ([]*models.Job, error)
}

Service provides admin read-only job queries.

func NewService

func NewService(db *bun.DB) Service

NewService creates a new admin jobs service.

Jump to

Keyboard shortcuts

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