Documentation ¶
Index ¶
- Variables
- func TestClient(t *testing.T, c Client)
- func TestRemoteLocks(t *testing.T, a, b Client)
- type Client
- type ClientForcePusher
- type ClientLocker
- type Factory
- type Payload
- type State
- func (s *State) DisableLocks()
- func (s *State) Lock(info *state.LockInfo) (string, error)
- func (s *State) PersistState() error
- func (s *State) RefreshState() error
- func (s *State) State() *states.State
- func (s *State) StateForMigration() *statefile.File
- func (s *State) StateSnapshotMeta() statemgr.SnapshotMeta
- func (s *State) Unlock(id string) error
- func (s *State) WriteState(state *states.State) error
- func (s *State) WriteStateForMigration(f *statefile.File, force bool) error
Constants ¶
This section is empty.
Variables ¶
var BuiltinClients = map[string]Factory{}
BuiltinClients is the list of built-in clients that can be used with NewClient.
Functions ¶
func TestClient ¶ added in v0.9.0
TestClient is a generic function to test any client.
func TestRemoteLocks ¶ added in v0.9.0
Test the lock implementation for a remote.Client. This test requires 2 client instances, in oder to have multiple remote clients since some implementations may tie the client to the lock, or may have reentrant locks.
Types ¶
type Client ¶
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 ClientForcePusher ¶ added in v0.12.25
type ClientForcePusher interface { Client EnableForcePush() }
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 ClientLocker ¶ added in v0.9.0
ClientLocker is an optional interface that allows a remote state backend to enable state lock/unlock.
type State ¶
type State struct { Client Client // contains filtered or unexported fields }
State implements the State interfaces in the state package to handle reading and writing the remote state. This State on its own does no local caching so every persist will go to the remote storage and local writes will go to memory.
func (*State) DisableLocks ¶ added in v0.12.0
func (s *State) DisableLocks()
DisableLocks turns the Lock and Unlock methods into no-ops. This is intended to be called during initialization of a state manager and should not be called after any of the statemgr.Full interface methods have been called.
func (*State) StateForMigration ¶ added in v0.12.0
StateForMigration is part of our implementation of statemgr.Migrator.
func (*State) StateSnapshotMeta ¶ added in v0.12.0
func (s *State) StateSnapshotMeta() statemgr.SnapshotMeta
StateSnapshotMeta returns the metadata from the most recently persisted or refreshed persistent state snapshot.
This is an implementation of statemgr.PersistentMeta.
func (*State) WriteState ¶
statemgr.Writer impl.