pub struct ReplayAdapter { /* private fields */ }Expand description
Deterministic adapter that returns fixture-pinned responses.
Thread-safe: holds an in-memory map keyed by (model, prompt_hash).
Implementations§
Source§impl ReplayAdapter
impl ReplayAdapter
Sourcepub fn new<P: Into<PathBuf>>(fixtures_dir: P) -> Result<Self, LlmError>
pub fn new<P: Into<PathBuf>>(fixtures_dir: P) -> Result<Self, LlmError>
Construct a new replay adapter rooted at fixtures_dir.
The directory MUST contain an INDEX.toml listing every trusted
fixture and its expected BLAKE3 hash. Any fixture in the directory
that is not listed in the index, or whose on-disk bytes hash to a
different value than the index records, causes
LlmError::FixtureIntegrityFailed.
The check is upfront — once new() returns, the in-memory map is
trusted for the lifetime of the adapter.
Sourcepub fn fixtures_dir(&self) -> &Path
pub fn fixtures_dir(&self) -> &Path
Path the adapter is rooted at.
Sourcepub fn fixture_count(&self) -> usize
pub fn fixture_count(&self) -> usize
Number of trusted fixtures currently loaded.
Trait Implementations§
Source§impl Debug for ReplayAdapter
impl Debug for ReplayAdapter
Source§impl LlmAdapter for ReplayAdapter
impl LlmAdapter for ReplayAdapter
Source§fn adapter_id(&self) -> &'static str
fn adapter_id(&self) -> &'static str
Stable, lowercase identifier used in audit envelopes (e.g.
"claude",
"ollama", "replay"). Constants — implementations MUST NOT vary
this per call.Source§fn complete<'life0, 'async_trait>(
&'life0 self,
req: LlmRequest,
) -> Pin<Box<dyn Future<Output = Result<LlmResponse, LlmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn complete<'life0, 'async_trait>(
&'life0 self,
req: LlmRequest,
) -> Pin<Box<dyn Future<Output = Result<LlmResponse, LlmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Issue a completion call. The adapter is responsible for honouring
req.timeout_ms and returning LlmError::Timeout when exceeded.Source§fn stream(
&self,
req: LlmRequest,
) -> impl Stream<Item = Result<StreamChunk, LlmError>> + Sendwhere
Self: Sized,
fn stream(
&self,
req: LlmRequest,
) -> impl Stream<Item = Result<StreamChunk, LlmError>> + Sendwhere
Self: Sized,
Source§fn stream_boxed(&self, req: LlmRequest) -> BoxStream<'_>
fn stream_boxed(&self, req: LlmRequest) -> BoxStream<'_>
Object-safe streaming entry point. Returns a heap-allocated
Pin<Box<dyn Stream>> so callers with only a &dyn LlmAdapter
reference can drive streaming without knowing the concrete adapter type. Read moreAuto Trait Implementations§
impl Freeze for ReplayAdapter
impl RefUnwindSafe for ReplayAdapter
impl Send for ReplayAdapter
impl Sync for ReplayAdapter
impl Unpin for ReplayAdapter
impl UnsafeUnpin for ReplayAdapter
impl UnwindSafe for ReplayAdapter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more