pub struct CuratedKnowledgeStore { /* private fields */ }Expand description
A curation-aware knowledge store: wraps any inner
KnowledgeBase, records each
document’s DocMeta (set membership / boost / metadata) and its
DocAcl at ingest, and mints readers that apply a RetrievalFilter and
AccessContext together at read time.
Like AclKnowledgeStore, it does
not itself implement KnowledgeBase for reading (reads must be bound to a
filter + requester). Instead:
ingest_handlereturns anArc<dyn KnowledgeBase>that records curation metadata + ACL as it ingests;readermints a filtering/boostingArc<dyn KnowledgeBase>bound to aRetrievalFilter+AccessContext.
Implementations§
Source§impl CuratedKnowledgeStore
impl CuratedKnowledgeStore
Sourcepub fn new(inner: Arc<dyn KnowledgeBase>) -> Self
pub fn new(inner: Arc<dyn KnowledgeBase>) -> Self
Wrap an inner knowledge base. The store starts with empty side tables;
every document ingested through ingest_handle has
its DocMeta (and DocAcl, if stamped) recorded.
Sourcepub fn ingest_handle(&self) -> Arc<dyn KnowledgeBase> ⓘ
pub fn ingest_handle(&self) -> Arc<dyn KnowledgeBase> ⓘ
An ingest-side handle: a KnowledgeBase whose ingest records the
document’s DocMeta (always) and DocAcl (if stamped) in the shared
side tables, then forwards to the inner backend. Its query is the
unfiltered inner query — production reads use reader.
Sourcepub fn reader(
&self,
filter: RetrievalFilter,
access: AccessContext,
) -> Arc<dyn KnowledgeBase> ⓘ
pub fn reader( &self, filter: RetrievalFilter, access: AccessContext, ) -> Arc<dyn KnowledgeBase> ⓘ
A read-side handle bound to a RetrievalFilter + AccessContext: a
KnowledgeBase whose query over-fetches from the inner backend, drops
every result the requester is not entitled to (ACL) or that does not match
the filter (sets/metadata), multiplies each survivor’s score by its boost,
re-sorts, and truncates to the requested limit.
Pass RetrievalFilter::none + AccessContext::anonymous for the
unscoped, ACL-default path (boost still applies — a boosted doc still
re-ranks).
Sourcepub fn record_meta(
&self,
document_id: impl Into<String>,
meta: DocMeta,
) -> Result<()>
pub fn record_meta( &self, document_id: impl Into<String>, meta: DocMeta, ) -> Result<()>
Record document_id → meta directly (without ingesting a document) — for
callers that store documents through some other path but still want the
curation filter/boost applied at read.
§Errors
Returns an error if the metadata table lock is poisoned.
Trait Implementations§
Source§impl Clone for CuratedKnowledgeStore
impl Clone for CuratedKnowledgeStore
Source§fn clone(&self) -> CuratedKnowledgeStore
fn clone(&self) -> CuratedKnowledgeStore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for CuratedKnowledgeStore
impl !UnwindSafe for CuratedKnowledgeStore
impl Freeze for CuratedKnowledgeStore
impl Send for CuratedKnowledgeStore
impl Sync for CuratedKnowledgeStore
impl Unpin for CuratedKnowledgeStore
impl UnsafeUnpin for CuratedKnowledgeStore
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request