state

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backender

type Backender interface {
	Writer
	Reader
}

Backender interface Definitions of set of methods required for all state types

func GetBackend

func GetBackend() Backender

GetBackend gets the current active backend

func InitBackend

func InitBackend() Backender

InitBackend initializes the backend for reading and writing to state It checks state configuration defined in the config and returns The appropriate backend

type LocalBackend

type LocalBackend struct {
	Path string
	// contains filtered or unexported fields
}

LocalBackend is an implementation of State that performs all operations locally. This is the "default" state type

func (LocalBackend) GetState

func (s LocalBackend) GetState() *State

GetState returns state from local source

func (LocalBackend) WriteState

func (s LocalBackend) WriteState(st *State) error

WriteState writes state to local path

type ProvidersState

type ProvidersState map[string]types.Resources

ProvidersState represents state for providers

  {
   aws: {
		s3: [ Resource1, Resource2 ]
   }
 }

type Reader

type Reader interface {
	GetState() *State
}

Reader is the interface for state types that can return state resources

type RemoteBackend

type RemoteBackend struct {
	Path     string
	Bucket   string
	BlobType string
	Region   string
	// contains filtered or unexported fields
}

RemoteBackend is an implementation of State that performs all operations in a cloud storage container e.g s3

func (RemoteBackend) GetState

func (s RemoteBackend) GetState() *State

GetState returns state from remote source

func (RemoteBackend) WriteState

func (s RemoteBackend) WriteState(st *State) error

WriteState writes state to remote path

type State

type State struct {
	Current ProvidersState
	Desired ProvidersState
}

State object: Represents a reka state consisting of current and desired state Desired state is used for resumption of resources. It stores the attributes of the resource to resume to for resources that need extra info like size of node pool to resize to

current: {
   aws: {
		s3: [ Resource1, Resource2 ]
   }
}
desired: {
   aws: {
		s3: [ Resource1, Resource2 ]
   }
}

State object stores state for both current and desired states of resources

func Diff

func Diff(previous, current ProvidersState) State

Diff returns the difference in between two states

func NewEmptyState

func NewEmptyState() State

NewEmptyState gets a new empty state

func (State) Empty

func (s State) Empty() bool

Empty checks if state is empty

type Writer

type Writer interface {
	WriteState(st *State) error
}

Writer is the interface for state types that can write to state files

Jump to

Keyboard shortcuts

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