pub struct AclKnowledgeStore { /* private fields */ }Expand description
An ACL-aware knowledge store: wraps any inner
KnowledgeBase and records document ACLs
at ingest so retrieval can be filtered per requester.
Construction does not itself implement KnowledgeBase for reading,
because reads must be bound to a requester. Instead:
ingest_handlereturns anArc<dyn KnowledgeBase>that records ACLs as it ingests (used by the ingestion pipeline);readermints an ACL-filteringArc<dyn KnowledgeBase>bound to a specificAccessContext(used by the runtime +knowledge_searchtool for a turn).
Implementations§
Source§impl AclKnowledgeStore
impl AclKnowledgeStore
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 an empty ACL table;
every document ingested through ingest_handle
that carries a DocAcl in its metadata is 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 ACL (if any) in the shared side table, then forwards to the
inner backend. Its query is the unfiltered inner query (callers
that read for a specific requester use reader instead).
Sourcepub fn reader(&self, ctx: AccessContext) -> Arc<dyn KnowledgeBase> ⓘ
pub fn reader(&self, ctx: AccessContext) -> Arc<dyn KnowledgeBase> ⓘ
A read-side handle bound to ctx: a KnowledgeBase whose query
over-fetches from the inner backend and drops every result the requester
is not entitled to before truncating to the requested limit.
Sourcepub fn record_acl(
&self,
document_id: impl Into<String>,
acl: DocAcl,
) -> Result<()>
pub fn record_acl( &self, document_id: impl Into<String>, acl: DocAcl, ) -> Result<()>
Record document_id → acl directly (without ingesting a document) — for
callers that store documents through some other path but still want the
ACL enforced at read.
§Errors
Returns an error if the ACL table lock is poisoned.
Trait Implementations§
Source§impl Clone for AclKnowledgeStore
impl Clone for AclKnowledgeStore
Source§fn clone(&self) -> AclKnowledgeStore
fn clone(&self) -> AclKnowledgeStore
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 AclKnowledgeStore
impl !UnwindSafe for AclKnowledgeStore
impl Freeze for AclKnowledgeStore
impl Send for AclKnowledgeStore
impl Sync for AclKnowledgeStore
impl Unpin for AclKnowledgeStore
impl UnsafeUnpin for AclKnowledgeStore
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