EventStore

interface EventStore

A single-source, durable event data source. Inputs must already be redacted.

Functions

Link copied to clipboard
abstract suspend fun deleteSession(sessionId: String)
Link copied to clipboard
abstract suspend fun eventCount(): Long
Link copied to clipboard
abstract suspend fun eventsForSession(sessionId: String): List<StoredEvent>
Link copied to clipboard
abstract suspend fun insert(events: List<StoredEvent>): EventStoreWriteResult
Link copied to clipboard
open suspend fun recentEventsForPlugins(pluginIds: Set<String>, limit: Int): List<StoredEvent>

Cross-session counterpart of recentEventsForSession: the newest bounded rows across every retained session, restricted to pluginIds. pluginIds is required and non-empty -- unlike the session-scoped read, there is no cheap, generic way for this interface to enumerate "every session" on its own, so an unfiltered cross-session scan is intentionally not exposed here (it would reproduce the exact crowding-out problem this method exists to avoid).

Link copied to clipboard
open suspend fun recentEventsForSession(sessionId: String, limit: Int, pluginIds: Set<String> = emptySet()): List<StoredEvent>

Returns the newest bounded rows for one app run in chronological order, optionally restricted to pluginIds (empty, the default, means no filter -- every plugin). The default implementation filters in Kotlin after eventsForSession loads the whole session; a store backed by a real index (see RoomEventStore) should override this to push the predicate into its query instead, so a small limit still surfaces a rare matching row rather than being crowded out by more recent rows of an unfiltered plugin.