store

package
v0.0.0-...-d850389 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package store is for storing and retrieving machine.Descriptions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store interface {
	// Update the machine with the given machineID using the given callback
	// function.
	//
	// updateCallback may be called more than once (e.g. transaction retries).
	Update(ctx context.Context, machineID string, updateCallback UpdateCallback) error

	// Get returns the Description for the given machine.
	Get(ctx context.Context, machineID string) (machine.Description, error)

	// ListPowerCycle returns a list of machine names that need powercycling.
	ListPowerCycle(ctx context.Context) ([]string, error)

	// List returns a slice containing all known machines.
	List(ctx context.Context) ([]machine.Description, error)

	// Delete removes a machine from the database.
	Delete(ctx context.Context, machineID string) error

	// Get a list of Kingsford machines that aren't running tasks.
	GetFreeMachines(ctx context.Context, pool string) ([]machine.Description, error)
}

Store and retrieve machine.Descriptions.

type UpdateCallback

type UpdateCallback func(machine.Description) machine.Description

UpdateCallback is the callback that Store.Update() takes to update a single machine.Description. We use a callback because we want to compare the old state to decide the new state, along with other bits of info we can include in a closure, such as an incoming event. See also processor.Process.

Directories

Path Synopsis
cdb
Package cdb contains an implementation of ../store.Store that uses CockroachDB.
Package cdb contains an implementation of ../store.Store that uses CockroachDB.
expectedschema
Package expectedschema contains the schema the database is expected to have.
Package expectedschema contains the schema the database is expected to have.
exportschema
Application exportschema exports the expected schema as a serialized schema.Description.
Application exportschema exports the expected schema as a serialized schema.Description.
mscdbinit
Command line tool to set up the CockroachDB database for machineserver.
Command line tool to set up the CockroachDB database for machineserver.
tosql
This executable generates a go file that contains the SQL schema for machineserver defined as a string.
This executable generates a go file that contains the SQL schema for machineserver defined as a string.

Jump to

Keyboard shortcuts

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