pub struct EncodeBuilder { /* private fields */ }Expand description
Builder for an ENCODE request. Stores one text memory; session defaults
to 0 and occurred_at is unset (the server stamps ingest time).
Implementations§
Source§impl EncodeBuilder
impl EncodeBuilder
Sourcepub fn new(text: impl Into<String>) -> Self
pub fn new(text: impl Into<String>) -> Self
Start an ENCODE for text (session 0, no explicit occurred-at).
Sourcepub fn wait(self, wait: WaitMode) -> Self
pub fn wait(self, wait: WaitMode) -> Self
Set the write-completion mode. WaitMode::Ack (the default) returns
after the durable ack; WaitMode::Derived blocks until async
derivation completes and returns a populated trace on the
[EncodeResponse].
Sourcepub fn wait_derived(self) -> Self
pub fn wait_derived(self) -> Self
Block until async derivation completes and return the full write trace
— convenience for .wait(WaitMode::Derived).
Sourcepub fn act_as(
self,
namespace: impl Into<String>,
space_id: impl Into<String>,
) -> Self
pub fn act_as( self, namespace: impl Into<String>, space_id: impl Into<String>, ) -> Self
Run this encode on behalf of another (namespace, space_id) identity.
Requires the connection principal to hold the can_act_as grant; set
per request, never on the client, so a pooled client can serve many
effective identities.
Sourcepub fn session(self, session_id: u64) -> Self
pub fn session(self, session_id: u64) -> Self
Set the session (conversation) the memory belongs to.
Sourcepub fn occurred_at(self, occurred_at_unix_nanos: u64) -> Self
pub fn occurred_at(self, occurred_at_unix_nanos: u64) -> Self
Set the event time the memory describes (unix nanos). Unset means the server stamps the ingest time.
Sourcepub fn allow_duplicates(self, allow: bool) -> Self
pub fn allow_duplicates(self, allow: bool) -> Self
Opt out of content dedup and force a distinct memory. By default Brain
dedupes byte-identical text on (space_id, session_id, BLAKE3(text)) and
returns the existing memory (was_deduplicated = true) without writing.
Call this when the same text is a genuinely distinct observation that
must coexist (e.g. the same fact re-stated at a different occurred_at).
Sourcepub fn build(self) -> EncodeRequest
pub fn build(self) -> EncodeRequest
Finish into a wire EncodeRequest, minting a fresh request_id.