elastic

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: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Elastic

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

Elastic provides an elasticsearch database server backend.

func NewElastic

func NewElastic(conf config.Elastic) (*Elastic, error)

NewElastic returns a new Elastic instance.

func (*Elastic) Close

func (es *Elastic) Close() error

Close closes the database client.

func (*Elastic) CreateTask

func (es *Elastic) CreateTask(ctx context.Context, task *tes.Task) error

CreateTask creates a new task.

func (*Elastic) DeleteNode

func (es *Elastic) DeleteNode(ctx context.Context, node *pbs.Node) error

DeleteNode deletes a node by ID.

func (*Elastic) GetNode

func (es *Elastic) GetNode(ctx context.Context, req *pbs.GetNodeRequest) (*pbs.Node, error)

GetNode gets a node

func (*Elastic) GetTask

func (es *Elastic) GetTask(ctx context.Context, req *tes.GetTaskRequest) (*tes.Task, error)

GetTask gets a task by ID.

func (*Elastic) Init

func (es *Elastic) Init(ctx context.Context) error

Init initializing the Elasticsearch indices.

func (*Elastic) ListNodes

func (es *Elastic) ListNodes(ctx context.Context, req *pbs.ListNodesRequest) (*pbs.ListNodesResponse, error)

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

func (*Elastic) ListTasks

func (es *Elastic) ListTasks(ctx context.Context, req *tes.ListTasksRequest) (*tes.ListTasksResponse, error)

ListTasks lists tasks, duh.

func (*Elastic) PutNode

func (es *Elastic) PutNode(ctx context.Context, node *pbs.Node) (*pbs.PutNodeResponse, error)

PutNode puts a node in 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 (*Elastic) QueueTask

func (es *Elastic) QueueTask(task *tes.Task) error

QueueTask adds a task to the scheduler queue.

func (*Elastic) ReadQueue

func (es *Elastic) ReadQueue(n int) []*tes.Task

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

func (*Elastic) Write

func (es *Elastic) Write(ev *events.Event) error

func (*Elastic) WriteContext

func (es *Elastic) WriteContext(ctx context.Context, ev *events.Event) error

WriteContext writes a task update event.

type TES

type TES struct {
	*Elastic
	Backend compute.Backend
}

TES provides the TES API endpoints, backed by elasticsearch.

func NewTES

func NewTES(conf config.Elastic) (*TES, error)

NewTES creates a new TES API with the given config.

func (*TES) CancelTask

func (et *TES) CancelTask(ctx context.Context, req *tes.CancelTaskRequest) (*tes.CancelTaskResponse, error)

CancelTask cancels a task by ID.

func (*TES) CreateEvent

func (et *TES) CreateEvent(ctx context.Context, req *events.Event) (*events.CreateEventResponse, error)

CreateEvent writes a task event to the database.

func (*TES) CreateTask

func (et *TES) CreateTask(ctx context.Context, task *tes.Task) (*tes.CreateTaskResponse, error)

CreateTask creates a new task.

func (*TES) GetServiceInfo

func (et *TES) GetServiceInfo(ctx context.Context, info *tes.ServiceInfoRequest) (*tes.ServiceInfo, error)

GetServiceInfo returns service metadata.

func (*TES) GetTask

func (et *TES) GetTask(ctx context.Context, req *tes.GetTaskRequest) (*tes.Task, error)

GetTask gets a task by ID.

func (*TES) ListTasks

func (et *TES) ListTasks(ctx context.Context, req *tes.ListTasksRequest) (*tes.ListTasksResponse, error)

ListTasks lists tasks. TODO list is maybe where the having the TES api separated from the core

database breaks down.

func (*TES) WithComputeBackend

func (et *TES) WithComputeBackend(b compute.Backend)

WithComputeBackend sets the compute backend.

Jump to

Keyboard shortcuts

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