zephyrfs/zephyrfs-node / ae106b6

Browse files

scaffolding, initial passes

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
ae106b6d31fbfa669243d2a54fc5454a388d9205
Parents
7364665
Tree
5a6636a

3 changed files

StatusFile+-
M .gitignore 6 6
M Cargo.toml 6 3
M src/main.rs 64 0
.gitignoremodified
@@ -1,6 +1,6 @@
1
-  /target/
2
-  Cargo.lock
3
-  **/*.rs.bk
4
-  .env
5
-  .vscode/
6
-  .idea/
1
+ target/
2
+ Cargo.lock
3
+ **/*.rs.bk
4
+ .env
5
+ .vscode/
6
+ .idea/
Cargo.tomlmodified
@@ -18,12 +18,14 @@ libp2p = { version = "0.54", features = [
1818
     "ping",
1919
     "identify",
2020
     "gossipsub",
21
-    "dcutr"
21
+    "dcutr",
22
+    "tokio",
23
+    "macros"
2224
 ]}
2325
 tokio = { version = "1.39", features = ["full"] }
2426
 
25
-# Storage and database
26
-rocksdb = "0.22"
27
+# Storage and database (temporarily simplified for Phase 1.1)
28
+# rocksdb = "0.22"  # Will add back in Phase 1.2
2729
 serde = { version = "1.0", features = ["derive"] }
2830
 serde_yaml = "0.9"
2931
 
@@ -31,6 +33,7 @@ serde_yaml = "0.9"
3133
 blake3 = "1.5"
3234
 sha2 = "0.10"
3335
 rand = "0.8"
36
+hex = "0.4"
3437
 
3538
 # Protocol buffers
3639
 prost = "0.13"
src/main.rsmodified
@@ -0,0 +1,64 @@
1
+use anyhow::Result;
2
+use clap::Parser;
3
+use tracing::{info, warn};
4
+use tracing_subscriber;
5
+
6
+mod config;
7
+mod network;
8
+mod storage;
9
+mod protocol;
10
+
11
+use config::Config;
12
+use network::NetworkManager;
13
+
14
+#[derive(Parser, Debug)]
15
+#[command(author, version, about, long_about = None)]
16
+struct Args {
17
+    #[arg(short, long, value_name = "FILE")]
18
+    config: Option<std::path::PathBuf>,
19
+    
20
+    #[arg(long)]
21
+    health_check: bool,
22
+    
23
+    #[arg(short, long)]
24
+    verbose: bool,
25
+}
26
+
27
+#[tokio::main]
28
+async fn main() -> Result<()> {
29
+    let args = Args::parse();
30
+    
31
+    // Initialize logging
32
+    let log_level = if args.verbose { "debug" } else { "info" };
33
+    tracing_subscriber::fmt()
34
+        .with_env_filter(format!("zephyrfs_node={}", log_level))
35
+        .init();
36
+
37
+    if args.health_check {
38
+        // Simple health check for Docker
39
+        info!("Health check passed");
40
+        return Ok(());
41
+    }
42
+
43
+    info!("Starting ZephyrFS Node");
44
+    
45
+    // Load configuration
46
+    let config = Config::load(args.config.as_deref())?;
47
+    info!("Configuration loaded: {:?}", config);
48
+    
49
+    // Initialize network manager
50
+    let mut network_manager = NetworkManager::new(config).await?;
51
+    
52
+    // Start the node
53
+    info!("Starting P2P networking...");
54
+    network_manager.start().await?;
55
+    
56
+    // Keep running until shutdown signal
57
+    tokio::signal::ctrl_c().await?;
58
+    warn!("Shutdown signal received");
59
+    
60
+    network_manager.shutdown().await?;
61
+    info!("ZephyrFS Node stopped");
62
+    
63
+    Ok(())
64
+}