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