github.com/asynkron/protoactor-go@v0.0.0-20240308120642-ef91a6abee75/persistence/persistence_provider.go (about) 1 package persistence 2 3 import ( 4 "google.golang.org/protobuf/proto" 5 ) 6 7 // Provider is the abstraction used for persistence 8 type Provider interface { 9 GetState() ProviderState 10 } 11 12 // ProviderState is an object containing the implementation for the provider 13 type ProviderState interface { 14 SnapshotStore 15 EventStore 16 17 Restart() 18 GetSnapshotInterval() int 19 } 20 21 type SnapshotStore interface { 22 GetSnapshot(actorName string) (snapshot interface{}, eventIndex int, ok bool) 23 PersistSnapshot(actorName string, snapshotIndex int, snapshot proto.Message) 24 DeleteSnapshots(actorName string, inclusiveToIndex int) 25 } 26 27 type EventStore interface { 28 GetEvents(actorName string, eventIndexStart int, eventIndexEnd int, callback func(e interface{})) 29 PersistEvent(actorName string, eventIndex int, event proto.Message) 30 DeleteEvents(actorName string, inclusiveToIndex int) 31 }