Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrorPersistenceNotHasRecord = errors.New("persistence not has record")
)
Functions ¶
This section is empty.
Types ¶
type FunctionalStateConfigurator ¶
type FunctionalStateConfigurator func(configuration *StateConfiguration)
func (FunctionalStateConfigurator) Configure ¶
func (f FunctionalStateConfigurator) Configure(configuration *StateConfiguration)
type FunctionalStorageProvider ¶
type FunctionalStorageProvider func() Storage
func (FunctionalStorageProvider) Provide ¶
func (f FunctionalStorageProvider) Provide() Storage
type MemoryStorage ¶
type MemoryStorage struct{}
func NewMemoryStorage ¶
func NewMemoryStorage() *MemoryStorage
func (*MemoryStorage) Clear ¶
func (m *MemoryStorage) Clear(name Name) error
type State ¶
type State struct {
// contains filtered or unexported fields
}
State 是持久化对象的运行时状态,其中包含的记录的事件及快照信息
func NewState ¶
func NewState(name Name, configurator ...StateConfigurator) *State
func (*State) EventCount ¶
func (*State) SaveSnapshot ¶
func (*State) StateChanged ¶
type StateConfiguration ¶
type StateConfiguration struct {
// contains filtered or unexported fields
}
func (*StateConfiguration) WithStorage ¶
func (c *StateConfiguration) WithStorage(storage Storage) *StateConfiguration
type StateConfigurator ¶
type StateConfigurator interface {
Configure(configuration *StateConfiguration)
}
type Storage ¶
type Storage interface { // Save 保存特定名称的状态快照及事件 Save(name Name, snapshot Snapshot, events []Event) error // Load 加载特定名称的状态快照和事件 Load(name Name) (snapshot Snapshot, events []Event, err error) // Clear 清除特定名称的状态快照和事件 Clear(name Name) error }
Storage 是用作 Actor 状态持久化的存储接口
type StorageProvider ¶
type StorageProvider interface {
Provide() Storage
}
Click to show internal directories.
Click to hide internal directories.