EventStorageHandler class

Coordinator between SqliteEventStorage and MemoryEventQueue. Provides a unified interface for event persistence.

Constructors

EventStorageHandler({int maxEventsStored = SqliteEventStorage.defaultMaxEvents, int nowProvider()?, int dbRecoveryCooldownMs = _defaultDbRecoveryCooldownMs})
EventStorageHandler.withStorage({required SqliteEventStorage sqliteStorage, MemoryEventQueue? memoryQueue, int nowProvider()?, int dbRecoveryCooldownMs = _defaultDbRecoveryCooldownMs})

Properties

dbAvailable bool
no setter
hashCode int
The hash code for this object.
no setterinherited
hasPendingDeliveryReplay bool
no setter
pendingSqliteDeleteCount int
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clearPendingDeliveryReplay() → void
consumeDroppedDueToCapCount() Future<int>
deleteBatch(List<int> ids) Future<int>
Delete successfully flushed events by their IDs. Negative IDs are routed to the memory queue (seq = -(id) - 1), positive IDs are routed to SQLite.
deleteBatchDetailed(List<int> ids) Future<DeleteBatchResult>
dispose() Future<void>
Clean up resources.
getEventCount() Future<int>
Get total event count across SQLite + memory.
init() Future<void>
Initialize storage — open SQLite, migrate legacy SharedPreferences data.
insertEvent(int tsMillis, String eventName, String payloadJson) Future<bool>
Insert an event. Tries SQLite first, falls back to memory queue.
lookupEventPresence(String eventName, int tsMillis) Future<bool?>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onFlushComplete() Future<void>
Notify storage that a flush cycle completed (for WAL checkpoint).
readBatch(int limit) Future<List<EventRow>>
Read a batch of events for flushing. Priority events come first. Memory queue events are returned with negative IDs (-(seq+1)) to distinguish them from SQLite rows, enabling correct deletion routing.
releaseBatchReservations(List<int> ids) Future<void>
Release in-flight reservations after a flush attempt fails.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited