SnoopStore

class SnoopStore(capacity: Int = DEFAULT_CAPACITY, maxTotalBytes: Long = DEFAULT_MAX_TOTAL_BYTES)

In-memory ring buffer of captured entries, exposed as a StateFlow the UI observes. All mutations go through mutate, which is safe under concurrent writers (MutableStateFlow.update retries on conflict), so the Ktor plugin and the analytics logger can record from any thread.

Two eviction limits apply, both drop-oldest: capacity (entry count) and maxTotalBytes (approximate memory), so a burst of huge bodies can't balloon the host's heap.

Constructors

Link copied to clipboard
constructor(capacity: Int = DEFAULT_CAPACITY, maxTotalBytes: Long = DEFAULT_MAX_TOTAL_BYTES)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
val entries: StateFlow<List<SnoopEntry>>
Link copied to clipboard

Functions

Link copied to clipboard
fun clear()
Link copied to clipboard
fun mutate(transform: (List<SnoopEntry>) -> List<SnoopEntry>)
Link copied to clipboard
fun reconfigure(capacity: Int = this.capacity, maxTotalBytes: Long = this.maxTotalBytes, clear: Boolean = true)

Change the limits in place. The same entries StateFlow survives, so UI and SSE collectors keep working. With clear (the default) existing entries are dropped; otherwise the list is trimmed to the new limits.

Link copied to clipboard
fun record(entry: SnoopEntry)
Link copied to clipboard
fun update(id: String, transform: (SnoopEntry) -> SnoopEntry)