Skip to main content

SlackSubsystemHost

Struct SlackSubsystemHost 

Source
pub(crate) struct SlackSubsystemHost(Weak<Workspace>);
Expand description

The SlackHost one pump drives: a Weak<Workspace> behind the port, so the workspace can drop while a pump runs and every port call then degrades to a no-op.

Tuple Fields§

§0: Weak<Workspace>

Implementations§

Source§

impl SlackSubsystemHost

Source

pub(crate) fn new(workspace: &Arc<Workspace>) -> Self

Trait Implementations§

Source§

impl SlackHost for SlackSubsystemHost

Source§

fn client( &self, workspace: &str, timeout: Duration, ) -> Result<Arc<dyn SlackApi>, String>

A ready API for this workspace, or an error when the workspace is not configured. The host builds it, so the token stays with the workspace and the connector never asks for the credential itself. The trait object is what the pump drives, so a test host can hand back a double instead of a live client.
Source§

fn user_id(&self, workspace: &str) -> Option<String>

The authenticated user’s id for a workspace, resolved at boot. Needed to recognise <@U...> mentions.
Source§

fn user_name(&self, workspace: &str, user: &str) -> Option<String>

The display name this workspace has already resolved for a user id, or None when it has not. A users.info lookup is a call, so the host keeps what it has learned rather than the sweep re-asking for every message from a known author.
Source§

fn set_user_name(&self, workspace: &str, user: &str, name: &str)

Record a user’s display name, so the next message from them is free.
Source§

fn subscriptions(&self, workspace: &str) -> Vec<SlackSubscription>

The subscriptions scoped to one workspace.
Source§

fn watermark( &self, workspace: &str, conversation: &str, ) -> Result<Option<String>, String>

The last timestamp delivered for a conversation, or None when it has never been swept. An error means the cursor could not be read: the caller skips the conversation rather than sweeping it from the beginning, which would deliver its whole history as new.
Source§

fn set_watermark(&self, workspace: &str, conversation: &str, ts: &str)

Record the last timestamp delivered. A ts is a string with a microsecond fraction; never round-trip it through a number.
Source§

fn followed_threads( &self, workspace: &str, conversation: &str, ) -> Vec<SlackFollowedThread>

The threads tracked for a conversation, each with the owners still subscribed to it. The host prunes while listing: an owner whose subscription is gone is dropped from the record, a row’s last owner deletion removes the row, and a row idle past the host’s drop age never comes back.
Source§

fn thread_watermark( &self, workspace: &str, conversation: &str, parent_ts: &str, ) -> Result<Option<String>, String>

How far a thread’s replies have been read: normally the newest reply seen, and nothing at all before the first walk. An error means the cursor could not be read: the caller skips the thread this tick rather than walking it from the parent.
Source§

fn set_thread_watermark( &self, workspace: &str, conversation: &str, parent_ts: &str, ts: &str, )

Advance a thread’s reply cursor. It is compared as a string, and the per-tick read sends one microsecond below it as the walk’s oldest - see just_below - so a reply at the cursor is re-read for an edit.
Source§

fn mark_thread_participating( &self, workspace: &str, conversation: &str, parent_ts: &str, )

Record that the user is in a thread, so later walks read past the cursor instead of reading the thread whole to find out again.
Source§

fn thread_full_read_at( &self, workspace: &str, conversation: &str, parent_ts: &str, ) -> Option<Instant>

When this thread was last read whole, if it ever was. The attempt is stamped whether or not the read lands, so a thread that errors or is past the page cap backs off instead of retrying every tick.
Source§

fn mark_thread_full_read( &self, workspace: &str, conversation: &str, parent_ts: &str, at: Instant, )

Record a whole-thread read attempt at at.
Source§

fn thread_first_walk( &self, workspace: &str, conversation: &str, parent_ts: &str, ) -> bool

Whether this thread’s next walk is its first since the row was created. Peek, not take: a throttled or failed first walk must keep the mark, or the replay guard is lost for the row’s life. A first walk filters by ts alone: its seed is latest_reply, which an edit does not move, so an edit-aware filter would hand over corrections the previous row already had.
Source§

fn clear_thread_first_walk( &self, workspace: &str, conversation: &str, parent_ts: &str, )

Clear the first-walk mark, once that walk has actually read the thread.
Source§

fn thread_edit_watermark( &self, workspace: &str, conversation: &str, parent_ts: &str, ) -> Option<String>

The newest edit stamp a whole read has already judged. A whole read tests edited against this, never against the reply cursor: the cheap tick moves the cursor to the newest reply, and an edit below it would otherwise be behind the cursor forever. Durable with the thread row, not process state: a restart that lost it would judge every edited reply against nothing and re-offer corrections already delivered.
Source§

fn set_thread_edit_watermark( &self, workspace: &str, conversation: &str, parent_ts: &str, ts: &str, )

Advance a thread’s edit watermark to ts.
Source§

fn first_author_failure(&self, workspace: &str, user: &str) -> bool

Whether this is the first time an author lookup has failed for this user. The lookup is retried either way; this only decides whether the failure is worth a line a reader sees, since a persistent one - a token missing users:read, a network that is down - would otherwise report itself for every author on every tick.
Source§

fn first_draft_user_failure(&self, workspace: &str, user: &str) -> bool

The same once-per-user line for a held draft’s tag lookup. Kept apart from Self::first_author_failure so a draft’s miss does not spend the line the sweep relies on, and the sweep’s does not hide the draft’s.
Source§

fn follow_thread( &self, workspace: &str, conversation: &str, parent_ts: &str, owner: SlackThreadOwner, since: &str, )

Track a thread, owned by the matching subscription. A new row’s cursor starts at since, which the caller picks to be recent enough to survive the idle window and below everything still worth delivering. Tracking again by another owner adds that owner and keeps the cursor.
Source§

fn set_connected(&self, workspace: &str, connected: bool)

Liveness for the Inspector’s status line.
Source§

fn name_conversation(&self, workspace: &str, conversation: &str, name: &str)

Fill in a conversation’s display name on any subscription that has none, so the Inspector can render the name rather than the raw id. Only unnamed records are touched: a conversation renamed since it was subscribed keeps the stored name.
Source§

fn auto_subscribe(&self, workspace: &str, message: &SlackMessage) -> bool

Called after a mention is delivered, so the conversation it came from is watched too and the agent can reply into it rather than only seeing the ping. Returns whether a record was added: the host does nothing when that owner already covers the conversation.
Source§

fn own_post(&self, workspace: &str, conversation: &str, ts: &str) -> bool

Whether forge posted this message itself, read from the outbound ledger by its ts. This is what the sweep refuses: forge posts as the user, so the author says nothing about who wrote the words.
Source§

fn post_in_flight( &self, workspace: &str, conversation: &str, ) -> Option<Duration>

How long the oldest live post call in conversation has been in flight, or None when none is. A message can reach history before the post call returns and its ts is ledgered, so the sweep skips the conversation for the tick instead of delivering its own post. A mark older than REQUEST_TIMEOUT is the host’s to expire, never something to obey.
Source§

fn deliver( &self, subscription: &SlackSubscription, messages: &[SlackMessage], ) -> bool

Hand one conversation’s matched messages to its subscriber’s session, as the one block they will be read as. Returns whether delivery succeeded: a false means the caller did not advance the conversation cursor past this batch, so the next sweep re-delivers it instead of losing it.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Any for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

§

fn type_name(&self) -> &'static str

§

impl<T> AnySync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send> ⓘ

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more