pub struct Service {
pub db: Data,
server: Arc<Server>,
services: Arc<OnceServices>,
channels: Vec<(Sender<Msg>, Receiver<Msg>)>,
}Fields§
§db: Data§server: Arc<Server>§services: Arc<OnceServices>§channels: Vec<(Sender<Msg>, Receiver<Msg>)>Implementations§
Source§impl Service
impl Service
pub(super) async fn sender(self: Arc<Self>, id: usize) -> Result
async fn work_loop<'a>( &'a self, id: usize, futures: &mut FuturesUnordered<BoxFuture<'a, Result<Destination, (Destination, Error)>>>, statuses: &mut HashMap<Destination, TransactionStatus>, )
async fn handle_response<'a>( &'a self, response: Result<Destination, (Destination, Error)>, futures: &mut FuturesUnordered<BoxFuture<'a, Result<Destination, (Destination, Error)>>>, statuses: &mut HashMap<Destination, TransactionStatus>, )
fn handle_response_err( dest: Destination, statuses: &mut HashMap<Destination, TransactionStatus>, e: &Error, )
async fn handle_response_ok<'a>( &'a self, dest: &Destination, futures: &mut FuturesUnordered<BoxFuture<'a, Result<Destination, (Destination, Error)>>>, statuses: &mut HashMap<Destination, TransactionStatus>, )
async fn handle_request<'a>( &'a self, msg: Msg, futures: &mut FuturesUnordered<BoxFuture<'a, Result<Destination, (Destination, Error)>>>, statuses: &mut HashMap<Destination, TransactionStatus>, )
async fn finish_responses<'a>( &'a self, futures: &mut FuturesUnordered<BoxFuture<'a, Result<Destination, (Destination, Error)>>>, )
async fn startup_netburst<'a>( &'a self, id: usize, futures: &mut FuturesUnordered<BoxFuture<'a, Result<Destination, (Destination, Error)>>>, statuses: &mut HashMap<Destination, TransactionStatus>, )
async fn select_events( &self, dest: &Destination, new_events: Vec<(Vec<u8>, SendingEvent)>, statuses: &mut HashMap<Destination, TransactionStatus>, ) -> Result<Option<Vec<SendingEvent>>>
fn select_events_current( &self, dest: &Destination, statuses: &mut HashMap<Destination, TransactionStatus>, ) -> Result<(bool, bool)>
async fn select_edus(&self, server_name: &ServerName) -> Result<(EduVec, u64)>
Sourceasync fn select_edus_device_changes(
&self,
server_name: &ServerName,
since: (u64, u64),
max_edu_count: &AtomicU64,
events_len: &AtomicUsize,
) -> EduVec
async fn select_edus_device_changes( &self, server_name: &ServerName, since: (u64, u64), max_edu_count: &AtomicU64, events_len: &AtomicUsize, ) -> EduVec
Look for device changes
Sourceasync fn select_edus_receipts(
&self,
server_name: &ServerName,
since: (u64, u64),
max_edu_count: &AtomicU64,
) -> EduVec
async fn select_edus_receipts( &self, server_name: &ServerName, since: (u64, u64), max_edu_count: &AtomicU64, ) -> EduVec
Look for read receipts in this room
MSC3771 lets a user emit multiple receipts in the same EDU window, one
per thread context. The federation EDU shape allows only one
ReceiptData per (room, user) slot, so a user with N parallel
thread receipts ships across N parallel Edu::Receipt buffers within
the same transaction. Each buffer is shape-compliant; receivers
process them as independent receipt EDUs and our storage keeps each
thread distinct.
Sourceasync fn select_edus_receipts_room(
&self,
room_id: &RoomId,
since: (u64, u64),
max_edu_count: &AtomicU64,
num: &AtomicUsize,
) -> SmallVec<[ReceiptMap; 1]> ⓘ
async fn select_edus_receipts_room( &self, room_id: &RoomId, since: (u64, u64), max_edu_count: &AtomicU64, num: &AtomicUsize, ) -> SmallVec<[ReceiptMap; 1]> ⓘ
Look for read receipts in this room.
Returns a per-rank vector of [ReceiptMap]s. Each user’s receipts in
the window (one per thread context, count-ordered) are placed into
successive ranks, so rank 0 carries each user’s earliest receipt,
rank 1 the next, and so on. The receipt-limit budget bounds distinct
users only; subsequent thread receipts for an already-counted user do
not consume additional budget.
Sourceasync fn select_edus_presence(
&self,
server_name: &ServerName,
since: (u64, u64),
max_edu_count: &AtomicU64,
) -> Option<EduBuf>
async fn select_edus_presence( &self, server_name: &ServerName, since: (u64, u64), max_edu_count: &AtomicU64, ) -> Option<EduBuf>
Look for presence
fn send_events( &self, dest: Destination, events: Vec<SendingEvent>, ) -> BoxFuture<'_, Result<Destination, (Destination, Error)>>
async fn send_events_dest_appservice( &self, id: String, events: Vec<SendingEvent>, ) -> Result<Destination, (Destination, Error)>
async fn send_events_dest_push( &self, user_id: OwnedUserId, pushkey: String, events: Vec<SendingEvent>, ) -> Result<Destination, (Destination, Error)>
pub fn schedule_flush_suppressed_for_pushkey( &self, user_id: OwnedUserId, pushkey: String, reason: &'static str, )
pub fn schedule_flush_suppressed_for_user( &self, user_id: OwnedUserId, reason: &'static str, )
async fn enqueue_suppressed_push_events( &self, user_id: &UserId, pushkey: &str, events: &[SendingEvent], ) -> usize
async fn flush_suppressed_rooms( &self, user_id: &UserId, pushkey: &str, pusher: &Pusher, rules_for_user: &Ruleset, rooms: Vec<(OwnedRoomId, Vec<RawPduId>)>, reason: &'static str, )
async fn flush_suppressed_for_pushkey( &self, user_id: OwnedUserId, pushkey: String, reason: &'static str, )
pub async fn flush_suppressed_for_user( &self, user_id: OwnedUserId, reason: &'static str, )
async fn pushing_suppressed(&self, user_id: &UserId) -> bool
async fn send_events_dest_federation( &self, server: OwnedServerName, events: Vec<SendingEvent>, ) -> Result<Destination, (Destination, Error)>
Source§impl Service
impl Service
pub fn send_pdu_push( &self, pdu_id: &RawPduId, user: &UserId, pushkey: String, ) -> Result
pub fn send_pdu_appservice( &self, appservice_id: String, pdu_id: RawPduId, ) -> Result
pub async fn send_pdu_room(&self, room_id: &RoomId, pdu_id: &RawPduId) -> Result
pub async fn send_pdu_servers<'a, S>(
&self,
servers: S,
pdu_id: &RawPduId,
) -> Resultwhere
S: Stream<Item = &'a ServerName> + Send + 'a,
pub fn send_edu_server(&self, server: &ServerName, serialized: EduBuf) -> Result
pub async fn send_edu_room( &self, room_id: &RoomId, serialized: EduBuf, ) -> Result
Sourcepub fn send_edu_appservice(
&self,
appservice_id: String,
serialized: EduBuf,
) -> Result
pub fn send_edu_appservice( &self, appservice_id: String, serialized: EduBuf, ) -> Result
Queue an EDU for delivery to a specific appservice.
Sourcepub async fn send_edu_room_appservices<'a, F>(
&self,
room_id: &RoomId,
serializer: F,
) -> Result
pub async fn send_edu_room_appservices<'a, F>( &self, room_id: &RoomId, serializer: F, ) -> Result
Sends an EDU to all appservices interested in a room.
The serialized data must be in EphemeralData format, not federation
Edu.
pub async fn send_edu_servers<'a, S>(
&self,
servers: S,
serialized: EduBuf,
) -> Resultwhere
S: Stream<Item = &'a ServerName> + Send + 'a,
pub async fn flush_room(&self, room_id: &RoomId) -> Result
pub async fn flush_servers<'a, S>(&self, servers: S) -> Resultwhere
S: Stream<Item = &'a ServerName> + Send + 'a,
Sourcepub async fn cleanup_events(
&self,
appservice_id: Option<&str>,
user_id: Option<&UserId>,
push_key: Option<&str>,
) -> Result
pub async fn cleanup_events( &self, appservice_id: Option<&str>, user_id: Option<&UserId>, push_key: Option<&str>, ) -> Result
Clean up queued sending event data
Used after we remove an appservice registration or a user deletes a push key
fn dispatch(&self, msg: Msg) -> Result
pub(crate) fn shard_id(&self, dest: &Destination) -> usize
Trait Implementations§
Source§impl Service for Service
impl Service for Service
Source§fn build(args: &Args<'_>) -> Result<Arc<Self>>
fn build(args: &Args<'_>) -> Result<Arc<Self>>
Source§fn worker<'async_trait>(
self: Arc<Self>,
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>>where
Self: 'async_trait,
fn worker<'async_trait>(
self: Arc<Self>,
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>>where
Self: 'async_trait,
Source§fn interrupt<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn interrupt<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn name(&self) -> &str
fn name(&self) -> &str
crate::service::make_name(std::module_path!())Source§fn unconstrained(&self) -> bool
fn unconstrained(&self) -> bool
Auto Trait Implementations§
impl Freeze for Service
impl !RefUnwindSafe for Service
impl Send for Service
impl Sync for Service
impl Unpin for Service
impl UnsafeUnpin for Service
impl !UnwindSafe for Service
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> ExpectInto for T
impl<T> ExpectInto for T
fn expect_into<Dst>(self) -> Dst
Source§impl<T> Expected for T
impl<T> Expected for T
fn expected_add(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedAdd,
fn expected_sub(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedSub,
fn expected_mul(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedMul,
fn expected_div(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedDiv,
fn expected_rem(self, rhs: Self) -> Selfwhere
Self: Sized + CheckedRem,
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ServiceExt for T
impl<T> ServiceExt for T
§fn add_extension<T>(self, value: T) -> AddExtension<Self, T>where
Self: Sized,
fn add_extension<T>(self, value: T) -> AddExtension<Self, T>where
Self: Sized,
§fn compression(self) -> Compression<Self>where
Self: Sized,
fn compression(self) -> Compression<Self>where
Self: Sized,
§fn decompression(self) -> Decompression<Self>where
Self: Sized,
fn decompression(self) -> Decompression<Self>where
Self: Sized,
§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
§fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
§fn sensitive_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>where
Self: Sized,
fn sensitive_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>where
Self: Sized,
§fn sensitive_request_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<Self>where
Self: Sized,
fn sensitive_request_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<Self>where
Self: Sized,
§fn sensitive_response_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveResponseHeaders<Self>where
Self: Sized,
fn sensitive_response_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveResponseHeaders<Self>where
Self: Sized,
§fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
500 Internal Server responses. Read more