vise/persist/persist.go

18 lines
724 B
Go
Raw Normal View History

2023-04-13 00:42:36 +02:00
package persist
2023-04-13 01:38:33 +02:00
import (
2023-04-14 10:59:37 +02:00
"git.defalsify.org/vise/cache"
"git.defalsify.org/vise/state"
2023-04-13 01:38:33 +02:00
)
// Persister interface defines the methods needed for a component that can store the execution state to a storage location.
2023-04-13 00:42:36 +02:00
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.
2023-04-13 00:42:36 +02:00
}