2018-08-08 00:46:37 +00:00
|
|
|
package state
|
|
|
|
|
|
|
|
import (
|
2018-10-04 23:22:01 +00:00
|
|
|
"github.com/hashicorp/nomad/client/allocrunner/taskrunner/state"
|
2018-11-01 01:00:30 +00:00
|
|
|
dmstate "github.com/hashicorp/nomad/client/devicemanager/state"
|
2020-03-12 20:24:58 +00:00
|
|
|
"github.com/hashicorp/nomad/client/dynamicplugins"
|
2018-11-28 03:42:22 +00:00
|
|
|
driverstate "github.com/hashicorp/nomad/client/pluginmanager/drivermanager/state"
|
2022-06-07 14:18:19 +00:00
|
|
|
"github.com/hashicorp/nomad/client/serviceregistration/checks"
|
2018-08-08 00:46:37 +00:00
|
|
|
"github.com/hashicorp/nomad/nomad/structs"
|
|
|
|
)
|
|
|
|
|
2018-09-27 00:29:08 +00:00
|
|
|
// NoopDB implements a StateDB that does not persist any data.
|
|
|
|
type NoopDB struct{}
|
2018-08-08 00:46:37 +00:00
|
|
|
|
2018-10-16 22:17:36 +00:00
|
|
|
func (n NoopDB) Name() string {
|
|
|
|
return "noopdb"
|
|
|
|
}
|
|
|
|
|
2018-12-07 01:24:43 +00:00
|
|
|
func (n NoopDB) Upgrade() error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2018-09-27 00:29:08 +00:00
|
|
|
func (n NoopDB) GetAllAllocations() ([]*structs.Allocation, map[string]error, error) {
|
2018-08-08 00:46:37 +00:00
|
|
|
return nil, nil, nil
|
|
|
|
}
|
|
|
|
|
2020-10-20 20:15:37 +00:00
|
|
|
func (n NoopDB) PutAllocation(alloc *structs.Allocation, opts ...WriteOption) error {
|
2018-08-08 00:46:37 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2018-12-07 01:24:43 +00:00
|
|
|
func (n NoopDB) GetDeploymentStatus(allocID string) (*structs.AllocDeploymentStatus, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n NoopDB) PutDeploymentStatus(allocID string, ds *structs.AllocDeploymentStatus) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-10-12 17:43:04 +00:00
|
|
|
func (n NoopDB) GetNetworkStatus(allocID string) (*structs.AllocNetworkStatus, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
2020-10-20 20:15:37 +00:00
|
|
|
func (n NoopDB) PutNetworkStatus(allocID string, ds *structs.AllocNetworkStatus, opts ...WriteOption) error {
|
2020-10-12 17:43:04 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2018-09-27 00:29:08 +00:00
|
|
|
func (n NoopDB) GetTaskRunnerState(allocID string, taskName string) (*state.LocalState, *structs.TaskState, error) {
|
2018-08-08 00:46:37 +00:00
|
|
|
return nil, nil, nil
|
|
|
|
}
|
|
|
|
|
2018-10-16 22:17:36 +00:00
|
|
|
func (n NoopDB) PutTaskRunnerLocalState(allocID string, taskName string, val *state.LocalState) error {
|
2018-08-08 00:46:37 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2018-09-27 00:29:08 +00:00
|
|
|
func (n NoopDB) PutTaskState(allocID string, taskName string, state *structs.TaskState) error {
|
2018-08-08 00:46:37 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2018-09-27 00:29:08 +00:00
|
|
|
func (n NoopDB) DeleteTaskBucket(allocID, taskName string) error {
|
2018-08-23 19:03:17 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-10-20 20:15:37 +00:00
|
|
|
func (n NoopDB) DeleteAllocationBucket(allocID string, opts ...WriteOption) error {
|
2018-08-23 19:03:17 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2018-11-01 01:00:30 +00:00
|
|
|
func (n NoopDB) PutDevicePluginState(ps *dmstate.PluginState) error {
|
2018-09-28 17:09:01 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2018-11-01 01:00:30 +00:00
|
|
|
func (n NoopDB) GetDevicePluginState() (*dmstate.PluginState, error) {
|
2018-09-28 17:09:01 +00:00
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
2018-11-28 03:42:22 +00:00
|
|
|
func (n NoopDB) PutDriverPluginState(ps *driverstate.PluginState) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n NoopDB) GetDriverPluginState() (*driverstate.PluginState, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
2020-03-12 20:24:58 +00:00
|
|
|
func (n NoopDB) PutDynamicPluginRegistryState(ps *dynamicplugins.RegistryState) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n NoopDB) GetDynamicPluginRegistryState() (*dynamicplugins.RegistryState, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
2022-06-07 14:18:19 +00:00
|
|
|
func (n NoopDB) PutCheckResult(allocID string, qr *structs.CheckQueryResult) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n NoopDB) GetCheckResults() (checks.ClientResults, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n NoopDB) DeleteCheckResults(allocID string, checkIDs []structs.CheckID) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n NoopDB) PurgeCheckResults(allocID string) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2018-09-27 00:29:08 +00:00
|
|
|
func (n NoopDB) Close() error {
|
2018-08-08 00:46:37 +00:00
|
|
|
return nil
|
|
|
|
}
|