state

package
v0.12.22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2020 License: MPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LockWithContext added in v0.9.3

func LockWithContext(ctx context.Context, s State, info *LockInfo) (string, error)

Lock the state, using the provided context for timeout and cancellation. This backs off slightly to an upper limit.

func TestState

func TestState(t *testing.T, s State)

TestState is a helper for testing state implementations. It is expected that the given implementation is pre-loaded with the TestStateInitial state.

func TestStateInitial

func TestStateInitial() *states.State

TestStateInitial is the initial state that a State should have for TestState.

Types

type BackupState

type BackupState struct {
	Real State
	Path string
	// contains filtered or unexported fields
}

BackupState wraps a State that backs up the state on the first time that a WriteState or PersistState is called.

If Path exists, it will be overwritten.

func (*BackupState) Lock added in v0.9.0

func (s *BackupState) Lock(info *LockInfo) (string, error)

func (*BackupState) PersistState

func (s *BackupState) PersistState() error

func (*BackupState) RefreshState

func (s *BackupState) RefreshState() error

func (*BackupState) State

func (s *BackupState) State() *states.State

func (*BackupState) Unlock added in v0.9.0

func (s *BackupState) Unlock(id string) error

func (*BackupState) WriteState

func (s *BackupState) WriteState(state *states.State) error

type InmemState

type InmemState struct {
	// contains filtered or unexported fields
}

InmemState is an in-memory state storage.

func (*InmemState) Lock added in v0.9.3

func (s *InmemState) Lock(*LockInfo) (string, error)

func (*InmemState) PersistState

func (s *InmemState) PersistState() error

func (*InmemState) RefreshState

func (s *InmemState) RefreshState() error

func (*InmemState) State

func (s *InmemState) State() *terraform.State

func (*InmemState) Unlock added in v0.9.3

func (s *InmemState) Unlock(string) error

func (*InmemState) WriteState

func (s *InmemState) WriteState(state *terraform.State) error

type LocalState

type LocalState struct {

	// Path is the path to read the state from. PathOut is the path to
	// write the state to. If PathOut is not specified, Path will be used.
	// If PathOut already exists, it will be overwritten.
	Path    string
	PathOut string
	// contains filtered or unexported fields
}

LocalState manages a state storage that is local to the filesystem.

func (*LocalState) Lock added in v0.9.0

func (s *LocalState) Lock(info *LockInfo) (string, error)

Lock implements a local filesystem state.Locker.

func (*LocalState) PersistState

func (s *LocalState) PersistState() error

PersistState for LocalState is a no-op since WriteState always persists.

StatePersister impl.

func (*LocalState) RefreshState

func (s *LocalState) RefreshState() error

StateRefresher impl.

func (*LocalState) SetState

func (s *LocalState) SetState(state *terraform.State)

SetState will force a specific state in-memory for this local state.

func (*LocalState) State

func (s *LocalState) State() *terraform.State

StateReader impl.

func (*LocalState) Unlock added in v0.9.0

func (s *LocalState) Unlock(id string) error

func (*LocalState) WriteState

func (s *LocalState) WriteState(state *terraform.State) error

WriteState for LocalState always persists the state as well. TODO: this should use a more robust method of writing state, by first writing to a temp file on the same filesystem, and renaming the file over the original.

StateWriter impl.

type LockDisabled added in v0.9.0

type LockDisabled struct {
	// We can't embed State directly since Go dislikes that a field is
	// State and State interface has a method State
	Inner State
}

LockDisabled implements State and Locker but disables state locking. If State doesn't support locking, this is a no-op. This is useful for easily disabling locking of an existing state or for tests.

func (*LockDisabled) Lock added in v0.9.0

func (s *LockDisabled) Lock(info *LockInfo) (string, error)

func (*LockDisabled) PersistState added in v0.9.0

func (s *LockDisabled) PersistState() error

func (*LockDisabled) RefreshState added in v0.9.0

func (s *LockDisabled) RefreshState() error

func (*LockDisabled) State added in v0.9.0

func (s *LockDisabled) State() *states.State

func (*LockDisabled) Unlock added in v0.9.0

func (s *LockDisabled) Unlock(id string) error

func (*LockDisabled) WriteState added in v0.9.0

func (s *LockDisabled) WriteState(v *states.State) error

type LockError added in v0.9.0

type LockError = statemgr.LockError

LockError is a deprecated alias for statemgr.LockError

type LockInfo added in v0.9.0

type LockInfo = statemgr.LockInfo

LockInfo is a deprecated lias for statemgr.LockInfo

func NewLockInfo added in v0.9.0

func NewLockInfo() *LockInfo

Generate a LockInfo structure, populating the required fields.

type Locker added in v0.9.0

type Locker = statemgr.Locker

Locker is a deprecated alias for statemgr.Locker

type State

type State = statemgr.Full

State is a deprecated alias for statemgr.Full

type StatePersister

type StatePersister = statemgr.Persister

StatePersister is a deprecated alias for statemgr.Persister

type StateReader

type StateReader = statemgr.Reader

StateReader is a deprecated alias for statemgr.Reader

type StateRefresher

type StateRefresher = statemgr.Refresher

StateRefresher is a deprecated alias for statemgr.Refresher

type StateWriter

type StateWriter = statemgr.Writer

StateWriter is a deprecated alias for statemgr.Writer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL