Documentation ¶
Overview ¶
Package persist enables persistent storage of the execution state.
Index ¶
- type FsPersister
- func (p *FsPersister) Deserialize(b []byte) error
- func (p *FsPersister) GetMemory() cache.Memory
- func (p *FsPersister) GetState() *state.State
- func (p *FsPersister) Load(key string) error
- func (p *FsPersister) Save(key string) error
- func (p *FsPersister) Serialize() ([]byte, error)
- func (p *FsPersister) WithContent(st *state.State, ca *cache.Cache) *FsPersister
- type Persister
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FsPersister ¶
type FsPersister struct { State *state.State Memory *cache.Cache // contains filtered or unexported fields }
FsPersister is an implementation of Persister that saves state to the file system.
func NewFsPersister ¶
func NewFsPersister(dir string) *FsPersister
NewFsPersister creates a new FsPersister.
The filesystem store will be at the given directory. The directory must exist.
func (*FsPersister) Deserialize ¶
func (p *FsPersister) Deserialize(b []byte) error
GetState implements the Persister interface.
func (*FsPersister) GetMemory ¶
func (p *FsPersister) GetMemory() cache.Memory
GetState implements the Persister interface.
func (*FsPersister) GetState ¶
func (p *FsPersister) GetState() *state.State
GetState implements the Persister interface.
func (*FsPersister) Load ¶
func (p *FsPersister) Load(key string) error
GetState implements the Persister interface.
func (*FsPersister) Save ¶
func (p *FsPersister) Save(key string) error
GetState implements the Persister interface.
func (*FsPersister) Serialize ¶
func (p *FsPersister) Serialize() ([]byte, error)
GetState implements the Persister interface.
func (*FsPersister) WithContent ¶
func (p *FsPersister) WithContent(st *state.State, ca *cache.Cache) *FsPersister
WithContent sets a current State and Cache object.
This method is normally called before Serialize / Save.
type Persister ¶
type Persister interface { Serialize() ([]byte, error) // Output serializes representation of the state. Deserialize(b []byte) error // Restore state from a serialized state. Save(key string) error // Serialize and commit the state representation to persisted storage. Load(key string) error // Load the state representation from persisted storage and Deserialize. GetState() *state.State // Get the currently loaded State object. GetMemory() cache.Memory // Get the currently loaded Cache object. }
Persister interface defines the methods needed for a component that can store the execution state to a storage location.