mirror of
https://github.com/logos-messaging/libchat.git
synced 2026-06-28 03:59:27 +00:00
Rename components
This commit is contained in:
parent
06e29b1dbf
commit
07c528040f
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1315,6 +1315,7 @@ dependencies = [
|
||||
"arboard",
|
||||
"base64",
|
||||
"clap",
|
||||
"components",
|
||||
"crossbeam-channel",
|
||||
"crossterm 0.29.0",
|
||||
"logos-chat",
|
||||
@ -1468,6 +1469,7 @@ dependencies = [
|
||||
"libchat",
|
||||
"reqwest 0.12.28",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"storage",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
|
||||
@ -4,7 +4,7 @@ version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[features]
|
||||
logos-delivery = []
|
||||
embedded_p2p_delivery = []
|
||||
|
||||
[dependencies]
|
||||
# Workspace dependencies (sorted)
|
||||
|
||||
@ -2,7 +2,7 @@ fn main() {
|
||||
println!("cargo:rerun-if-env-changed=LOGOS_DELIVERY_LIB_DIR");
|
||||
println!("cargo::rustc-check-cfg=cfg(logos_delivery)");
|
||||
|
||||
let feature_enabled = std::env::var("CARGO_FEATURE_LOGOS_DELIVERY").is_ok();
|
||||
let feature_enabled = std::env::var("CARGO_FEATURE_EMBEDDED_P2P_DELIVERY").is_ok();
|
||||
let lib_dir = std::env::var("LOGOS_DELIVERY_LIB_DIR");
|
||||
|
||||
let lib_dir = match lib_dir {
|
||||
|
||||
@ -3,7 +3,7 @@ mod local_broadcaster;
|
||||
pub use local_broadcaster::LocalBroadcaster;
|
||||
|
||||
#[cfg(logos_delivery)]
|
||||
mod embedded_p2p_delivery;
|
||||
pub mod embedded_p2p_delivery;
|
||||
|
||||
#[cfg(logos_delivery)]
|
||||
pub use embedded_p2p_delivery::EmbeddedP2pDeliveryService;
|
||||
pub use embedded_p2p_delivery::{EmbeddedP2pDeliveryService, P2pConfig};
|
||||
|
||||
@ -49,16 +49,16 @@ struct OutboundCmd {
|
||||
|
||||
type SubscriberList = Arc<Mutex<Vec<Sender<Vec<u8>>>>>;
|
||||
|
||||
// ── Config ───────────────────────────────────────────────────────────────────
|
||||
// ── P2pConfig ───────────────────────────────────────────────────────────────────
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Config {
|
||||
pub struct P2pConfig {
|
||||
pub preset: String,
|
||||
pub tcp_port: u16,
|
||||
pub log_level: String,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
impl Default for P2pConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
preset: "logos.dev".into(),
|
||||
@ -130,7 +130,7 @@ pub struct EmbeddedP2pDeliveryService {
|
||||
impl EmbeddedP2pDeliveryService {
|
||||
/// Start the embedded logos-delivery node. The client drains inbound
|
||||
/// payloads via [`Transport::inbound`].
|
||||
pub fn start(cfg: Config) -> Result<Self, DeliveryError> {
|
||||
pub fn start(cfg: P2pConfig) -> Result<Self, DeliveryError> {
|
||||
let (out_tx, out_rx) = mpsc::sync_channel::<OutboundCmd>(256);
|
||||
let subscribers: SubscriberList = Arc::new(Mutex::new(Vec::new()));
|
||||
let (ready_tx, ready_rx) = mpsc::channel::<Result<(), DeliveryError>>();
|
||||
@ -177,7 +177,7 @@ impl EmbeddedP2pDeliveryService {
|
||||
}
|
||||
|
||||
fn node_thread(
|
||||
cfg: Config,
|
||||
cfg: P2pConfig,
|
||||
out_rx: mpsc::Receiver<OutboundCmd>,
|
||||
subscribers: SubscriberList,
|
||||
inbound_tx: Sender<Vec<u8>>,
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
mod contact_registry;
|
||||
mod delivery;
|
||||
pub mod delivery;
|
||||
mod storage;
|
||||
mod wakeup;
|
||||
|
||||
pub use contact_registry::ephemeral::EphemeralRegistry;
|
||||
pub use contact_registry::http::{HttpRegistry, HttpRegistryError};
|
||||
pub use delivery::*;
|
||||
pub use storage::*;
|
||||
pub use wakeup::*;
|
||||
|
||||
#[cfg(logos_delivery)]
|
||||
pub use delivery::{EmbeddedP2pDeliveryService, P2pConfig};
|
||||
|
||||
@ -37,9 +37,10 @@
|
||||
}
|
||||
);
|
||||
|
||||
devShells = forAllSystems ({ pkgs, ... }:
|
||||
devShells = forAllSystems ({ pkgs, system, ... }:
|
||||
let
|
||||
rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust_toolchain.toml;
|
||||
logosDeliveryLib = self.packages.${system}.logos-delivery;
|
||||
in
|
||||
{
|
||||
default = pkgs.mkShell {
|
||||
@ -50,6 +51,10 @@
|
||||
pkgs.perl
|
||||
pkgs.protobuf
|
||||
];
|
||||
buildInputs = [ logosDeliveryLib ];
|
||||
shellHook = ''
|
||||
export LOGOS_DELIVERY_LIB_DIR="${logosDeliveryLib}/lib"
|
||||
'';
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user