Documentation
¶
Overview ¶
Package persist enables persistent storage of the execution state.
Index ¶
- type Persister
- func (p *Persister) Deserialize(b []byte) error
- func (p *Persister) GetMemory() cache.Memory
- func (p *Persister) GetState() *state.State
- func (p *Persister) Invalid() bool
- func (p *Persister) Load(key string) error
- func (p *Persister) Save(key string) error
- func (p *Persister) Serialize() ([]byte, error)
- func (p *Persister) String() string
- func (p *Persister) WithContent(st *state.State, ca *cache.Cache) *Persister
- func (p *Persister) WithContext(ctx context.Context) *Persister
- func (p *Persister) WithFlush() *Persister
- func (p *Persister) WithSession(sessionId string) *Persister
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Persister ¶
type Persister struct { State *state.State Memory *cache.Cache // contains filtered or unexported fields }
Persister abstracts storage and retrieval of state and cache.
func NewPersister ¶
NewPersister creates a new Persister instance.
func (*Persister) Deserialize ¶
Deserialize decodes the state and cache from storage, and applies them to the persister.
func (*Persister) GetMemory ¶
GetMemory returns the cache (memory) enclosed by the Persister.
func (*Persister) GetState ¶
GetState returns the state enclosed by the Persister.
func (*Persister) Invalid ¶
Invalid checks if the underlying state has been invalidated.
An invalid state will cause Save to panic.
func (*Persister) Load ¶
Load retrieves state and cache from the db.Db backend.
func (*Persister) Save ¶
Save persists the state and cache to the db.Db backend.
If save is successful and WithFlush() has been called, the state and memory will be empty when the method returns.
func (*Persister) Serialize ¶
Serialize encodes the state and cache into byte form for storage.
func (*Persister) String ¶ added in v0.2.0
String implements the String interface
func (*Persister) WithContent ¶
WithContent is a chainable function that sets a current State and Cache object.
This method is normally called before Serialize / Save.
func (*Persister) WithContext ¶
WithSession is a chainable function that sets the current golang context of the persister.
func (*Persister) WithFlush ¶
WithFlush is a chainable function that instructs the persister to flush its memory and state after successful Save.