boltdb

package
v0.0.0-...-69999d2 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unknown       = tes.State_UNKNOWN
	Queued        = tes.State_QUEUED
	Running       = tes.State_RUNNING
	Paused        = tes.State_PAUSED
	Complete      = tes.State_COMPLETE
	ExecutorError = tes.State_EXECUTOR_ERROR
	SystemError   = tes.State_SYSTEM_ERROR
	Canceled      = tes.State_CANCELED
	Initializing  = tes.State_INITIALIZING
)

State variables for convenience

Variables

View Source
var ExecutorLogs = []byte("executor-logs")

ExecutorLogs maps (task ID + executor index) -> tes.ExecutorLog struct

View Source
var ExecutorStderr = []byte("executor-stderr")

ExecutorStderr maps (task ID + executor index) -> tes.ExecutorLog.Stderr string

View Source
var ExecutorStdout = []byte("executor-stdout")

ExecutorStdout maps (task ID + executor index) -> tes.ExecutorLog.Stdout string

View Source
var Nodes = []byte("nodes")

Nodes maps: node ID -> pbs.Node struct

View Source
var SysLogs = []byte("system-logs")

SysLogs defeines the name of a bucket with maps task ID -> tes.TaskLog.SystemLogs

View Source
var TaskBucket = []byte("tasks")

TaskBucket defines the name of a bucket which maps task ID -> tes.Task struct

View Source
var TaskState = []byte("tasks-state")

TaskState maps: task ID -> state string

View Source
var TasksLog = []byte("tasks-log")

TasksLog defines the name of a bucket which maps task ID -> tes.TaskLog struct

View Source
var TasksQueued = []byte("tasks-queued")

TasksQueued defines the name of a bucket which maps task ID -> nil

Functions

This section is empty.

Types

type BoltDB

type BoltDB struct {
	scheduler.UnimplementedSchedulerServiceServer
	// contains filtered or unexported fields
}

BoltDB provides handlers for gRPC endpoints. Data is stored/retrieved from the BoltDB key-value database.

func NewBoltDB

func NewBoltDB(conf config.BoltDB) (*BoltDB, error)

NewBoltDB returns a new instance of BoltDB, accessing the database at the given path, and including the given ServerConfig.

func (*BoltDB) Close

func (taskBolt *BoltDB) Close()

func (*BoltDB) DeleteNode

func (taskBolt *BoltDB) DeleteNode(ctx context.Context, node *scheduler.Node) (*scheduler.DeleteNodeResponse, error)

DeleteNode deletes the given node. Currently, the node's version field is not checked.

func (*BoltDB) GetNode

func (taskBolt *BoltDB) GetNode(ctx context.Context, req *scheduler.GetNodeRequest) (*scheduler.Node, error)

GetNode gets a node

func (*BoltDB) GetTask

func (taskBolt *BoltDB) GetTask(ctx context.Context, req *tes.GetTaskRequest) (*tes.Task, error)

GetTask gets a task, which describes a running task

func (*BoltDB) Init

func (taskBolt *BoltDB) Init() error

Init creates the required BoltDB buckets

func (*BoltDB) ListNodes

func (taskBolt *BoltDB) ListNodes(ctx context.Context, req *scheduler.ListNodesRequest) (*scheduler.ListNodesResponse, error)

ListNodes is an API endpoint that returns a list of nodes.

func (*BoltDB) ListTasks

func (taskBolt *BoltDB) ListTasks(ctx context.Context, req *tes.ListTasksRequest) (*tes.ListTasksResponse, error)

ListTasks returns a list of taskIDs

func (*BoltDB) PutNode

func (taskBolt *BoltDB) PutNode(ctx context.Context, node *scheduler.Node) (*scheduler.PutNodeResponse, error)

PutNode put a node object into the database.

For optimisic locking, if the node already exists and node.Version doesn't match the version in the database, an error is returned.

func (*BoltDB) ReadQueue

func (taskBolt *BoltDB) ReadQueue(n int) []*tes.Task

ReadQueue returns a slice of queued Tasks. Up to "n" tasks are returned.

func (*BoltDB) WriteEvent

func (taskBolt *BoltDB) WriteEvent(ctx context.Context, req *events.Event) error

WriteEvent creates an event for the server to handle.

Jump to

Keyboard shortcuts

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