pub struct SemanticEntry {
pub id: VectorId,
pub query: String,
pub embedding: Embedding,
pub result: Value,
pub created_at: Instant,
pub ttl: Duration,
pub access_count: u64,
pub branch_context: Option<BranchContext>,
pub session_id: Option<String>,
pub workload: AIWorkloadContext,
pub tables: Vec<String>,
}Expand description
Semantic query entry with branch and session awareness
Fields§
§id: VectorIdEntry ID
query: StringOriginal query
embedding: EmbeddingQuery embedding
result: ValueCached result
created_at: InstantCreation time
ttl: DurationTTL
access_count: u64Access count
branch_context: Option<BranchContext>Branch context (for branch-aware caching)
session_id: Option<String>Session ID (for agent conversation affinity)
workload: AIWorkloadContextAI workload type
tables: Vec<String>Tables referenced by this query (for invalidation)
Implementations§
Source§impl SemanticEntry
impl SemanticEntry
Sourcepub fn new(
id: VectorId,
query: impl Into<String>,
embedding: Embedding,
result: Value,
) -> Self
pub fn new( id: VectorId, query: impl Into<String>, embedding: Embedding, result: Value, ) -> Self
Create a new semantic entry
Sourcepub fn with_branch(self, branch: BranchContext) -> Self
pub fn with_branch(self, branch: BranchContext) -> Self
Set branch context
Sourcepub fn with_session(self, session: impl Into<String>) -> Self
pub fn with_session(self, session: impl Into<String>) -> Self
Set session ID for agent affinity
Sourcepub fn with_workload(self, workload: AIWorkloadContext) -> Self
pub fn with_workload(self, workload: AIWorkloadContext) -> Self
Set AI workload context
Sourcepub fn with_tables(self, tables: Vec<String>) -> Self
pub fn with_tables(self, tables: Vec<String>) -> Self
Set referenced tables for invalidation tracking
Sourcepub fn workload_ttl(&self) -> Duration
pub fn workload_ttl(&self) -> Duration
Get workload-adjusted TTL
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if expired (considering workload-adjusted TTL)
Sourcepub fn matches_branch(&self, query_branch: &BranchContext) -> bool
pub fn matches_branch(&self, query_branch: &BranchContext) -> bool
Check if entry matches branch context
Sourcepub fn matches_session(&self, session: &String) -> bool
pub fn matches_session(&self, session: &String) -> bool
Check if entry belongs to session
Trait Implementations§
Source§impl Clone for SemanticEntry
impl Clone for SemanticEntry
Source§fn clone(&self) -> SemanticEntry
fn clone(&self) -> SemanticEntry
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SemanticEntry
impl RefUnwindSafe for SemanticEntry
impl Send for SemanticEntry
impl Sync for SemanticEntry
impl Unpin for SemanticEntry
impl UnsafeUnpin for SemanticEntry
impl UnwindSafe for SemanticEntry
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more