pass args by ref
This commit is contained in:
@@ -28,7 +28,7 @@ struct Data {
|
||||
}
|
||||
|
||||
impl crate::Service for Service {
|
||||
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
fn build(args: &crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
Ok(Arc::new(Self {
|
||||
db: Data {
|
||||
alias_userid: args.db["alias_userid"].clone(),
|
||||
|
||||
@@ -31,10 +31,10 @@ pub struct Service {
|
||||
type Bucket<'a> = BTreeSet<(u64, &'a EventId)>;
|
||||
|
||||
impl crate::Service for Service {
|
||||
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
fn build(args: &crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
Ok(Arc::new(Self {
|
||||
services: args.services.clone(),
|
||||
db: Data::new(&args),
|
||||
db: Data::new(args),
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ pub struct Service {
|
||||
}
|
||||
|
||||
impl crate::Service for Service {
|
||||
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
fn build(args: &crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
Ok(Arc::new(Self { services: args.services.clone() }))
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ struct Data {
|
||||
}
|
||||
|
||||
impl crate::Service for Service {
|
||||
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
fn build(args: &crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
Ok(Arc::new(Self {
|
||||
db: Data {
|
||||
publicroomids: args.db["publicroomids"].clone(),
|
||||
|
||||
@@ -35,7 +35,7 @@ type RoomMutexMap = MutexMap<OwnedRoomId, ()>;
|
||||
|
||||
#[async_trait]
|
||||
impl crate::Service for Service {
|
||||
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
fn build(args: &crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
Ok(Arc::new(Self {
|
||||
mutex_federation: RoomMutexMap::new(),
|
||||
services: args.services.clone(),
|
||||
|
||||
@@ -43,7 +43,7 @@ pub type Witness = HashSet<OwnedUserId>;
|
||||
type Key<'a> = (&'a UserId, Option<&'a DeviceId>, &'a RoomId, &'a UserId);
|
||||
|
||||
impl crate::Service for Service {
|
||||
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
fn build(args: &crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
Ok(Arc::new(Self {
|
||||
db: Data {
|
||||
lazyloadedids: args.db["lazyloadedids"].clone(),
|
||||
|
||||
@@ -24,7 +24,7 @@ struct Data {
|
||||
}
|
||||
|
||||
impl crate::Service for Service {
|
||||
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
fn build(args: &crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
Ok(Arc::new(Self {
|
||||
db: Data {
|
||||
disabledroomids: args.db["disabledroomids"].clone(),
|
||||
|
||||
@@ -16,10 +16,10 @@ pub struct Service {
|
||||
}
|
||||
|
||||
impl crate::Service for Service {
|
||||
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
fn build(args: &crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
Ok(Arc::new(Self {
|
||||
services: args.services.clone(),
|
||||
db: Data::new(&args),
|
||||
db: Data::new(args),
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
@@ -28,10 +28,10 @@ pub struct Service {
|
||||
}
|
||||
|
||||
impl crate::Service for Service {
|
||||
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
fn build(args: &crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
Ok(Arc::new(Self {
|
||||
services: args.services.clone(),
|
||||
db: Data::new(&args),
|
||||
db: Data::new(args),
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ const TOKEN_ID_MAX_LEN: usize =
|
||||
const WORD_MAX_LEN: usize = 50;
|
||||
|
||||
impl crate::Service for Service {
|
||||
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
fn build(args: &crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
Ok(Arc::new(Self {
|
||||
db: Data { tokenids: args.db["tokenids"].clone() },
|
||||
services: args.services.clone(),
|
||||
|
||||
@@ -24,7 +24,7 @@ struct Data {
|
||||
pub type ShortStateHash = ShortId;
|
||||
|
||||
impl crate::Service for Service {
|
||||
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
fn build(args: &crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
Ok(Arc::new(Self {
|
||||
db: Data {
|
||||
eventid_shorteventid: args.db["eventid_shorteventid"].clone(),
|
||||
|
||||
@@ -59,7 +59,7 @@ type Cache = LruCache<OwnedRoomId, Option<CachedSpaceHierarchySummary>>;
|
||||
|
||||
#[async_trait]
|
||||
impl crate::Service for Service {
|
||||
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
fn build(args: &crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
let config = &args.server.config;
|
||||
let cache_size = f64::from(config.roomid_spacehierarchy_cache_capacity);
|
||||
let cache_size = cache_size * config.cache_capacity_modifier;
|
||||
|
||||
@@ -51,7 +51,7 @@ pub type RoomMutexGuard = MutexMapGuard<OwnedRoomId, ()>;
|
||||
|
||||
#[async_trait]
|
||||
impl crate::Service for Service {
|
||||
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
fn build(args: &crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
Ok(Arc::new(Self {
|
||||
mutex: RoomMutexMap::new(),
|
||||
services: args.services.clone(),
|
||||
|
||||
@@ -44,7 +44,7 @@ struct Data {
|
||||
|
||||
#[async_trait]
|
||||
impl crate::Service for Service {
|
||||
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
fn build(args: &crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
Ok(Arc::new(Self {
|
||||
services: args.services.clone(),
|
||||
db: Data {
|
||||
|
||||
@@ -52,7 +52,7 @@ type StrippedStateEventItem = (OwnedRoomId, Vec<Raw<AnyStrippedStateEvent>>);
|
||||
type SyncStateEventItem = (OwnedRoomId, Vec<Raw<AnySyncStateEvent>>);
|
||||
|
||||
impl crate::Service for Service {
|
||||
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
fn build(args: &crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
Ok(Arc::new(Self {
|
||||
appservice_in_room_cache: RwLock::new(HashMap::new()),
|
||||
services: args.services.clone(),
|
||||
|
||||
@@ -60,7 +60,7 @@ pub type CompressedStateEvent = [u8; 2 * size_of::<ShortId>()];
|
||||
|
||||
#[async_trait]
|
||||
impl crate::Service for Service {
|
||||
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
fn build(args: &crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
let config = &args.server.config;
|
||||
let cache_capacity =
|
||||
f64::from(config.stateinfo_cache_capacity) * config.cache_capacity_modifier;
|
||||
|
||||
@@ -27,7 +27,7 @@ pub(super) struct Data {
|
||||
}
|
||||
|
||||
impl crate::Service for Service {
|
||||
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
fn build(args: &crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
Ok(Arc::new(Self {
|
||||
db: Data {
|
||||
threadid_userids: args.db["threadid_userids"].clone(),
|
||||
|
||||
@@ -79,7 +79,7 @@ pub type PdusIterItem = (PduCount, PduEvent);
|
||||
|
||||
#[async_trait]
|
||||
impl crate::Service for Service {
|
||||
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
fn build(args: &crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
Ok(Arc::new(Self {
|
||||
services: args.services.clone(),
|
||||
db: Data {
|
||||
|
||||
@@ -24,7 +24,7 @@ pub struct Service {
|
||||
}
|
||||
|
||||
impl crate::Service for Service {
|
||||
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
fn build(args: &crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
Ok(Arc::new(Self {
|
||||
server: args.server.clone(),
|
||||
services: args.services.clone(),
|
||||
|
||||
@@ -23,7 +23,7 @@ struct Data {
|
||||
}
|
||||
|
||||
impl crate::Service for Service {
|
||||
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
fn build(args: &crate::Args<'_>) -> Result<Arc<Self>> {
|
||||
Ok(Arc::new(Self {
|
||||
db: Data {
|
||||
db: args.db.clone(),
|
||||
|
||||
Reference in New Issue
Block a user