mongodb

package
v0.0.0-...-5db00e0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2017 License: MIT Imports: 12 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 {
	// contains filtered or unexported fields
}

MongoDB provides an MongoDB database server backend.

func NewMongoDB

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

NewMongoDB returns a new MongoDB instance.

func (*MongoDB) CancelTask

func (db *MongoDB) CancelTask(ctx context.Context, req *tes.CancelTaskRequest) (*tes.CancelTaskResponse, error)

CancelTask cancels a task

func (*MongoDB) Close

func (db *MongoDB) Close() error

Close closes the database session.

func (*MongoDB) CreateEvent

func (db *MongoDB) CreateEvent(ctx context.Context, req *events.Event) (*events.CreateEventResponse, error)

CreateEvent creates an event for the server to handle.

func (*MongoDB) CreateTask

func (db *MongoDB) CreateTask(ctx context.Context, task *tes.Task) (*tes.CreateTaskResponse, error)

CreateTask provides an HTTP/gRPC endpoint for creating a task. This is part of the TES implementation.

func (*MongoDB) DeleteNode

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

DeleteNode deletes a node

func (*MongoDB) GetNode

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

GetNode gets a node

func (*MongoDB) GetServiceInfo

func (db *MongoDB) GetServiceInfo(ctx context.Context, info *tes.ServiceInfoRequest) (*tes.ServiceInfo, error)

GetServiceInfo provides an endpoint for Funnel clients to get information about this server.

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(ctx context.Context) error

Init creates tables in MongoDB.

func (*MongoDB) ListNodes

func (db *MongoDB) ListNodes(ctx context.Context, req *pbs.ListNodesRequest) (*pbs.ListNodesResponse, error)

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 *pbs.Node) (*pbs.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) QueueTask

func (db *MongoDB) QueueTask(task *tes.Task) error

QueueTask adds a task to the scheduler queue.

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) WithComputeBackend

func (db *MongoDB) WithComputeBackend(backend compute.Backend)

WithComputeBackend configures the MongoDB instance to use the given compute.Backend. The compute backend is responsible for dispatching tasks to schedulers / compute resources with its Submit method.

func (*MongoDB) Write

func (db *MongoDB) Write(req *events.Event) error

Write writes task events to the database, updating the task record they are related to. System log events are ignored.

func (*MongoDB) WriteContext

func (db *MongoDB) WriteContext(ctx context.Context, req *events.Event) error

WriteContext is Write, but with context.

Jump to

Keyboard shortcuts

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