pub struct InMemoryReceiptFeed { /* private fields */ }Expand description
Trivial in-memory receipt feed used for tests and lightweight deployments. Stores receipts in insertion order and filters by agent + timestamp at read time.
The “agent” here is conceptual; real deployments resolve an agent subject through the capability snapshot table. For this feed the caller directly tags each receipt with an agent id.
Implementations§
Source§impl InMemoryReceiptFeed
impl InMemoryReceiptFeed
Sourcepub fn push(
&self,
agent_id: &str,
receipt: ChioReceipt,
) -> Result<(), KernelError>
pub fn push( &self, agent_id: &str, receipt: ChioReceipt, ) -> Result<(), KernelError>
Append a receipt tagged with the given agent id.
Sourcepub fn len(&self) -> Result<usize, KernelError>
pub fn len(&self) -> Result<usize, KernelError>
Number of receipts stored.
Sourcepub fn is_empty(&self) -> Result<bool, KernelError>
pub fn is_empty(&self) -> Result<bool, KernelError>
Whether the feed is empty.
Trait Implementations§
Source§impl Default for InMemoryReceiptFeed
impl Default for InMemoryReceiptFeed
Source§fn default() -> InMemoryReceiptFeed
fn default() -> InMemoryReceiptFeed
Returns the “default value” for a type. Read more
Source§impl ReceiptFeedSource for InMemoryReceiptFeed
impl ReceiptFeedSource for InMemoryReceiptFeed
Source§fn receipts_for_agent(
&self,
agent_id: &str,
since: u64,
until: u64,
) -> Result<Vec<ChioReceipt>, KernelError>
fn receipts_for_agent( &self, agent_id: &str, since: u64, until: u64, ) -> Result<Vec<ChioReceipt>, KernelError>
Return receipts for
agent_id whose timestamp falls in
[since, until] (inclusive on both ends). Implementations should
return a bounded slice; callers pass short windows so the
result set stays small.Auto Trait Implementations§
impl !Freeze for InMemoryReceiptFeed
impl RefUnwindSafe for InMemoryReceiptFeed
impl Send for InMemoryReceiptFeed
impl Sync for InMemoryReceiptFeed
impl Unpin for InMemoryReceiptFeed
impl UnsafeUnpin for InMemoryReceiptFeed
impl UnwindSafe for InMemoryReceiptFeed
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