-
Notifications
You must be signed in to change notification settings - Fork 2k
/
db_error.go
151 lines (115 loc) · 4.28 KB
/
db_error.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package state
import (
"fmt"
arstate "github.com/hashicorp/nomad/client/allocrunner/state"
"github.com/hashicorp/nomad/client/allocrunner/taskrunner/state"
dmstate "github.com/hashicorp/nomad/client/devicemanager/state"
"github.com/hashicorp/nomad/client/dynamicplugins"
driverstate "github.com/hashicorp/nomad/client/pluginmanager/drivermanager/state"
"github.com/hashicorp/nomad/client/serviceregistration/checks"
cstructs "github.com/hashicorp/nomad/client/structs"
"github.com/hashicorp/nomad/nomad/structs"
)
// ErrDB implements a StateDB that returns errors on restore methods, used for testing
type ErrDB struct {
// Allocs is a preset slice of allocations used in GetAllAllocations
Allocs []*structs.Allocation
}
func (m *ErrDB) Name() string {
return "errdb"
}
func (m *ErrDB) Upgrade() error {
return nil
}
func (m *ErrDB) GetAllAllocations() ([]*structs.Allocation, map[string]error, error) {
return m.Allocs, nil, nil
}
func (m *ErrDB) PutAllocation(alloc *structs.Allocation, opts ...WriteOption) error {
return fmt.Errorf("Error!")
}
func (m *ErrDB) GetDeploymentStatus(allocID string) (*structs.AllocDeploymentStatus, error) {
return nil, fmt.Errorf("Error!")
}
func (m *ErrDB) PutDeploymentStatus(allocID string, ds *structs.AllocDeploymentStatus) error {
return fmt.Errorf("Error!")
}
func (m *ErrDB) GetNetworkStatus(allocID string) (*structs.AllocNetworkStatus, error) {
return nil, fmt.Errorf("Error!")
}
func (m *ErrDB) PutNetworkStatus(allocID string, ns *structs.AllocNetworkStatus, opts ...WriteOption) error {
return fmt.Errorf("Error!")
}
func (m *ErrDB) PutAcknowledgedState(allocID string, state *arstate.State, opts ...WriteOption) error {
return fmt.Errorf("Error!")
}
func (m *ErrDB) GetAcknowledgedState(allocID string) (*arstate.State, error) {
return nil, fmt.Errorf("Error!")
}
func (m *ErrDB) PutAllocVolumes(allocID string, state *arstate.AllocVolumes, opts ...WriteOption) error {
return fmt.Errorf("Error!")
}
func (m *ErrDB) GetAllocVolumes(allocID string) (*arstate.AllocVolumes, error) {
return nil, fmt.Errorf("Error!")
}
func (m *ErrDB) GetTaskRunnerState(allocID string, taskName string) (*state.LocalState, *structs.TaskState, error) {
return nil, nil, fmt.Errorf("Error!")
}
func (m *ErrDB) PutTaskRunnerLocalState(allocID string, taskName string, val *state.LocalState) error {
return fmt.Errorf("Error!")
}
func (m *ErrDB) PutTaskState(allocID string, taskName string, state *structs.TaskState) error {
return fmt.Errorf("Error!")
}
func (m *ErrDB) DeleteTaskBucket(allocID, taskName string) error {
return fmt.Errorf("Error!")
}
func (m *ErrDB) DeleteAllocationBucket(allocID string, opts ...WriteOption) error {
return fmt.Errorf("Error!")
}
func (m *ErrDB) PutDevicePluginState(ps *dmstate.PluginState) error {
return fmt.Errorf("Error!")
}
func (m *ErrDB) GetDynamicPluginRegistryState() (*dynamicplugins.RegistryState, error) {
return nil, fmt.Errorf("Error!")
}
func (m *ErrDB) PutDynamicPluginRegistryState(state *dynamicplugins.RegistryState) error {
return fmt.Errorf("Error!")
}
func (m *ErrDB) GetDevicePluginState() (*dmstate.PluginState, error) {
return nil, fmt.Errorf("Error!")
}
func (m *ErrDB) GetDriverPluginState() (*driverstate.PluginState, error) {
return nil, fmt.Errorf("Error!")
}
func (m *ErrDB) PutDriverPluginState(ps *driverstate.PluginState) error {
return fmt.Errorf("Error!")
}
func (m *ErrDB) PutCheckResult(allocID string, qr *structs.CheckQueryResult) error {
return fmt.Errorf("Error!")
}
func (m *ErrDB) GetCheckResults() (checks.ClientResults, error) {
return nil, fmt.Errorf("Error!")
}
func (m *ErrDB) DeleteCheckResults(allocID string, checkIDs []structs.CheckID) error {
return fmt.Errorf("Error!")
}
func (m *ErrDB) PurgeCheckResults(allocID string) error {
return fmt.Errorf("Error!")
}
func (m *ErrDB) PutNodeMeta(map[string]*string) error {
return fmt.Errorf("Error!")
}
func (m *ErrDB) GetNodeMeta() (map[string]*string, error) {
return nil, fmt.Errorf("Error!")
}
func (m *ErrDB) PutNodeRegistration(reg *cstructs.NodeRegistration) error {
return fmt.Errorf("Error!")
}
func (m *ErrDB) GetNodeRegistration() (*cstructs.NodeRegistration, error) {
return nil, fmt.Errorf("Error!")
}
func (m *ErrDB) Close() error {
return fmt.Errorf("Error!")
}