-
Notifications
You must be signed in to change notification settings - Fork 10
/
remote.go
38 lines (32 loc) · 1011 Bytes
/
remote.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
package remote
import (
"github.com/snyk/policy-engine/pkg/internal/terraform/states/statemgr"
)
// Client is the interface that must be implemented for a remote state
// driver. It supports dumb put/get/delete, and the higher level structs
// handle persisting the state properly here.
type Client interface {
Get() (*Payload, error)
Put([]byte) error
Delete() error
}
// ClientForcePusher is an optional interface that allows a remote
// state to force push by managing a flag on the client that is
// toggled on by a call to EnableForcePush.
type ClientForcePusher interface {
Client
EnableForcePush()
}
// ClientLocker is an optional interface that allows a remote state
// backend to enable state lock/unlock.
type ClientLocker interface {
Client
statemgr.Locker
}
// Payload is the return value from the remote state storage.
type Payload struct {
MD5 []byte
Data []byte
}
// Factory is the factory function to create a remote client.
type Factory func(map[string]string) (Client, error)