From e14ab3ee1257e363e1fbb0160ed6702ea98af012 Mon Sep 17 00:00:00 2001 From: Casper Beyer Date: Mon, 5 Dec 2022 21:11:20 -0600 Subject: [PATCH 1/2] Deprecate `Stream::purge_filter` --- async-nats/src/jetstream/stream.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/async-nats/src/jetstream/stream.rs b/async-nats/src/jetstream/stream.rs index 8d6fe9ab8..6109679d2 100644 --- a/async-nats/src/jetstream/stream.rs +++ b/async-nats/src/jetstream/stream.rs @@ -537,6 +537,10 @@ impl Stream { /// # Ok(()) /// # } /// ``` + #[deprecated( + since = "0.25.0", + note = "Overloads have been replaced with an into_future based builder. Use Stream::purge().filter(subject) instead." + )] pub async fn purge_subject(&self, subject: T) -> Result where T: Into, From 987407dede4dfd1ddd9b89e34c704ac4c332fc13 Mon Sep 17 00:00:00 2001 From: Casper Beyer Date: Mon, 19 Dec 2022 09:03:09 +0100 Subject: [PATCH 2/2] Migrate away from deprecated purge_subject --- async-nats/src/jetstream/object_store/mod.rs | 4 ++-- async-nats/tests/jetstream_tests.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/async-nats/src/jetstream/object_store/mod.rs b/async-nats/src/jetstream/object_store/mod.rs index b056a12b7..b5120e84e 100644 --- a/async-nats/src/jetstream/object_store/mod.rs +++ b/async-nats/src/jetstream/object_store/mod.rs @@ -169,7 +169,7 @@ impl ObjectStore { let chunk_subject = format!("$O.{}.C.{}", self.name, object_info.nuid); - self.stream.purge_subject(&chunk_subject).await?; + self.stream.purge().filter(&chunk_subject).await?; Ok(()) } @@ -313,7 +313,7 @@ impl ObjectStore { if let Some(existing_object_info) = maybe_existing_object_info { let chunk_subject = format!("$O.{}.C.{}", &self.name, &existing_object_info.nuid); - self.stream.purge_subject(&chunk_subject).await?; + self.stream.purge().filter(&chunk_subject).await?; } Ok(object_info) diff --git a/async-nats/tests/jetstream_tests.rs b/async-nats/tests/jetstream_tests.rs index 9018d138f..babd5a525 100644 --- a/async-nats/tests/jetstream_tests.rs +++ b/async-nats/tests/jetstream_tests.rs @@ -437,7 +437,7 @@ mod jetstream { } #[tokio::test] - async fn purge_stream_subject() { + async fn purge_filter() { let server = nats_server::run_server("tests/configs/jetstream.conf"); let client = async_nats::connect(server.client_url()).await.unwrap(); let context = async_nats::jetstream::new(client); @@ -466,7 +466,7 @@ mod jetstream { let mut stream = context.get_stream("events").await.unwrap(); assert_eq!(stream.cached_info().state.messages, 7); - stream.purge_subject("events.two").await.unwrap(); + stream.purge().filter("events.two").await.unwrap(); assert_eq!(stream.info().await.unwrap().state.messages, 3); }