open-nomad/client/state/interface.go
Michael Schurter e42154fc46 implement stopping, destroying, and disk migration
* Stopping an alloc is implemented via Updates but update hooks are
  *not* run.
* Destroying an alloc is a best effort cleanup.
* AllocRunner destroy hooks implemented.
* Disk migration and blocking on a previous allocation exiting moved to
  its own package to avoid cycles. Now only depends on alloc broadcaster
  instead of also using a waitch.
* AllocBroadcaster now only drops stale allocations and always keeps the
  latest version.
* Made AllocDir safe for concurrent use

Lots of internal contexts that are currently unused. Unsure if they
should be used or removed.
2018-10-16 16:53:30 -07:00

19 lines
690 B
Go

package state
import (
"github.com/hashicorp/nomad/client/allocrunnerv2/taskrunner/state"
"github.com/hashicorp/nomad/nomad/structs"
)
// StateDB implementations store and load Nomad client state.
type StateDB interface {
GetAllAllocations() ([]*structs.Allocation, map[string]error, error)
PutAllocation(*structs.Allocation) error
GetTaskRunnerState(allocID, taskName string) (*state.LocalState, *structs.TaskState, error)
PutTaskRunnerLocalState(allocID, taskName string, val interface{}) error
PutTaskState(allocID, taskName string, state *structs.TaskState) error
DeleteTaskBucket(allocID, taskName string) error
DeleteAllocationBucket(allocID string) error
Close() error
}