CaptureRuleEngine

class CaptureRuleEngine(initialRules: List<CaptureRule> = emptyList())

Evaluates capture exclusions on the network capture hot path.

Matching reads a volatile snapshot so a recorded request never blocks on CRUD or storage, while every mutation writes through bindPersistence's store before the active snapshot changes -- a rule the caller was told was saved is always durable.

Constructors

Link copied to clipboard
constructor(initialRules: List<CaptureRule> = emptyList())

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun allowsCapture(method: String, url: String): Boolean

Hot-path gate. Every CaptureRule.host is validated at construction time to be recoverable by java.net.URI, but the request url itself is not -- callers (the Ktor client plugin, manual NetworkTransactionRecorder.record use) may pass an unencoded URL that makes URI's constructor throw even though its host and path are perfectly ordinary. extractRequestHost/extractRequestPath fall back to manual scheme/authority splitting in that case, so a rule for a well-formed host is never defeated by an unrelated encoding problem elsewhere in the URL. Returns true (capture) only when no host at all can be recovered from url.

Link copied to clipboard

Restores durable rules and makes subsequent CRUD write through store. Persistence is unbound while restoring so replaying stored rules never rewrites them.

Link copied to clipboard
Link copied to clipboard

Replays stored rules into memory; rows that no longer validate are skipped, not fatal.

Link copied to clipboard
Link copied to clipboard

Enable/disable without losing the rule; returns false when id is unknown.

Link copied to clipboard