pub struct Service {
services: Arc<OnceServices>,
db: Data,
}Fields§
§services: Arc<OnceServices>§db: DataImplementations§
Source§impl Service
impl Service
Sourcepub async fn add_typed_relation<E: Event>(
&self,
shortroomid: ShortRoomId,
child_count: PduCount,
parent: &EventId,
child: &E,
rel_type: RelationType,
)
pub async fn add_typed_relation<E: Event>( &self, shortroomid: ShortRoomId, child_count: PduCount, parent: &EventId, child: &E, rel_type: RelationType, )
Maintain the rel_type-aware relation index for an m.replace or
m.reference child of parent. The row is keyed by the parent so a serve
of parent seeks its newest edit (or its references) without loading
non-matching children. Indexed unconditionally; only the read fold is gated.
Source§impl Service
impl Service
Sourcepub async fn event_has_relation(
&self,
event_id: &EventId,
user_id: Option<&UserId>,
rel_type: Option<&RelationType>,
key: Option<&str>,
) -> bool
pub async fn event_has_relation( &self, event_id: &EventId, user_id: Option<&UserId>, rel_type: Option<&RelationType>, key: Option<&str>, ) -> bool
Query relations of an event to determine if matching any of the trailing arguments. When all criteria are None the mere presence of a relation causes this function to return true.
Source§impl Service
impl Service
Sourcepub async fn has_relation(
&self,
target: PduId,
user_id: Option<&UserId>,
rel_type: Option<&RelationType>,
key: Option<&str>,
) -> bool
pub async fn has_relation( &self, target: PduId, user_id: Option<&UserId>, rel_type: Option<&RelationType>, key: Option<&str>, ) -> bool
Query relations of an event by PduId to determine if matching any of the trailing arguments. When all criteria are None the mere presence of a relation causes this function to return true.
Source§impl Service
impl Service
pub fn get_relations<'a>( &'a self, shortroomid: ShortRoomId, target: PduCount, from: Option<PduCount>, dir: Direction, user_id: Option<&'a UserId>, ) -> impl Stream<Item = (PduCount, Pdu)> + Send + '_
Source§impl Service
impl Service
Sourcepub async fn bundle_aggregations(&self, sender_user: &UserId, pdu: Pdu) -> Pdu
pub async fn bundle_aggregations(&self, sender_user: &UserId, pdu: Pdu) -> Pdu
Fold read-time bundled aggregations into a served event’s unsigned,
per-requester. MSC3816: the stored m.thread bundle carries a shared
current_user_participated, recomputed here for sender_user. MSC3925:
when bundle_edit_relations is enabled, the newest m.replace edit is
folded in as the full replacement event. MSC3267: when
bundle_reference_relations is enabled, the m.reference children are
folded in as a { chunk: [{ event_id }] } summary. The thread presence gate
keeps the common no-bundle case to a substring scan; the edit and reference
folds are skipped unless enabled.
Source§impl Service
impl Service
Sourceasync fn newest_replacement(&self, parent: &Pdu) -> Option<Pdu>
async fn newest_replacement(&self, parent: &Pdu) -> Option<Pdu>
MSC3925: the newest m.replace edit of parent as a full event, or None
when parent is redacted or has no valid edit. An edit counts only when it
shares the parent’s sender and type and is not itself redacted; newest is by
origin_server_ts, which the typed index sorts on.
Source§impl Service
impl Service
Sourcefn replacement_children<'a>(
&'a self,
parent: &'a Pdu,
parent_id: PduId,
) -> impl Stream<Item = Pdu> + Send + 'a
fn replacement_children<'a>( &'a self, parent: &'a Pdu, parent_id: PduId, ) -> impl Stream<Item = Pdu> + Send + 'a
Stream parent’s valid m.replace children, newest origin_server_ts
first, from the typed index. A child counts only when it shares the parent’s
sender and type and is not itself redacted.
Source§impl Service
impl Service
Sourceasync fn references(&self, parent: &Pdu) -> Vec<OwnedEventId>
async fn references(&self, parent: &Pdu) -> Vec<OwnedEventId>
MSC2675/MSC3267: the event ids of parent’s m.reference children, oldest
first, from the typed index, capped at REFERENCE_BUNDLE_MAX. Empty when
parent is redacted or unreferenced. The ids come from the index value (the
child shorteventid) without loading the children, so the chunk is filtered
for neither ignored users nor history visibility. The ignored-user posture
matches the /relations endpoint, which also does not filter relation
children by ignored sender; the history-visibility posture matches the
thread and edit bundles and is less strict than /relations, which does
filter children by visibility.
Source§impl Service
impl Service
Sourcefn referenced_children<'a>(
&'a self,
parent_id: PduId,
) -> impl Stream<Item = OwnedEventId> + Send + 'a
fn referenced_children<'a>( &'a self, parent_id: PduId, ) -> impl Stream<Item = OwnedEventId> + Send + 'a
Stream the event ids of parent_id’s m.reference children, oldest first,
from the typed index, resolving each row value (the child shorteventid) to
an event id with no PDU load.
Source§impl Service
impl Service
pub fn mark_as_referenced<'a, I>(&self, room_id: &RoomId, event_ids: I)where
I: Iterator<Item = &'a EventId>,
Source§impl Service
impl Service
pub async fn is_event_referenced( &self, room_id: &RoomId, event_id: &EventId, ) -> bool
Source§impl Service
impl Service
pub fn mark_event_soft_failed(&self, event_id: &EventId)
Source§impl Service
impl Service
pub async fn delete_all_referenced_for_room(&self, room_id: &RoomId) -> Result
Source§impl Service
impl Service
Sourcepub async fn delete_typed_relation(
&self,
child_id: &RawPduId,
child: &CanonicalJsonObject,
)
pub async fn delete_typed_relation( &self, child_id: &RawPduId, child: &CanonicalJsonObject, )
Remove the relatesto_typed row for a redacted m.replace or m.reference
child. Storage hygiene for edits; correctness-critical for references, whose
read emits from the index value without loading the child. Call before the
child’s content is stripped, while its relation fields are still readable.
Source§impl Service
impl Service
pub async fn delete_all_relatesto_typed_for_room( &self, room_id: &RoomId, ) -> Result
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 name(&self) -> &str
fn name(&self) -> &str
crate::service::make_name(std::module_path!())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 clear_cache<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn clear_cache<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn memory_usage<'life0, 'life1, 'async_trait>(
&'life0 self,
_out: &'life1 mut (dyn Write + Send),
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn memory_usage<'life0, 'life1, 'async_trait>(
&'life0 self,
_out: &'life1 mut (dyn Write + Send),
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn unconstrained(&self) -> bool
fn unconstrained(&self) -> bool
Auto Trait Implementations§
impl !RefUnwindSafe for Service
impl !UnwindSafe for Service
impl Freeze for Service
impl Send for Service
impl Sync for Service
impl Unpin for Service
impl UnsafeUnpin 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 moreimpl<T> JsonCastable<CanonicalJsonValue> for T
impl<T> JsonCastable<Value> for T
§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