mongodb

package
v0.0.0-...-a514ca2 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoDB

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

MongoDB provides an MongoDB database server backend.

func NewMongoDB

func NewMongoDB(conf config.MongoDB) (*MongoDB, error)

func (*MongoDB) Close

func (db *MongoDB) Close()

Close closes the database session.

func (*MongoDB) DeleteNode

func (db *MongoDB) DeleteNode(ctx context.Context, req *scheduler.Node) (*scheduler.DeleteNodeResponse, error)

DeleteNode deletes a node

func (*MongoDB) GetNode

func (db *MongoDB) GetNode(ctx context.Context, req *scheduler.GetNodeRequest) (*scheduler.Node, error)

GetNode gets a node

func (*MongoDB) GetTask

func (db *MongoDB) GetTask(ctx context.Context, req *tes.GetTaskRequest) (*tes.Task, error)

GetTask gets a task, which describes a running task

func (*MongoDB) Init

func (db *MongoDB) Init() error

Init creates tables in MongoDB.

func (*MongoDB) ListNodes

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

func (*MongoDB) ListTasks

func (db *MongoDB) ListTasks(ctx context.Context, req *tes.ListTasksRequest) (*tes.ListTasksResponse, error)

ListTasks returns a list of taskIDs

func (*MongoDB) PutNode

func (db *MongoDB) PutNode(ctx context.Context, node *scheduler.Node) (*scheduler.PutNodeResponse, error)

PutNode is an RPC endpoint that is used by nodes to send heartbeats and status updates, such as completed tasks. The server responds with updated information for the node, such as canceled tasks.

func (*MongoDB) ReadQueue

func (db *MongoDB) ReadQueue(n int) []*tes.Task

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

func (*MongoDB) TaskStateCounts

func (db *MongoDB) TaskStateCounts(ctx context.Context) (map[string]int32, error)

TaskStateCounts returns the number of tasks in each state.

func (*MongoDB) WriteEvent

func (db *MongoDB) 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