pub struct HttpState(/* private fields */);Expand description
Cloneable handle to the channel’s state. Build the server with
router; the crate::HttpChannel shares the same state.
Implementations§
Source§impl HttpState
impl HttpState
Sourcepub fn new(config: HttpConfig, deps: HttpDeps) -> Self
pub fn new(config: HttpConfig, deps: HttpDeps) -> Self
Assemble the state from configuration and dependencies.
Sourcepub fn config(&self) -> &HttpConfig
pub fn config(&self) -> &HttpConfig
The channel configuration.
Sourcepub async fn register_base_lanes(&self)
pub async fn register_base_lanes(&self)
Register the chat and investigation lanes (persisted) and capture the template per-user lanes are cloned from.
Sourcepub fn set_base_group(&self, group: RegisteredGroup)
pub fn set_base_group(&self, group: RegisteredGroup)
Set the template per-user lanes are cloned from (normally captured by
Self::register_base_lanes).
Sourcepub async fn ensure_user_lane(
&self,
user_id: Option<&UserId>,
user_name: Option<&str>,
) -> Result<String, LaneLimitReached>
pub async fn ensure_user_lane( &self, user_id: Option<&UserId>, user_name: Option<&str>, ) -> Result<String, LaneLimitReached>
Resolve (registering on first use) the lane for a validated CoPilot
user id. None maps to the shared base lane.
Sourcepub fn user_lane_jids(&self) -> Vec<String>
pub fn user_lane_jids(&self) -> Vec<String>
Every registered per-user lane JID.
Sourcepub async fn sweep_idle_lanes(&self) -> Vec<String>
pub async fn sweep_idle_lanes(&self) -> Vec<String>
Drop per-user lanes idle for longer than lane_idle. Returns the
swept JIDs.
Sourcepub async fn sweep_idle_lanes_before(&self, cutoff: Instant) -> Vec<String>
pub async fn sweep_idle_lanes_before(&self, cutoff: Instant) -> Vec<String>
Drop per-user lanes whose last traffic is older than cutoff.
Sourcepub async fn seed_digest_task(&self) -> Result<bool>
pub async fn seed_digest_task(&self) -> Result<bool>
Seed the paused alert digest task if it does not exist yet.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for HttpState
impl !UnwindSafe for HttpState
impl Freeze for HttpState
impl Send for HttpState
impl Sync for HttpState
impl Unpin for HttpState
impl UnsafeUnpin for HttpState
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