mirror of
https://github.com/versia-pub/activitypub.git
synced 2025-12-06 06:38:20 +01:00
[refactor]: remove redis code
This commit is contained in:
parent
10495a070c
commit
f3e010a321
|
|
@ -6,7 +6,7 @@ use std::sync::{Arc, Mutex};
|
|||
pub type DatabaseHandle = Arc<Database>;
|
||||
|
||||
/// Our "database" which contains all known users (local and federated)
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug)]
|
||||
pub struct Database {
|
||||
pub users: Mutex<Vec<DbUser>>,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ mod http;
|
|||
mod objects;
|
||||
mod utils;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, FromRedisValue, ToRedisArgs)]
|
||||
#[derive(Debug, Clone)]
|
||||
struct State {
|
||||
database: Arc<Database>,
|
||||
}
|
||||
|
|
@ -87,9 +87,9 @@ async fn main() -> actix_web::Result<(), anyhow::Error> {
|
|||
users: Mutex::new(vec![local_user]),
|
||||
});
|
||||
|
||||
let state: State = con.get("ap-layer-db").await.unwrap_or(State {
|
||||
let state: State = State {
|
||||
database: new_database,
|
||||
});
|
||||
};
|
||||
|
||||
let data = FederationConfig::builder()
|
||||
.domain(env::var("FEDERATED_DOMAIN").expect("FEDERATED_DOMAIN must be set"))
|
||||
|
|
@ -144,8 +144,7 @@ async fn main() -> actix_web::Result<(), anyhow::Error> {
|
|||
}
|
||||
}
|
||||
|
||||
info!("memory-saving 'db' in redis..");
|
||||
con.set("ap-layer-db", &state).await?;
|
||||
info!("Main thread shutdown..");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use serde::{Deserialize, Serialize};
|
|||
use std::fmt::Debug;
|
||||
use url::Url;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct DbUser {
|
||||
pub name: String,
|
||||
pub ap_id: ObjectId<DbUser>,
|
||||
|
|
|
|||
Loading…
Reference in a new issue