state

package
v0.0.0-alpha9 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadHostState

func LoadHostState(
	ctx context.Context, persistantState PersistantState,
) (*resource.HostState, error)

func SaveHostState

func SaveHostState(ctx context.Context, hostState resource.HostState, persistantState PersistantState) error

Types

type Local

type Local struct {
	Path string
}

func NewLocal

func NewLocal(root string, hst host.Host) Local

NewLocal creates a new Local instance with Path set as a function of the root directory and the host.

func (Local) Load

func (l Local) Load(ctx context.Context) (*[]byte, error)

func (Local) Save

func (l Local) Save(ctx context.Context, bytes []byte) error

func (Local) String

func (l Local) String() string

type PersistantState

type PersistantState interface {
	// Saves given state data.
	Save(ctx context.Context, bytes []byte) error
	// Loads a previously saved state data. If no previous state exists, returns nil.
	Load(ctx context.Context) (*[]byte, error)
	String() string
}

PersistantState defines an interface for loading and saving HostState.

Jump to

Keyboard shortcuts

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