shard sender into multiple task workers by destination hash

rename Destination::Normal variant

tracing instruments

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-12-18 03:34:56 +00:00 committed by strawberry
parent 98e6c81e49
commit af3d6a2e37
9 changed files with 275 additions and 95 deletions

View file

@ -7,14 +7,14 @@ use ruma::{OwnedServerName, OwnedUserId};
pub enum Destination {
Appservice(String),
Push(OwnedUserId, String), // user and pushkey
Normal(OwnedServerName),
Federation(OwnedServerName),
}
#[implement(Destination)]
#[must_use]
pub(super) fn get_prefix(&self) -> Vec<u8> {
match self {
| Self::Normal(server) => {
| Self::Federation(server) => {
let len = server.as_bytes().len().saturating_add(1);
let mut p = Vec::with_capacity(len);