persist.go (732B)
1 package persist 2 3 import ( 4 "git.defalsify.org/vise.git/cache" 5 "git.defalsify.org/vise.git/state" 6 ) 7 8 // Persister interface defines the methods needed for a component that can store the execution state to a storage location. 9 type Persister interface { 10 Serialize() ([]byte, error) // Output serializes representation of the state. 11 Deserialize(b []byte) error // Restore state from a serialized state. 12 Save(key string) error // Serialize and commit the state representation to persisted storage. 13 Load(key string) error // Load the state representation from persisted storage and Deserialize. 14 GetState() *state.State // Get the currently loaded State object. 15 GetMemory() cache.Memory // Get the currently loaded Cache object. 16 } 17