Cesar Rodas 3 місяців тому
батько
коміт
9c3759b888
5 змінених файлів з 30 додано та 720 видалено
  1. 9 704
      Cargo.lock
  2. 7 1
      Cargo.toml
  3. 0 0
      crates/storage/base/src/sqlite/mod.rs
  4. 7 8
      src/bin/dump.rs
  5. 7 7
      src/main.rs

Різницю між файлами не показано, бо вона завелика
+ 9 - 704
Cargo.lock


+ 7 - 1
Cargo.toml

@@ -4,7 +4,13 @@ version = "0.1.0"
 edition = "2021"
 
 [workspace]
-members = ["crates/types", "crates/client", "crates/relayer", "crates/storage/base", "crates/storage/rocksdb", "crates/storage/sqlx"]
+members = [
+    "crates/types",
+    "crates/client",
+    "crates/relayer",
+    "crates/storage/base",
+    "crates/storage/rocksdb",
+]
 
 [dependencies]
 nostr-rs-types = { path = "crates/types" }

+ 0 - 0
crates/storage/base/src/sqlite/mod.rs


+ 7 - 8
src/bin/dump.rs

@@ -1,8 +1,8 @@
 use futures::Future;
 use nostr_rs_client::{Error as ClientError, Event, Pool};
 use nostr_rs_rocksdb::RocksDb;
-use nostr_rs_types::{client::Subscribe, Request, Response};
 use nostr_rs_storage_base::Storage;
+use nostr_rs_types::{client::Subscribe, Request, Response};
 use std::pin::Pin;
 use tokio::sync::mpsc;
 
@@ -29,17 +29,17 @@ fn on_connection(
 async fn main() {
     env_logger::init();
     let mut clients = Pool::new()
-        .connect_to("wss://relay.damus.io/", u16::MAX, Some(on_connection))
+        .connect_to("wss://relay.damus.io/", Some(on_connection))
         .expect("valid url")
-        .connect_to("wss://brb.io", u16::MAX, Some(on_connection))
+        .connect_to("wss://brb.io", Some(on_connection))
         .expect("valid url")
-        .connect_to("wss://nos.lol", u16::MAX, Some(on_connection))
+        .connect_to("wss://nos.lol", Some(on_connection))
         .expect("valid url")
-        .connect_to("wss://relay.current.fyi", u16::MAX, Some(on_connection))
+        .connect_to("wss://relay.current.fyi", Some(on_connection))
         .expect("valid url")
-        .connect_to("wss://eden.nostr.land", u16::MAX, Some(on_connection))
+        .connect_to("wss://eden.nostr.land", Some(on_connection))
         .expect("valid url")
-        .connect_to("wss://relay.snort.social", u16::MAX, Some(on_connection))
+        .connect_to("wss://relay.snort.social", Some(on_connection))
         .expect("valid url");
 
     clients.send(Subscribe::default().into()).await;
@@ -57,7 +57,6 @@ async fn main() {
                     Response::EndOfStoredEvents(_) => {}
                     msg => {
                         println!("{} {:?}", relayed_by, msg);
-                        clients.stop().await;
                     }
                 },
                 msg => {

+ 7 - 7
src/main.rs

@@ -52,21 +52,21 @@ async fn main() {
     let db = RocksDb::new("./relayer-db").expect("db");
     let (relayer, mut server_receiver) = nostr_rs_relayer::Relayer::new(Some(db));
     let mut clients = nostr_rs_client::Pool::new()
-        .connect_to("wss://relay.damus.io/", u16::MAX, Some(on_connection))
+        .connect_to("wss://relay.damus.io/", Some(on_connection))
         .expect("valid url")
-        .connect_to("wss://brb.io", u16::MAX, Some(on_connection))
+        .connect_to("wss://brb.io", Some(on_connection))
         .expect("valid url")
-        .connect_to("wss://nos.lol", u16::MAX, Some(on_connection))
+        .connect_to("wss://nos.lol", Some(on_connection))
         .expect("valid url")
-        .connect_to("wss://relay.current.fyi", u16::MAX, Some(on_connection))
+        .connect_to("wss://relay.current.fyi", Some(on_connection))
         .expect("valid url")
-        .connect_to("wss://eden.nostr.land", u16::MAX, Some(on_connection))
+        .connect_to("wss://eden.nostr.land", Some(on_connection))
         .expect("valid url")
-        .connect_to("wss://relay.snort.social", u16::MAX, Some(on_connection))
+        .connect_to("wss://relay.snort.social", Some(on_connection))
         .expect("valid url");
 
     let addr = "127.0.0.1:3000";
-    let listener = TcpListener::bind(&addr).await.unwrap();
+    let listener: TcpListener = TcpListener::bind(&addr).await.unwrap();
 
     clients.send(Request::Request(Default::default())).await;
     loop {

Деякі файли не було показано, через те що забагато файлів було змінено