tasks

package
v0.0.0-...-ef84630 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 6 Imported by: 0

README

Tasks

This package implements wrappers for API-exposed tasks. This is to allow for safe customer monitoring of customer triggered work. This package allows Asynq tasks to be securely wrapped to bind them to specific auth contexts. In the future this might evolve into a fully database-backed system that would allow listing all tasks for an actor.

Documentation

Index

Constants

View Source
const (
	TrackedViaAsynq = "asynq"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Actor

type Actor interface {
	GetId() apid.ID
}

type Encrypt

type Encrypt interface {
	EncryptGlobal(ctx context.Context, data []byte) (encfield.EncryptedField, error)
	Decrypt(ctx context.Context, ef encfield.EncryptedField) ([]byte, error)
}

type TaskInfo

type TaskInfo struct {
	TrackedVia TrackedVia `json:"tracked_via"`
	ActorId    apid.ID    `json:"actor_id,omitempty"`
	AsynqId    string     `json:"asynq_id,omitempty"`
	AsynqQueue string     `json:"asynq_queue,omitempty"`
	AsynqType  string     `json:"asynq_type,omitempty"`
}

func FromAsynqTask

func FromAsynqTask(task *asynq.TaskInfo) *TaskInfo

func FromSecureEncryptedString

func FromSecureEncryptedString(ctx context.Context, e Encrypt, s string) (*TaskInfo, error)

func (*TaskInfo) BindToActor

func (ti *TaskInfo) BindToActor(actor Actor) *TaskInfo

func (*TaskInfo) ToSecureEncryptedString

func (ti *TaskInfo) ToSecureEncryptedString(ctx context.Context, e Encrypt) (string, error)

type TrackedVia

type TrackedVia string

TrackedVia allows for multiple backends for tracking tasks. For now, just asynq.

Jump to

Keyboard shortcuts

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