-
Notifications
You must be signed in to change notification settings - Fork 0
/
NullStateStore.go
49 lines (43 loc) · 1.71 KB
/
NullStateStore.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
package state
// Dummy state store implementation that doesn't do anything.
//
// It can be used in testing or in situations when state management is not required
// but shall be disabled.
type NullStateStore struct {
}
func NewEmptyNullStateStore() *NullStateStore {
return &NullStateStore{}
}
// Loads state from the store using its key.
// If value is missing in the stored it returns nil.
//
// - correlationId (optional) transaction id to trace execution through call chain.
// - key a unique state key.
// Returns the state value or nil if value wasn't found.
func (c *NullStateStore) Load(correlationId string, key string) interface{} {
return nil
}
// Loads an array of states from the store using their keys.
//
// - correlationId (optional) transaction id to trace execution through call chain.
// - keys unique state keys.
// Returns an array with state values and their corresponding keys.
func (c *NullStateStore) LoadBulk(correlationId string, keys []string) []*StateValue {
return []*StateValue{}
}
// Saves state into the store.
//
// - correlationId (optional) transaction id to trace execution through call chain.
// - key a unique state key.
// - value a state value.
// Returns The state that was stored in the store.
func (c *NullStateStore) Save(correlationId string, key string, value interface{}) interface{} {
return value
}
// Deletes a state from the store by its key.
//
// - correlationId (optional) transaction id to trace execution through call chain.
// - key a unique value key.
func (c *NullStateStore) Delete(correlationId string, key string) interface{} {
return nil
}