mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 07:41:23 +01:00
remove src/lib.rs
This commit is contained in:
parent
0f7b6d482c
commit
c097e79e52
3 changed files with 32 additions and 37 deletions
|
|
@ -128,14 +128,6 @@ jemalloc = ["tikv-jemalloc-ctl", "tikv-jemallocator"]
|
||||||
sqlite = ["rusqlite", "parking_lot", "tokio/signal"]
|
sqlite = ["rusqlite", "parking_lot", "tokio/signal"]
|
||||||
systemd = ["sd-notify"]
|
systemd = ["sd-notify"]
|
||||||
|
|
||||||
[[bin]]
|
|
||||||
name = "conduit"
|
|
||||||
path = "src/main.rs"
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
name = "conduit"
|
|
||||||
path = "src/lib.rs"
|
|
||||||
|
|
||||||
[package.metadata.deb]
|
[package.metadata.deb]
|
||||||
name = "matrix-conduit"
|
name = "matrix-conduit"
|
||||||
maintainer = "Paul van Tilburg <paul@luon.net>"
|
maintainer = "Paul van Tilburg <paul@luon.net>"
|
||||||
|
|
|
||||||
26
src/lib.rs
26
src/lib.rs
|
|
@ -1,26 +0,0 @@
|
||||||
pub mod api;
|
|
||||||
pub mod clap;
|
|
||||||
mod config;
|
|
||||||
mod database;
|
|
||||||
mod service;
|
|
||||||
mod utils;
|
|
||||||
|
|
||||||
// Not async due to services() being used in many closures, and async closures are not stable as of writing
|
|
||||||
// This is the case for every other occurence of sync Mutex/RwLock, except for database related ones, where
|
|
||||||
// the current maintainer (Timo) has asked to not modify those
|
|
||||||
use std::sync::RwLock;
|
|
||||||
|
|
||||||
pub use api::ruma_wrapper::{Ruma, RumaResponse};
|
|
||||||
pub use config::Config;
|
|
||||||
pub use database::KeyValueDatabase;
|
|
||||||
pub use service::{pdu::PduEvent, Services};
|
|
||||||
pub use utils::error::{Error, Result};
|
|
||||||
|
|
||||||
pub static SERVICES: RwLock<Option<&'static Services>> = RwLock::new(None);
|
|
||||||
|
|
||||||
pub fn services() -> &'static Services {
|
|
||||||
SERVICES
|
|
||||||
.read()
|
|
||||||
.unwrap()
|
|
||||||
.expect("SERVICES should be initialized when this is called")
|
|
||||||
}
|
|
||||||
35
src/main.rs
35
src/main.rs
|
|
@ -1,4 +1,10 @@
|
||||||
use std::{future::Future, io, net::SocketAddr, sync::atomic, time::Duration};
|
use std::{
|
||||||
|
future::Future,
|
||||||
|
io,
|
||||||
|
net::SocketAddr,
|
||||||
|
sync::{atomic, RwLock},
|
||||||
|
time::Duration,
|
||||||
|
};
|
||||||
|
|
||||||
use axum::{
|
use axum::{
|
||||||
extract::{DefaultBodyLimit, FromRequestParts, MatchedPath},
|
extract::{DefaultBodyLimit, FromRequestParts, MatchedPath},
|
||||||
|
|
@ -7,7 +13,6 @@ use axum::{
|
||||||
Router,
|
Router,
|
||||||
};
|
};
|
||||||
use axum_server::{bind, bind_rustls, tls_rustls::RustlsConfig, Handle as ServerHandle};
|
use axum_server::{bind, bind_rustls, tls_rustls::RustlsConfig, Handle as ServerHandle};
|
||||||
use conduit::api::{client_server, server_server};
|
|
||||||
use figment::{
|
use figment::{
|
||||||
providers::{Env, Format, Toml},
|
providers::{Env, Format, Toml},
|
||||||
Figment,
|
Figment,
|
||||||
|
|
@ -33,7 +38,19 @@ use tower_http::{
|
||||||
use tracing::{debug, error, info, warn};
|
use tracing::{debug, error, info, warn};
|
||||||
use tracing_subscriber::{prelude::*, EnvFilter};
|
use tracing_subscriber::{prelude::*, EnvFilter};
|
||||||
|
|
||||||
pub use conduit::*; // Re-export everything from the library crate
|
pub mod api;
|
||||||
|
pub mod clap;
|
||||||
|
mod config;
|
||||||
|
mod database;
|
||||||
|
mod service;
|
||||||
|
mod utils;
|
||||||
|
|
||||||
|
pub use api::ruma_wrapper::{Ruma, RumaResponse};
|
||||||
|
use api::{client_server, server_server};
|
||||||
|
pub use config::Config;
|
||||||
|
pub use database::KeyValueDatabase;
|
||||||
|
pub use service::{pdu::PduEvent, Services};
|
||||||
|
pub use utils::error::{Error, Result};
|
||||||
|
|
||||||
#[cfg(all(not(target_env = "msvc"), feature = "jemalloc"))]
|
#[cfg(all(not(target_env = "msvc"), feature = "jemalloc"))]
|
||||||
use tikv_jemallocator::Jemalloc;
|
use tikv_jemallocator::Jemalloc;
|
||||||
|
|
@ -42,6 +59,18 @@ use tikv_jemallocator::Jemalloc;
|
||||||
#[global_allocator]
|
#[global_allocator]
|
||||||
static GLOBAL: Jemalloc = Jemalloc;
|
static GLOBAL: Jemalloc = Jemalloc;
|
||||||
|
|
||||||
|
pub static SERVICES: RwLock<Option<&'static Services>> = RwLock::new(None);
|
||||||
|
|
||||||
|
// Not async due to services() being used in many closures, and async closures are not stable as of writing
|
||||||
|
// This is the case for every other occurence of sync Mutex/RwLock, except for database related ones, where
|
||||||
|
// the current maintainer (Timo) has asked to not modify those
|
||||||
|
pub fn services() -> &'static Services {
|
||||||
|
SERVICES
|
||||||
|
.read()
|
||||||
|
.unwrap()
|
||||||
|
.expect("SERVICES should be initialized when this is called")
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
clap::parse();
|
clap::parse();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue