datastore

package
v0.1.163 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DATASTORE_POSTGRES = "postgres"
)

Variables

View Source
var (
	ErrTaskNotFound         = errors.New("task not found")
	ErrNodeNotFound         = errors.New("node not found")
	ErrJobNotFound          = errors.New("job not found")
	ErrScheduledJobNotFound = errors.New("scheduled job not found")
	ErrUserNotFound         = errors.New("user not found")
	ErrRoleNotFound         = errors.New("role not found")
	ErrContextNotFound      = errors.New("context not found")
)

Functions

This section is empty.

Types

type Datastore

type Datastore interface {
	CreateTask(ctx context.Context, t *tork.Task) error
	UpdateTask(ctx context.Context, id string, modify func(u *tork.Task) error) error
	GetTaskByID(ctx context.Context, id string) (*tork.Task, error)
	GetActiveTasks(ctx context.Context, jobID string) ([]*tork.Task, error)
	GetNextTask(ctx context.Context, parentTaskID string) (*tork.Task, error)
	CreateTaskLogPart(ctx context.Context, p *tork.TaskLogPart) error
	GetTaskLogParts(ctx context.Context, taskID, q string, page, size int) (*Page[*tork.TaskLogPart], error)

	CreateNode(ctx context.Context, n *tork.Node) error
	UpdateNode(ctx context.Context, id string, modify func(u *tork.Node) error) error
	GetNodeByID(ctx context.Context, id string) (*tork.Node, error)
	GetActiveNodes(ctx context.Context) ([]*tork.Node, error)

	CreateJob(ctx context.Context, j *tork.Job) error
	UpdateJob(ctx context.Context, id string, modify func(u *tork.Job) error) error
	GetJobByID(ctx context.Context, id string) (*tork.Job, error)
	GetJobSummaryByID(ctx context.Context, id string) (*tork.Job, error)
	GetJobExecution(ctx context.Context, jobID string, page, size int, sort string) (*Page[*tork.TaskSummary], error)
	GetJobLogParts(ctx context.Context, jobID, q string, page, size int) (*Page[*tork.TaskLogPart], error)
	GetJobs(ctx context.Context, currentUser, q string, page, size int) (*Page[*tork.JobSummary], error)

	CreateScheduledJob(ctx context.Context, s *tork.ScheduledJob) error
	GetActiveScheduledJobs(ctx context.Context) ([]*tork.ScheduledJob, error)
	GetScheduledJobs(ctx context.Context, currentUser string, page, size int) (*Page[*tork.ScheduledJobSummary], error)
	GetScheduledJobByID(ctx context.Context, id string) (*tork.ScheduledJob, error)
	UpdateScheduledJob(ctx context.Context, id string, modify func(u *tork.ScheduledJob) error) error
	DeleteScheduledJob(ctx context.Context, id string) error

	CreateUser(ctx context.Context, u *tork.User) error
	GetUser(ctx context.Context, username string) (*tork.User, error)

	CreateRole(ctx context.Context, r *tork.Role) error
	GetRole(ctx context.Context, id string) (*tork.Role, error)
	GetRoles(ctx context.Context) ([]*tork.Role, error)
	GetUserRoles(ctx context.Context, userID string) ([]*tork.Role, error)
	AssignRole(ctx context.Context, userID, roleID string) error
	UnassignRole(ctx context.Context, userID, roleID string) error

	GetMetrics(ctx context.Context) (*tork.Metrics, error)

	WithTx(ctx context.Context, f func(tx Datastore) error) error

	HealthCheck(ctx context.Context) error
}

type Page

type Page[T any] struct {
	Items      []T `json:"items"`
	Number     int `json:"number"`
	Size       int `json:"size"`
	TotalPages int `json:"totalPages"`
	TotalItems int `json:"totalItems"`
}

type Provider added in v0.1.1

type Provider func() (Datastore, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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