Skip to content

Commit

Permalink
chore: bump go-waku and drop legacy filter support (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-ramos committed Feb 19, 2024
1 parent 1ea96f8 commit 1e43cbb
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 175 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions waku-bindings/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "waku-bindings"
version = "0.5.0"
version = "0.6.0"
edition = "2021"
authors = [
"Daniel Sanchez Quiros <danielsq@status.im>"
Expand All @@ -26,7 +26,7 @@ serde_json = "1.0"
sscanf = "0.4"
smart-default = "0.6"
url = "2.3"
waku-sys = { version = "0.5.0", path = "../waku-sys" }
waku-sys = { version = "0.6.0", path = "../waku-sys" }
libc = "0.2"
serde-aux = "4.3.1"

Expand Down
47 changes: 0 additions & 47 deletions waku-bindings/src/general/mod.rs
Expand Up @@ -199,53 +199,6 @@ impl DecodedPayload {
}
}

/// The content topic of a Waku message
/// as per the [specification](https://rfc.vac.dev/spec/36/#contentfilter-type)
#[derive(Clone, Serialize, Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct LegacyContentFilter {
/// The content topic of a Waku message
content_topic: WakuContentTopic,
}

impl LegacyContentFilter {
pub fn new(content_topic: WakuContentTopic) -> Self {
Self { content_topic }
}

pub fn content_topic(&self) -> &WakuContentTopic {
&self.content_topic
}
}

/// The criteria to create subscription to a light node in JSON Format
/// as per the [specification](https://rfc.vac.dev/spec/36/#filtersubscription-type)
#[derive(Clone, Serialize, Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct LegacyFilterSubscription {
/// Array of [`ContentFilter`] being subscribed to / unsubscribed from
content_filters: Vec<ContentFilter>,
/// Optional pubsub topic
pubsub_topic: Option<WakuPubSubTopic>,
}

impl LegacyFilterSubscription {
pub fn new(content_filters: Vec<ContentFilter>, pubsub_topic: Option<WakuPubSubTopic>) -> Self {
Self {
content_filters,
pubsub_topic,
}
}

pub fn content_filters(&self) -> &[ContentFilter] {
&self.content_filters
}

pub fn pubsub_topic(&self) -> Option<&WakuPubSubTopic> {
self.pubsub_topic.as_ref()
}
}

/// The criteria to create subscription to a filter full node matching a content filter.
#[derive(Clone, Serialize, Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
Expand Down
5 changes: 2 additions & 3 deletions waku-bindings/src/lib.rs
Expand Up @@ -17,9 +17,8 @@ pub use node::{

pub use general::{
ContentFilter, DecodedPayload, Encoding, FilterSubscriptionDetail, FilterSubscriptionResult,
LegacyContentFilter, LegacyFilterSubscription, MessageId, MessageIndex, PagingOptions, PeerId,
ProtocolId, Result, StoreQuery, StoreResponse, WakuContentTopic, WakuMessage,
WakuMessageVersion, WakuPubSubTopic,
MessageId, MessageIndex, PagingOptions, PeerId, ProtocolId, Result, StoreQuery, StoreResponse,
WakuContentTopic, WakuMessage, WakuMessageVersion, WakuPubSubTopic,
};

pub use events::{waku_set_event_callback, Event, Signal, WakuMessageEvent};
4 changes: 0 additions & 4 deletions waku-bindings/src/node/config.rs
Expand Up @@ -50,10 +50,6 @@ pub struct WakuNodeConfig {
/// The minimum number of peers required on a topic to allow broadcasting a message. Default `0`
#[default(Some(0))]
pub min_peers_to_publish: Option<usize>,
/// Enable filter protocol. Default `false`
#[default(Some(false))]
#[serde(rename = "legacyFilter")]
pub filter: Option<bool>,
/// Set the log level. Default `INFO`. Allowed values "DEBUG", "INFO", "WARN", "ERROR", "DPANIC", "PANIC", "FATAL"
#[default(Some(WakuLogLevel::Info))]
pub log_level: Option<WakuLogLevel>,
Expand Down
89 changes: 0 additions & 89 deletions waku-bindings/src/node/legacyfilter.rs

This file was deleted.

28 changes: 2 additions & 26 deletions waku-bindings/src/node/mod.rs
Expand Up @@ -3,7 +3,6 @@
mod config;
mod discovery;
mod filter;
mod legacyfilter;
mod lightpush;
mod management;
mod peers;
Expand All @@ -21,8 +20,8 @@ use std::time::Duration;
// internal

use crate::general::{
ContentFilter, FilterSubscriptionResult, LegacyFilterSubscription, MessageId, PeerId,
ProtocolId, Result, StoreQuery, StoreResponse, WakuMessage, WakuPubSubTopic,
ContentFilter, FilterSubscriptionResult, MessageId, PeerId, ProtocolId, Result, StoreQuery,
StoreResponse, WakuMessage, WakuPubSubTopic,
};

pub use config::{GossipSubParams, WakuLogLevel, WakuNodeConfig, WebsocketParams};
Expand Down Expand Up @@ -214,29 +213,6 @@ impl WakuNodeHandle<Running> {
lightpush::waku_lightpush_publish(message, pubsub_topic, peer_id, timeout)
}

/// Creates a subscription in a lightnode for messages that matches a content filter and optionally a [`WakuPubSubTopic`](`crate::general::WakuPubSubTopic`)
/// As per the [specification](https://rfc.vac.dev/spec/36/#extern-char-waku_filter_subscribechar-filterjson-char-peerid-int-timeoutms)
#[deprecated]
pub fn legacy_filter_subscribe(
&self,
filter_subscription: &LegacyFilterSubscription,
peer_id: PeerId,
timeout: Duration,
) -> Result<()> {
legacyfilter::waku_legacy_filter_subscribe(filter_subscription, peer_id, timeout)
}

/// Removes subscriptions in a light node matching a content filter and, optionally, a [`WakuPubSubTopic`](`crate::general::WakuPubSubTopic`)
/// As per the [specification](https://rfc.vac.dev/spec/36/#extern-char-waku_filter_unsubscribechar-filterjson-int-timeoutms)
#[deprecated]
pub fn legacy_filter_unsubscribe(
&self,
filter_subscription: &LegacyFilterSubscription,
timeout: Duration,
) -> Result<()> {
legacyfilter::waku_legacy_filter_unsubscribe(filter_subscription, timeout)
}

/// Creates a subscription to a filter full node matching a content filter.
/// Returns the PeerId on which the filter subscription was created
pub fn filter_subscribe(
Expand Down
2 changes: 1 addition & 1 deletion waku-sys/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "waku-sys"
version = "0.5.0"
version = "0.6.0"
edition = "2021"
authors = [
"Daniel Sanchez Quiros <danielsq@status.im>"
Expand Down
2 changes: 1 addition & 1 deletion waku-sys/vendor

0 comments on commit 1e43cbb

Please sign in to comment.