pub struct MessageStore;Expand description
Stateless message store. All methods take &SqliteGraph for the shared connection.
Implementations§
Source§impl MessageStore
impl MessageStore
pub fn new() -> Self
Sourcepub fn store(
&self,
graph: &SqliteGraph,
msg_type: MessageType,
from: String,
to: String,
task_id: Option<String>,
context_id: Option<String>,
parts: Vec<Part>,
) -> Result<MessageEnvelope>
pub fn store( &self, graph: &SqliteGraph, msg_type: MessageType, from: String, to: String, task_id: Option<String>, context_id: Option<String>, parts: Vec<Part>, ) -> Result<MessageEnvelope>
Store a message and return a fully-built MessageEnvelope.
Sourcepub fn store_notification(
&self,
graph: &SqliteGraph,
to: &str,
event_type: &str,
data: &Value,
) -> Result<MessageEnvelope>
pub fn store_notification( &self, graph: &SqliteGraph, to: &str, event_type: &str, data: &Value, ) -> Result<MessageEnvelope>
Store a system notification for an offline agent. Reuses the message entity schema so it appears in poll/reconnect catch-up.
Sourcepub fn ack(
&self,
graph: &SqliteGraph,
message_id: &str,
agent_id: &str,
) -> Result<Vec<String>>
pub fn ack( &self, graph: &SqliteGraph, message_id: &str, agent_id: &str, ) -> Result<Vec<String>>
Mark a message as consumed (ACKed) by an agent.
Sourcepub fn poll(
&self,
graph: &SqliteGraph,
to: &str,
since: i64,
limit: i64,
include_acked: bool,
) -> Result<Vec<MessageEnvelope>>
pub fn poll( &self, graph: &SqliteGraph, to: &str, since: i64, limit: i64, include_acked: bool, ) -> Result<Vec<MessageEnvelope>>
Get messages for a recipient since a given sequence_id.
When include_acked is false, only returns messages not yet ACKed by the recipient.
Sourcepub fn get(
&self,
graph: &SqliteGraph,
message_id: &str,
) -> Result<MessageEnvelope>
pub fn get( &self, graph: &SqliteGraph, message_id: &str, ) -> Result<MessageEnvelope>
Get a single message by ID.
Sourcepub fn count_all(&self, graph: &SqliteGraph) -> Result<i64>
pub fn count_all(&self, graph: &SqliteGraph) -> Result<i64>
Get total message count.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MessageStore
impl RefUnwindSafe for MessageStore
impl Send for MessageStore
impl Sync for MessageStore
impl Unpin for MessageStore
impl UnsafeUnpin for MessageStore
impl UnwindSafe for MessageStore
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> 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