feat: integrate nostrdb relay indexing

- Upgrade `nostrdb` to v0.6.1 with relay metadata support
- Switch to `nostr::RelayUrl` for typed relay URLs
- Use `process_event_with()` to pass relay info during ingestion
- Update `Relay`, `RelayPool`, and unknown ID logic accordingly

This enables richer indexing with relay provenance in events.

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2025-03-21 16:17:32 -07:00
parent a7f34a9dc7
commit 26b58683b8
12 changed files with 52 additions and 25 deletions

View File

@@ -1,5 +1,5 @@
use crate::relay::{setup_multicast_relay, MulticastRelay, Relay, RelayStatus};
use crate::{ClientMessage, Result};
use crate::{ClientMessage, Error, Result};
use nostrdb::Filter;
use std::collections::BTreeSet;
@@ -50,7 +50,7 @@ pub struct WebsocketRelay {
impl PoolRelay {
pub fn url(&self) -> &str {
match self {
Self::Websocket(wsr) => &wsr.relay.url,
Self::Websocket(wsr) => wsr.relay.url.as_str(),
Self::Multicast(_wsr) => "multicast",
}
}
@@ -315,7 +315,10 @@ impl RelayPool {
if self.has(&url) {
return Ok(());
}
let relay = Relay::new(url, wakeup)?;
let relay = Relay::new(
nostr::RelayUrl::parse(url).map_err(|_| Error::InvalidRelayUrl)?,
wakeup,
)?;
let pool_relay = PoolRelay::websocket(relay);
self.relays.push(pool_relay);