worker

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Command string `mapstructure:"command"`
}

func (*Config) Bind

func (c *Config) Bind()

func (*Config) Validate

func (c *Config) Validate() error

type Queue

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

Queue schedules Worker invocations. Multiple queue requests are coalesced when made in quick succession.

func NewQueue

func NewQueue(wsSvc model.WorkspaceService, work Worker, period, timeout time.Duration) Queue

NewQueue creates a new Queue.

func (Queue) Enqueue

func (q Queue) Enqueue()

Enqueue a Worker invokcation.

func (Queue) Start

func (q Queue) Start(ctx context.Context) error

Start the Queue loop. Exits and returns when the context is done.

type ValueWorkspace

type ValueWorkspace struct {
	ID        int64             `json:"id"`
	IDHash    string            `json:"idHash"`
	Enabled   bool              `json:"enabled"`
	Nodegroup string            `json:"nodegroup"`
	Quotas    map[string]string `json:"quotas"`
	Users     []string          `json:"users"`
}

type ValueWorkspaces

type ValueWorkspaces struct {
	Workspaces []ValueWorkspace `json:"workspaces"`
}

type Worker

type Worker interface {
	Work(ctx context.Context, vwss ValueWorkspaces) error
}

type WorkerFunc

type WorkerFunc func(ctx context.Context, vwss ValueWorkspaces) error

func CmdWorker

func CmdWorker(command string) WorkerFunc

func (WorkerFunc) Work

func (wf WorkerFunc) Work(ctx context.Context, vwss ValueWorkspaces) error

Jump to

Keyboard shortcuts

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