-
Notifications
You must be signed in to change notification settings - Fork 85
/
mock_store.go
55 lines (43 loc) · 2.15 KB
/
mock_store.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
package compute
import (
"context"
"github.com/bacalhau-project/bacalhau/pkg/compute/store"
)
type CallbackStore struct {
GetExecutionFn func(ctx context.Context, id string) (store.LocalExecutionState, error)
GetExecutionsFn func(ctx context.Context, id string) ([]store.LocalExecutionState, error)
GetLiveExecutionsFn func(ctx context.Context) ([]store.LocalExecutionState, error)
GetExecutionHistoryFn func(ctx context.Context, id string) ([]store.LocalStateHistory, error)
CreateExecutionFn func(ctx context.Context, execution store.LocalExecutionState) error
UpdateExecutionStateFn func(ctx context.Context, request store.UpdateExecutionStateRequest) error
DeleteExecutionFn func(ctx context.Context, id string) error
GetExecutionCountFn func(ctx context.Context, state store.LocalExecutionStateType) (uint64, error)
CloseFn func(ctx context.Context) error
}
func (m *CallbackStore) GetExecution(ctx context.Context, id string) (store.LocalExecutionState, error) {
return m.GetExecutionFn(ctx, id)
}
func (m *CallbackStore) GetExecutions(ctx context.Context, jobID string) ([]store.LocalExecutionState, error) {
return m.GetExecutionsFn(ctx, jobID)
}
func (m *CallbackStore) GetLiveExecutions(ctx context.Context) ([]store.LocalExecutionState, error) {
return m.GetLiveExecutionsFn(ctx)
}
func (m *CallbackStore) GetExecutionHistory(ctx context.Context, id string) ([]store.LocalStateHistory, error) {
return m.GetExecutionHistoryFn(ctx, id)
}
func (m *CallbackStore) CreateExecution(ctx context.Context, execution store.LocalExecutionState) error {
return m.CreateExecutionFn(ctx, execution)
}
func (m *CallbackStore) UpdateExecutionState(ctx context.Context, request store.UpdateExecutionStateRequest) error {
return m.UpdateExecutionStateFn(ctx, request)
}
func (m *CallbackStore) DeleteExecution(ctx context.Context, id string) error {
return m.DeleteExecutionFn(ctx, id)
}
func (m *CallbackStore) GetExecutionCount(ctx context.Context, state store.LocalExecutionStateType) (uint64, error) {
return m.GetExecutionCountFn(ctx, state)
}
func (m *CallbackStore) Close(ctx context.Context) error {
return m.CloseFn(ctx)
}