Documentation
¶
Index ¶
- type ApplyManager
- func (am *ApplyManager) ApplyBatch(entries []internal.LogEntry) error
- func (am *ApplyManager) ApplyEntries(entries []internal.LogEntry) error
- func (am *ApplyManager) ApplyEntriesSync(entries []internal.LogEntry, timeout time.Duration) error
- func (am *ApplyManager) ApplyWithRetry(entries []internal.LogEntry, maxRetries int) error
- func (am *ApplyManager) FlushPending(timeout time.Duration) error
- func (am *ApplyManager) GetPendingCount() int
- func (am *ApplyManager) GetPipelineUtilization() float64
- func (am *ApplyManager) GetStats() map[string]interface{}
- func (am *ApplyManager) IsPipelineFull() bool
- func (am *ApplyManager) Start(ctx context.Context) error
- func (am *ApplyManager) Stop(ctx context.Context) error
- func (am *ApplyManager) WaitForApply(index uint64, timeout time.Duration) error
- type ApplyManagerConfig
- type Command
- type MemoryStateMachine
- func (sm *MemoryStateMachine) Apply(entry internal.LogEntry) error
- func (sm *MemoryStateMachine) Clear()
- func (sm *MemoryStateMachine) GetState() map[string]interface{}
- func (sm *MemoryStateMachine) Query(query interface{}) (interface{}, error)
- func (sm *MemoryStateMachine) Restore(snapshot *internal.Snapshot) error
- func (sm *MemoryStateMachine) Snapshot() (*internal.Snapshot, error)
- type MemoryStateMachineConfig
- type PersistentStateMachine
- func (psm *PersistentStateMachine) Apply(entry internal.LogEntry) error
- func (psm *PersistentStateMachine) CreateSnapshot() ([]byte, error)
- func (psm *PersistentStateMachine) Get(key string) ([]byte, error)
- func (psm *PersistentStateMachine) GetStats() map[string]interface{}
- func (psm *PersistentStateMachine) RestoreSnapshot(data []byte) error
- func (psm *PersistentStateMachine) Start(ctx context.Context) error
- func (psm *PersistentStateMachine) Stop(ctx context.Context) error
- type PersistentStateMachineConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplyManager ¶
type ApplyManager struct {
// contains filtered or unexported fields
}
ApplyManager manages optimized log entry application
func NewApplyManager ¶
func NewApplyManager( stateMachine internal.StateMachine, config ApplyManagerConfig, logger forge.Logger, ) *ApplyManager
NewApplyManager creates a new apply manager
func (*ApplyManager) ApplyBatch ¶
func (am *ApplyManager) ApplyBatch(entries []internal.LogEntry) error
ApplyBatch applies a batch of entries with optimizations
func (*ApplyManager) ApplyEntries ¶
func (am *ApplyManager) ApplyEntries(entries []internal.LogEntry) error
ApplyEntries applies log entries asynchronously
func (*ApplyManager) ApplyEntriesSync ¶
ApplyEntriesSync applies log entries synchronously
func (*ApplyManager) ApplyWithRetry ¶
func (am *ApplyManager) ApplyWithRetry(entries []internal.LogEntry, maxRetries int) error
ApplyWithRetry applies entries with retry logic
func (*ApplyManager) FlushPending ¶
func (am *ApplyManager) FlushPending(timeout time.Duration) error
FlushPending waits for all pending applies to complete
func (*ApplyManager) GetPendingCount ¶
func (am *ApplyManager) GetPendingCount() int
GetPendingCount returns the number of pending applies
func (*ApplyManager) GetPipelineUtilization ¶
func (am *ApplyManager) GetPipelineUtilization() float64
GetPipelineUtilization returns pipeline utilization percentage
func (*ApplyManager) GetStats ¶
func (am *ApplyManager) GetStats() map[string]interface{}
GetStats returns apply manager statistics
func (*ApplyManager) IsPipelineFull ¶
func (am *ApplyManager) IsPipelineFull() bool
IsPipelineFull returns true if the pipeline is full
func (*ApplyManager) Start ¶
func (am *ApplyManager) Start(ctx context.Context) error
Start starts the apply manager
func (*ApplyManager) Stop ¶
func (am *ApplyManager) Stop(ctx context.Context) error
Stop stops the apply manager
func (*ApplyManager) WaitForApply ¶
func (am *ApplyManager) WaitForApply(index uint64, timeout time.Duration) error
WaitForApply waits for entries up to index to be applied
type ApplyManagerConfig ¶
type ApplyManagerConfig struct {
PipelineDepth int
WorkerCount int
BatchSize int
BatchTimeout time.Duration
}
ApplyManagerConfig contains apply manager configuration
type MemoryStateMachine ¶
type MemoryStateMachine struct {
// contains filtered or unexported fields
}
MemoryStateMachine implements a simple in-memory state machine
func NewMemoryStateMachine ¶
func NewMemoryStateMachine(config MemoryStateMachineConfig, logger forge.Logger) *MemoryStateMachine
NewMemoryStateMachine creates a new memory state machine
func (*MemoryStateMachine) Apply ¶
func (sm *MemoryStateMachine) Apply(entry internal.LogEntry) error
Apply applies a log entry to the state machine
func (*MemoryStateMachine) Clear ¶
func (sm *MemoryStateMachine) Clear()
Clear clears the state machine (for testing)
func (*MemoryStateMachine) GetState ¶
func (sm *MemoryStateMachine) GetState() map[string]interface{}
GetState returns a copy of the current state (for testing)
func (*MemoryStateMachine) Query ¶
func (sm *MemoryStateMachine) Query(query interface{}) (interface{}, error)
Query performs a read-only query
type MemoryStateMachineConfig ¶
type MemoryStateMachineConfig struct {
InitialCapacity int
}
MemoryStateMachineConfig contains configuration for memory state machine
type PersistentStateMachine ¶
type PersistentStateMachine struct {
// contains filtered or unexported fields
}
PersistentStateMachine is a state machine backed by persistent storage
func NewPersistentStateMachine ¶
func NewPersistentStateMachine(config PersistentStateMachineConfig, logger forge.Logger) (*PersistentStateMachine, error)
NewPersistentStateMachine creates a new persistent state machine
func (*PersistentStateMachine) Apply ¶
func (psm *PersistentStateMachine) Apply(entry internal.LogEntry) error
Apply applies a log entry to the state machine
func (*PersistentStateMachine) CreateSnapshot ¶
func (psm *PersistentStateMachine) CreateSnapshot() ([]byte, error)
CreateSnapshot creates a snapshot of the state machine
func (*PersistentStateMachine) Get ¶
func (psm *PersistentStateMachine) Get(key string) ([]byte, error)
Get retrieves a value from the state machine
func (*PersistentStateMachine) GetStats ¶
func (psm *PersistentStateMachine) GetStats() map[string]interface{}
GetStats returns state machine statistics
func (*PersistentStateMachine) RestoreSnapshot ¶
func (psm *PersistentStateMachine) RestoreSnapshot(data []byte) error
RestoreSnapshot restores a snapshot to the state machine