diff --git a/CHANGELOG.md b/CHANGELOG.md index fde3628fb..c514dfc9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,7 @@ * pool: decrease `MAX_RETRY_INTERVAL` to 60 secs ([Yuki Kishimoto]) * pool: rework retry interval calculation ([Yuki Kishimoto]) * pool: improve shutdown docs ([dluvian]) +* pool: rename `FilterOptions` to `ReqExitPolicy` ([Yuki Kishimoto]) * sdk: refactor POW difficulty management ([Yuki Kishimoto]) * connect: require `fmt::Debug`, `Send` and `Sync` for `AuthUrlHandler` ([Yuki Kishimoto]) * zapper: bump `webln` to 0.4 ([Yuki Kishimoto]) @@ -114,6 +115,7 @@ ### Deprecated * pool: deprecated batch event methods ([Yuki Kishimoto]) +* pool: deprecate `FilterOptions` ([Yuki Kishimoto]) * sdk: deprecate `timeout` option ([Yuki Kishimoto]) * sdk: deprecate `Options::difficulty` and `Client::update_difficulty` ([Yuki Kishimoto]) diff --git a/bindings/nostr-sdk-ffi/src/relay/mod.rs b/bindings/nostr-sdk-ffi/src/relay/mod.rs index d497ab130..1c89cfd04 100644 --- a/bindings/nostr-sdk-ffi/src/relay/mod.rs +++ b/bindings/nostr-sdk-ffi/src/relay/mod.rs @@ -7,7 +7,7 @@ use std::ops::Deref; use std::sync::Arc; use std::time::Duration; -use nostr_sdk::{pool, FilterOptions, RelayUrl, SubscriptionId}; +use nostr_sdk::{pool, RelayUrl, SubscriptionId}; use uniffi::{Object, Record}; pub mod filtering; @@ -19,7 +19,7 @@ pub mod status; pub use self::filtering::{RelayFiltering, RelayFilteringMode}; pub use self::limits::RelayLimits; use self::options::SyncOptions; -pub use self::options::{ConnectionMode, RelayOptions, SubscribeOptions}; +pub use self::options::{ConnectionMode, RelayOptions, ReqExitPolicy, SubscribeOptions}; pub use self::stats::RelayConnectionStats; pub use self::status::RelayStatus; use crate::database::events::Events; @@ -299,6 +299,7 @@ impl Relay { &self, filters: Vec>, timeout: Duration, + policy: ReqExitPolicy, ) -> Result { let filters = filters .into_iter() @@ -306,7 +307,7 @@ impl Relay { .collect(); Ok(self .inner - .fetch_events(filters, timeout, FilterOptions::ExitOnEOSE) + .fetch_events(filters, timeout, policy.into()) .await? .into()) } diff --git a/bindings/nostr-sdk-ffi/src/relay/options.rs b/bindings/nostr-sdk-ffi/src/relay/options.rs index f5e8701dc..d6e1df1db 100644 --- a/bindings/nostr-sdk-ffi/src/relay/options.rs +++ b/bindings/nostr-sdk-ffi/src/relay/options.rs @@ -6,7 +6,7 @@ use std::ops::Deref; use std::path::PathBuf; use std::time::Duration; -use nostr_sdk::pool; +use nostr_sdk::{pool, prelude}; use uniffi::{Enum, Object}; use super::{RelayFilteringMode, RelayLimits}; @@ -159,23 +159,23 @@ impl RelayOptions { } } -/// Filter options +/// Request (REQ) exit policy #[derive(Enum)] -pub enum FilterOptions { +pub enum ReqExitPolicy { /// Exit on EOSE ExitOnEOSE, - /// After EOSE is received, keep listening for N more events that match the filter, then return + /// After EOSE is received, keep listening for N more events that match the filter. WaitForEventsAfterEOSE { num: u16 }, - /// After EOSE is received, keep listening for matching events for `Duration` more time, then return + /// After EOSE is received, keep listening for matching events for `Duration` more time. WaitDurationAfterEOSE { duration: Duration }, } -impl From for nostr_sdk::FilterOptions { - fn from(value: FilterOptions) -> Self { +impl From for prelude::ReqExitPolicy { + fn from(value: ReqExitPolicy) -> Self { match value { - FilterOptions::ExitOnEOSE => Self::ExitOnEOSE, - FilterOptions::WaitForEventsAfterEOSE { num } => Self::WaitForEventsAfterEOSE(num), - FilterOptions::WaitDurationAfterEOSE { duration } => { + ReqExitPolicy::ExitOnEOSE => Self::ExitOnEOSE, + ReqExitPolicy::WaitForEventsAfterEOSE { num } => Self::WaitForEventsAfterEOSE(num), + ReqExitPolicy::WaitDurationAfterEOSE { duration } => { Self::WaitDurationAfterEOSE(duration) } } @@ -205,10 +205,10 @@ impl SubscribeAutoCloseOptions { } } - /// Close subscription when `FilterOptions` is satisfied - pub fn filter(&self, filter: FilterOptions) -> Self { + /// Close subscription when the policy is satisfied + pub fn exit_policy(&self, policy: ReqExitPolicy) -> Self { let mut builder = self.clone(); - builder.inner = builder.inner.filter(filter.into()); + builder.inner = builder.inner.exit_policy(policy.into()); builder } diff --git a/bindings/nostr-sdk-js/src/relay/mod.rs b/bindings/nostr-sdk-js/src/relay/mod.rs index 2d5c78dec..567c38172 100644 --- a/bindings/nostr-sdk-js/src/relay/mod.rs +++ b/bindings/nostr-sdk-js/src/relay/mod.rs @@ -14,7 +14,7 @@ pub mod options; use self::filtering::JsRelayFiltering; use self::flags::JsAtomicRelayServiceFlags; -use self::options::{JsFilterOptions, JsRelayOptions, JsSubscribeOptions, JsSyncOptions}; +use self::options::{JsRelayOptions, JsReqExitPolicy, JsSubscribeOptions, JsSyncOptions}; use crate::database::JsEvents; use crate::duration::JsDuration; use crate::error::{into_err, Result}; @@ -250,12 +250,12 @@ impl JsRelay { &self, filters: Vec, timeout: &JsDuration, - opts: &JsFilterOptions, + policy: &JsReqExitPolicy, ) -> Result { let filters: Vec = filters.into_iter().map(|f| f.into()).collect(); Ok(self .inner - .fetch_events(filters, **timeout, **opts) + .fetch_events(filters, **timeout, **policy) .await .map_err(into_err)? .into()) diff --git a/bindings/nostr-sdk-js/src/relay/options.rs b/bindings/nostr-sdk-js/src/relay/options.rs index 76607a4d6..4069e2a8d 100644 --- a/bindings/nostr-sdk-js/src/relay/options.rs +++ b/bindings/nostr-sdk-js/src/relay/options.rs @@ -91,43 +91,43 @@ impl JsRelayOptions { } } -/// Filter options -#[wasm_bindgen(js_name = FilterOptions)] -pub struct JsFilterOptions { - inner: FilterOptions, +/// Request (REQ) exit policy +#[wasm_bindgen(js_name = ReqExitPolicy)] +pub struct JsReqExitPolicy { + inner: ReqExitPolicy, } -impl Deref for JsFilterOptions { - type Target = FilterOptions; +impl Deref for JsReqExitPolicy { + type Target = ReqExitPolicy; fn deref(&self) -> &Self::Target { &self.inner } } -#[wasm_bindgen(js_class = FilterOptions)] -impl JsFilterOptions { +#[wasm_bindgen(js_class = ReqExitPolicy)] +impl JsReqExitPolicy { /// Exit on EOSE #[wasm_bindgen(js_name = exitOnEose)] pub fn exit_on_eose() -> Self { Self { - inner: FilterOptions::ExitOnEOSE, + inner: ReqExitPolicy::ExitOnEOSE, } } - /// After EOSE is received, keep listening for N more events that match the filter, then return + /// After EOSE is received, keep listening for N more events that match the filter #[wasm_bindgen(js_name = waitForEventsAfterEOSE)] pub fn wait_for_events_after_eose(num: u16) -> Self { Self { - inner: FilterOptions::WaitForEventsAfterEOSE(num), + inner: ReqExitPolicy::WaitForEventsAfterEOSE(num), } } - /// After EOSE is received, keep listening for matching events for `Duration` more time, then return + /// After EOSE is received, keep listening for matching events for `Duration` more time #[wasm_bindgen(js_name = waitDurationAfterEOSE)] pub fn wait_duration_after_eose(duration: &JsDuration) -> Self { Self { - inner: FilterOptions::WaitDurationAfterEOSE(**duration), + inner: ReqExitPolicy::WaitDurationAfterEOSE(**duration), } } } @@ -161,9 +161,10 @@ impl JsSubscribeAutoCloseOptions { } } - /// Close subscription when `FilterOptions` is satisfied - pub fn filter(self, filter: JsFilterOptions) -> Self { - self.inner.filter(filter.inner).into() + /// Close subscription when the policy is satisfied + #[wasm_bindgen(js_name = exitPolicy)] + pub fn exit_policy(self, policy: JsReqExitPolicy) -> Self { + self.inner.exit_policy(policy.inner).into() } /// Automatically close subscription after `Duration` diff --git a/crates/nostr-relay-pool/src/lib.rs b/crates/nostr-relay-pool/src/lib.rs index e3d7c45b5..f97348fe7 100644 --- a/crates/nostr-relay-pool/src/lib.rs +++ b/crates/nostr-relay-pool/src/lib.rs @@ -26,8 +26,7 @@ pub use self::pool::{Output, RelayPool, RelayPoolNotification}; pub use self::relay::flags::{AtomicRelayServiceFlags, RelayServiceFlags}; pub use self::relay::limits::RelayLimits; pub use self::relay::options::{ - FilterOptions, RelayOptions, SubscribeAutoCloseOptions, SubscribeOptions, SyncDirection, - SyncOptions, + RelayOptions, SubscribeAutoCloseOptions, SubscribeOptions, SyncDirection, SyncOptions, }; pub use self::relay::stats::RelayConnectionStats; pub use self::relay::{ diff --git a/crates/nostr-relay-pool/src/pool/inner.rs b/crates/nostr-relay-pool/src/pool/inner.rs index 0874bc81d..bd5c4e6d0 100644 --- a/crates/nostr-relay-pool/src/pool/inner.rs +++ b/crates/nostr-relay-pool/src/pool/inner.rs @@ -19,7 +19,7 @@ use tokio::sync::{broadcast, mpsc, Mutex, RwLock, RwLockReadGuard}; use super::constants::MAX_CONNECTING_CHUNK; use super::options::RelayPoolOptions; use super::{Error, Output, RelayPoolNotification}; -use crate::relay::options::{FilterOptions, RelayOptions, SyncOptions}; +use crate::relay::options::{RelayOptions, ReqExitPolicy, SyncOptions}; use crate::relay::{FlagCheck, Reconciliation, Relay}; use crate::shared::SharedState; use crate::stream::ReceiverStream; @@ -762,10 +762,10 @@ impl InnerRelayPool { &self, filters: Vec, timeout: Duration, - opts: FilterOptions, + policy: ReqExitPolicy, ) -> Result { let urls: Vec = self.read_relay_urls().await; - self.fetch_events_from(urls, filters, timeout, opts).await + self.fetch_events_from(urls, filters, timeout, policy).await } pub async fn fetch_events_from( @@ -773,7 +773,7 @@ impl InnerRelayPool { urls: I, filters: Vec, timeout: Duration, - opts: FilterOptions, + policy: ReqExitPolicy, ) -> Result where I: IntoIterator, @@ -784,7 +784,7 @@ impl InnerRelayPool { // Stream events let mut stream = self - .stream_events_from(urls, filters, timeout, opts) + .stream_events_from(urls, filters, timeout, policy) .await?; while let Some(event) = stream.next().await { events.insert(event); @@ -798,10 +798,11 @@ impl InnerRelayPool { &self, filters: Vec, timeout: Duration, - opts: FilterOptions, + policy: ReqExitPolicy, ) -> Result, Error> { let urls: Vec = self.read_relay_urls().await; - self.stream_events_from(urls, filters, timeout, opts).await + self.stream_events_from(urls, filters, timeout, policy) + .await } #[inline] @@ -810,7 +811,7 @@ impl InnerRelayPool { urls: I, filters: Vec, timeout: Duration, - opts: FilterOptions, + policy: ReqExitPolicy, ) -> Result, Error> where I: IntoIterator, @@ -818,7 +819,7 @@ impl InnerRelayPool { Error: From<::Err>, { let targets = urls.into_iter().map(|u| (u, filters.clone())); - self.stream_events_targeted(targets, timeout, opts).await + self.stream_events_targeted(targets, timeout, policy).await } // TODO: change target type to `HashMap>`? @@ -826,7 +827,7 @@ impl InnerRelayPool { &self, targets: I, timeout: Duration, - opts: FilterOptions, + policy: ReqExitPolicy, ) -> Result, Error> where I: IntoIterator)>, @@ -882,7 +883,7 @@ impl InnerRelayPool { futures.push(relay.fetch_events_with_callback( filters, timeout, - opts, + policy, |event| async { let mut ids = ids.lock().await; if ids.insert(event.id) { diff --git a/crates/nostr-relay-pool/src/pool/mod.rs b/crates/nostr-relay-pool/src/pool/mod.rs index 9e75bcf83..f3df7a2df 100644 --- a/crates/nostr-relay-pool/src/pool/mod.rs +++ b/crates/nostr-relay-pool/src/pool/mod.rs @@ -24,7 +24,7 @@ use self::inner::InnerRelayPool; pub use self::options::RelayPoolOptions; pub use self::output::Output; use crate::relay::flags::FlagCheck; -use crate::relay::options::{FilterOptions, RelayOptions, SyncOptions}; +use crate::relay::options::{RelayOptions, ReqExitPolicy, SyncOptions}; use crate::relay::{Relay, RelayFiltering, RelayStatus}; use crate::shared::SharedState; use crate::stream::ReceiverStream; @@ -524,9 +524,9 @@ impl RelayPool { &self, filters: Vec, timeout: Duration, - opts: FilterOptions, + policy: ReqExitPolicy, ) -> Result { - self.inner.fetch_events(filters, timeout, opts).await + self.inner.fetch_events(filters, timeout, policy).await } /// Fetch events from specific relays @@ -536,7 +536,7 @@ impl RelayPool { urls: I, filters: Vec, timeout: Duration, - opts: FilterOptions, + policy: ReqExitPolicy, ) -> Result where I: IntoIterator, @@ -544,7 +544,7 @@ impl RelayPool { Error: From<::Err>, { self.inner - .fetch_events_from(urls, filters, timeout, opts) + .fetch_events_from(urls, filters, timeout, policy) .await } @@ -554,9 +554,9 @@ impl RelayPool { &self, filters: Vec, timeout: Duration, - opts: FilterOptions, + policy: ReqExitPolicy, ) -> Result, Error> { - self.inner.stream_events(filters, timeout, opts).await + self.inner.stream_events(filters, timeout, policy).await } /// Stream events from specific relays @@ -566,7 +566,7 @@ impl RelayPool { urls: I, filters: Vec, timeout: Duration, - opts: FilterOptions, + policy: ReqExitPolicy, ) -> Result, Error> where I: IntoIterator, @@ -574,7 +574,7 @@ impl RelayPool { Error: From<::Err>, { self.inner - .stream_events_from(urls, filters, timeout, opts) + .stream_events_from(urls, filters, timeout, policy) .await } @@ -586,7 +586,7 @@ impl RelayPool { &self, source: I, timeout: Duration, - opts: FilterOptions, + policy: ReqExitPolicy, ) -> Result, Error> where I: IntoIterator)>, @@ -594,7 +594,7 @@ impl RelayPool { Error: From<::Err>, { self.inner - .stream_events_targeted(source, timeout, opts) + .stream_events_targeted(source, timeout, policy) .await } diff --git a/crates/nostr-relay-pool/src/relay/inner.rs b/crates/nostr-relay-pool/src/relay/inner.rs index d4a9c8a17..9a07f9374 100644 --- a/crates/nostr-relay-pool/src/relay/inner.rs +++ b/crates/nostr-relay-pool/src/relay/inner.rs @@ -31,7 +31,7 @@ use super::constants::{ use super::filtering::CheckFiltering; use super::flags::AtomicRelayServiceFlags; use super::options::{ - FilterOptions, RelayOptions, SubscribeAutoCloseOptions, SubscribeOptions, SyncOptions, + RelayOptions, ReqExitPolicy, SubscribeAutoCloseOptions, SubscribeOptions, SyncOptions, }; use super::ping::PingTracker; use super::stats::RelayConnectionStats; @@ -1401,7 +1401,8 @@ impl InnerRelay { subscription_id, .. } => { if &subscription_id == id { - if let FilterOptions::WaitForEventsAfterEOSE(num) = opts.filter { + if let ReqExitPolicy::WaitForEventsAfterEOSE(num) = opts.exit_policy + { if received_eose { counter += 1; if counter >= num { @@ -1414,8 +1415,8 @@ impl InnerRelay { RelayMessage::EndOfStoredEvents(subscription_id) => { if &subscription_id == id { received_eose = true; - if let FilterOptions::ExitOnEOSE - | FilterOptions::WaitDurationAfterEOSE(_) = opts.filter + if let ReqExitPolicy::ExitOnEOSE + | ReqExitPolicy::WaitDurationAfterEOSE(_) = opts.exit_policy { break; } @@ -1476,7 +1477,7 @@ impl InnerRelay { } } - if let FilterOptions::WaitDurationAfterEOSE(duration) = opts.filter { + if let ReqExitPolicy::WaitDurationAfterEOSE(duration) = opts.exit_policy { time::timeout(Some(duration), async { while let Ok(notification) = notifications.recv().await { match notification { @@ -1524,7 +1525,7 @@ impl InnerRelay { &self, filters: Vec, timeout: Duration, - opts: FilterOptions, + policy: ReqExitPolicy, callback: impl Fn(Event) -> F, ) -> Result<(), Error> where @@ -1535,7 +1536,7 @@ impl InnerRelay { // Compose options let auto_close_opts: SubscribeAutoCloseOptions = SubscribeAutoCloseOptions::default() - .filter(opts) + .exit_policy(policy) .timeout(Some(timeout)); let subscribe_opts: SubscribeOptions = SubscribeOptions::default().close_on(Some(auto_close_opts)); @@ -1595,10 +1596,10 @@ impl InnerRelay { &self, filters: Vec, timeout: Duration, - opts: FilterOptions, + policy: ReqExitPolicy, ) -> Result { let events: Mutex = Mutex::new(Events::new(&filters)); - self.fetch_events_with_callback(filters, timeout, opts, |event| async { + self.fetch_events_with_callback(filters, timeout, policy, |event| async { let mut events = events.lock().await; events.insert(event); }) diff --git a/crates/nostr-relay-pool/src/relay/mod.rs b/crates/nostr-relay-pool/src/relay/mod.rs index 799e442db..28cd72dd5 100644 --- a/crates/nostr-relay-pool/src/relay/mod.rs +++ b/crates/nostr-relay-pool/src/relay/mod.rs @@ -15,8 +15,6 @@ use atomic_destructor::AtomicDestructor; use nostr_database::prelude::*; use tokio::sync::broadcast; -use crate::shared::SharedState; - pub mod constants; mod error; mod filtering; @@ -34,11 +32,12 @@ pub use self::flags::{AtomicRelayServiceFlags, FlagCheck, RelayServiceFlags}; use self::inner::InnerRelay; pub use self::limits::RelayLimits; pub use self::options::{ - FilterOptions, RelayOptions, SubscribeAutoCloseOptions, SubscribeOptions, SyncDirection, + RelayOptions, ReqExitPolicy, SubscribeAutoCloseOptions, SubscribeOptions, SyncDirection, SyncOptions, SyncProgress, }; pub use self::stats::RelayConnectionStats; pub use self::status::RelayStatus; +use crate::shared::SharedState; /// Subscription auto-closed reason #[derive(Debug, Clone, PartialEq, Eq)] @@ -350,14 +349,14 @@ impl Relay { &self, filters: Vec, timeout: Duration, - opts: FilterOptions, + policy: ReqExitPolicy, callback: impl Fn(Event) -> F, ) -> Result<(), Error> where F: Future, { self.inner - .fetch_events_with_callback(filters, timeout, opts, callback) + .fetch_events_with_callback(filters, timeout, policy, callback) .await } @@ -367,9 +366,9 @@ impl Relay { &self, filters: Vec, timeout: Duration, - opts: FilterOptions, + policy: ReqExitPolicy, ) -> Result { - self.inner.fetch_events(filters, timeout, opts).await + self.inner.fetch_events(filters, timeout, policy).await } /// Count events @@ -686,7 +685,7 @@ mod tests { .fetch_events( vec![filter.clone()], Duration::from_secs(5), - FilterOptions::ExitOnEOSE, + ReqExitPolicy::ExitOnEOSE, ) .await .unwrap_err(); @@ -708,7 +707,7 @@ mod tests { .fetch_events( vec![filter.clone()], Duration::from_secs(5), - FilterOptions::ExitOnEOSE, + ReqExitPolicy::ExitOnEOSE, ) .await .unwrap_err(); @@ -722,7 +721,7 @@ mod tests { .fetch_events( vec![filter], Duration::from_secs(5), - FilterOptions::ExitOnEOSE, + ReqExitPolicy::ExitOnEOSE, ) .await; assert!(res.is_ok()); diff --git a/crates/nostr-relay-pool/src/relay/options.rs b/crates/nostr-relay-pool/src/relay/options.rs index fd83292fb..af2fa1e08 100644 --- a/crates/nostr-relay-pool/src/relay/options.rs +++ b/crates/nostr-relay-pool/src/relay/options.rs @@ -154,14 +154,21 @@ impl RelayOptions { /// Auto-closing subscribe options #[derive(Debug, Clone, Copy, Default)] pub struct SubscribeAutoCloseOptions { - pub(super) filter: FilterOptions, + pub(super) exit_policy: ReqExitPolicy, pub(super) timeout: Option, } impl SubscribeAutoCloseOptions { - /// Close subscription when [FilterOptions] is satisfied - pub fn filter(mut self, filter: FilterOptions) -> Self { - self.filter = filter; + #[allow(deprecated)] + #[allow(missing_docs)] + #[deprecated(since = "0.38.0", note = "use `exit_policy` instead")] + pub fn filter(self, filter: FilterOptions) -> Self { + self.exit_policy(filter) + } + + /// Close subscription when [`ReqExitPolicy`] is satisfied + pub fn exit_policy(mut self, policy: ReqExitPolicy) -> Self { + self.exit_policy = policy; self } @@ -190,15 +197,19 @@ impl SubscribeOptions { } } -/// Filter options +#[allow(missing_docs)] +#[deprecated(since = "0.38.0", note = "use `ReqExitPolicy` instead")] +pub type FilterOptions = ReqExitPolicy; + +/// Request (REQ) exit policy #[derive(Debug, Clone, Copy, Default)] -pub enum FilterOptions { - /// Exit on EOSE +pub enum ReqExitPolicy { + /// Exit on EOSE. #[default] ExitOnEOSE, - /// After EOSE is received, keep listening for N more events that match the filter, then return + /// After EOSE is received, keep listening for N more events that match the filter. WaitForEventsAfterEOSE(u16), - /// After EOSE is received, keep listening for matching events for [`Duration`] more time, then return + /// After EOSE is received, keep listening for matching events for [`Duration`] more time. WaitDurationAfterEOSE(Duration), } diff --git a/crates/nostr-sdk/src/client/mod.rs b/crates/nostr-sdk/src/client/mod.rs index 44a4c2b86..2b42f7221 100644 --- a/crates/nostr-sdk/src/client/mod.rs +++ b/crates/nostr-sdk/src/client/mod.rs @@ -579,7 +579,7 @@ impl Client { /// // Auto-closing subscription /// let id = SubscriptionId::generate(); /// let subscription = Filter::new().kind(Kind::TextNote).limit(10); - /// let opts = SubscribeAutoCloseOptions::default().filter(FilterOptions::ExitOnEOSE); + /// let opts = SubscribeAutoCloseOptions::default().exit_policy(ReqExitPolicy::ExitOnEOSE); /// let output = client.subscribe(vec![subscription], Some(opts)).await?; /// println!("Subscription ID: {} [auto-closing]", output.val); /// # Ok(()) @@ -773,7 +773,7 @@ impl Client { Ok(self .pool - .fetch_events(filters, timeout, FilterOptions::ExitOnEOSE) + .fetch_events(filters, timeout, ReqExitPolicy::default()) .await?) } @@ -792,7 +792,7 @@ impl Client { { Ok(self .pool - .fetch_events_from(urls, filters, timeout, FilterOptions::ExitOnEOSE) + .fetch_events_from(urls, filters, timeout, ReqExitPolicy::default()) .await?) } @@ -864,7 +864,7 @@ impl Client { } else { Ok(self .pool - .stream_events(filters, timeout, FilterOptions::ExitOnEOSE) + .stream_events(filters, timeout, ReqExitPolicy::default()) .await?) } } @@ -884,7 +884,7 @@ impl Client { { Ok(self .pool - .stream_events_from(urls, filters, timeout, FilterOptions::ExitOnEOSE) + .stream_events_from(urls, filters, timeout, ReqExitPolicy::default()) .await?) } @@ -903,7 +903,7 @@ impl Client { { Ok(self .pool - .stream_events_targeted(source, timeout, FilterOptions::ExitOnEOSE) + .stream_events_targeted(source, timeout, ReqExitPolicy::default()) .await?) } @@ -1771,7 +1771,7 @@ impl Client { // Stream events let stream: ReceiverStream = self .pool - .stream_events_targeted(filters, timeout, FilterOptions::ExitOnEOSE) + .stream_events_targeted(filters, timeout, ReqExitPolicy::default()) .await?; Ok(stream) diff --git a/crates/nostr-sdk/src/lib.rs b/crates/nostr-sdk/src/lib.rs index 9a2a767a6..cc5d0d859 100644 --- a/crates/nostr-sdk/src/lib.rs +++ b/crates/nostr-sdk/src/lib.rs @@ -29,9 +29,9 @@ pub use nostr_lmdb::NostrLMDB; pub use nostr_ndb::{self as ndb, NdbDatabase}; #[doc(hidden)] pub use nostr_relay_pool::{ - self as pool, AtomicRelayServiceFlags, FilterOptions, Relay, RelayConnectionStats, - RelayOptions, RelayPool, RelayPoolNotification, RelayPoolOptions, RelayServiceFlags, - RelayStatus, SubscribeAutoCloseOptions, SubscribeOptions, SyncDirection, SyncOptions, + self as pool, AtomicRelayServiceFlags, Relay, RelayConnectionStats, RelayOptions, RelayPool, + RelayPoolNotification, RelayPoolOptions, RelayServiceFlags, RelayStatus, + SubscribeAutoCloseOptions, SubscribeOptions, SyncDirection, SyncOptions, }; #[doc(hidden)] #[cfg(feature = "nip57")]