pub struct KnowledgeStore {
pub future_skew_ms: i64,
pub max_envelope_bytes: usize,
/* private fields */
}Expand description
Single-process, in-memory reference repository with checkpoint-bound,
stateless query cursors. Mutations require &mut self; integrate behind
your application’s lock/transaction. It performs no fetching, persistence,
HTTP serving, authorization or ranking. Returned values are owned clones.
Fields§
§future_skew_ms: i64Allowance for created_at ahead of the clock; there is no lower bound.
max_envelope_bytes: usizeImplementations§
Source§impl KnowledgeStore
impl KnowledgeStore
pub fn new(origin: impl Into<String>) -> Result<Self>
Sourcepub fn set_admission(
&mut self,
admit: impl Fn(&Value) -> Result<()> + Send + Sync + 'static,
)
pub fn set_admission( &mut self, admit: impl Fn(&Value) -> Result<()> + Send + Sync + 'static, )
Refuse otherwise valid objects under local policy; return an error to refuse.
pub fn checkpoint(&self) -> u64
Sourcepub fn known_envelopes(&self) -> BTreeMap<String, Value>
pub fn known_envelopes(&self) -> BTreeMap<String, Value>
Publicly visible envelopes keyed by event ID.
Sourcepub fn submit(&mut self, item: &Value, now: i64) -> Result<Value>
pub fn submit(&mut self, item: &Value, now: i64) -> Result<Value>
Accept a signed event, or return the original record of an exact resubmission.
pub fn event(&self, hash: &str) -> Result<Value>
Sourcepub fn hide(&mut self, hash: &str)
pub fn hide(&mut self, hash: &str)
Withhold from public reads; the record still answers exact retries and resolves dependencies.
pub fn unhide(&mut self, hash: &str)
Sourcepub fn prune(&mut self, hash: &str)
pub fn prune(&mut self, hash: &str)
Drop content and record; the sequence high-water mark is preserved.
pub fn batch(&self, request: &Value, now: i64) -> Result<Value>
pub fn query(&self, request: &Value, now: i64) -> Result<Value>
Trait Implementations§
Source§impl Clone for KnowledgeStore
impl Clone for KnowledgeStore
Auto Trait Implementations§
impl !RefUnwindSafe for KnowledgeStore
impl !UnwindSafe for KnowledgeStore
impl Freeze for KnowledgeStore
impl Send for KnowledgeStore
impl Sync for KnowledgeStore
impl Unpin for KnowledgeStore
impl UnsafeUnpin for KnowledgeStore
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