elastic

package
v0.0.0-...-c9c84e3 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 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()

Close closes the database client.

func (*Elastic) DeleteNode

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

DeleteNode deletes a node by ID.

func (*Elastic) GetNode

func (es *Elastic) GetNode(ctx context.Context, req *scheduler.GetNodeRequest) (*scheduler.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() error

Init creates the Elasticsearch indices.

func (*Elastic) ListNodes

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 *scheduler.Node) (*scheduler.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) ReadQueue

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

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

func (*Elastic) WriteEvent

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

WriteEvent writes a task update event.

Jump to

Keyboard shortcuts

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