pub struct Scope {
pub org_id: String,
pub agent_id: Option<String>,
pub user_id: Option<String>,
pub session_id: Option<String>,
}Expand description
Hierarchical scope for memory isolation.
The minimum required field is org_id. All other fields are optional and
progressively narrow the scope. A Scope with only org_id is an
“org-level” scope; adding user_id narrows it to a user; adding
session_id narrows it further to a single conversation session.
agent_id is orthogonal — it tracks which agent instance wrote or owns
a piece of memory, without affecting the containment hierarchy.
Fields§
§org_id: StringOrganisation (tenant) identifier. Required; defaults to "default".
agent_id: Option<String>Agent instance identifier (optional).
user_id: Option<String>End-user identifier (optional).
session_id: Option<String>Conversation session identifier (optional).
Implementations§
Source§impl Scope
impl Scope
Sourcepub fn user(org_id: impl Into<String>, user_id: impl Into<String>) -> Self
pub fn user(org_id: impl Into<String>, user_id: impl Into<String>) -> Self
User-level scope — scoped to a specific end-user within an org.
Sourcepub fn session(
org_id: impl Into<String>,
user_id: impl Into<String>,
session_id: impl Into<String>,
) -> Self
pub fn session( org_id: impl Into<String>, user_id: impl Into<String>, session_id: impl Into<String>, ) -> Self
Session-level scope — scoped to a single conversation session.
Sourcepub fn full(
org_id: impl Into<String>,
agent_id: impl Into<String>,
user_id: impl Into<String>,
session_id: impl Into<String>,
) -> Self
pub fn full( org_id: impl Into<String>, agent_id: impl Into<String>, user_id: impl Into<String>, session_id: impl Into<String>, ) -> Self
Full scope — all four fields set.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Scope
impl<'de> Deserialize<'de> for Scope
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Scope
impl StructuralPartialEq for Scope
Auto Trait Implementations§
impl Freeze for Scope
impl RefUnwindSafe for Scope
impl Send for Scope
impl Sync for Scope
impl Unpin for Scope
impl UnsafeUnpin for Scope
impl UnwindSafe for Scope
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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>
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>
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