From c66fe253f86f88086d9aa9586defc49c5cf13d74 Mon Sep 17 00:00:00 2001 From: JMTamayo Date: Sat, 16 Nov 2024 08:37:40 -0500 Subject: [PATCH 1/8] Implement function belongs_to_me instead function is_still_mine. Function is_still_mine was deprecated --- README.md | 2 +- redsumer-rs/CHANGELOG.md | 6 ++++++ redsumer-rs/src/lib.rs | 2 +- redsumer-rs/src/redsumer/consumer.rs | 8 +++++++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 657d0ad..0a50913 100644 --- a/README.md +++ b/README.md @@ -170,7 +170,7 @@ async fn main() { panic!( "Error checking if message is still in consumer pending list: {:?}", error ); - }).is_still_mine() { + }).belongs_to_me() { // Process message ... println!("Processing message: {:?}", message); // ... diff --git a/redsumer-rs/CHANGELOG.md b/redsumer-rs/CHANGELOG.md index c731c35..2bc4d78 100644 --- a/redsumer-rs/CHANGELOG.md +++ b/redsumer-rs/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Added: + +- ⚡ Implement `belongs_to_me()` in `IsStillMineReply` to verify if the message is still in consumer pending list. Function `is_still_mine()` was deprecated. By [@JMTamayo](https://github.com/JMTamayo). + ## ✨ v0.5.0 [2024-10-26] ### Added: diff --git a/redsumer-rs/src/lib.rs b/redsumer-rs/src/lib.rs index b9a37f3..2308855 100644 --- a/redsumer-rs/src/lib.rs +++ b/redsumer-rs/src/lib.rs @@ -154,7 +154,7 @@ //! panic!( //! "Error checking if message is still in consumer pending list: {:?}", error //! ); -//! }).is_still_mine() { +//! }).belongs_to_me() { //! // Process message ... //! println!("Processing message: {:?}", message); //! // ... diff --git a/redsumer-rs/src/redsumer/consumer.rs b/redsumer-rs/src/redsumer/consumer.rs index ff6429b..004219c 100644 --- a/redsumer-rs/src/redsumer/consumer.rs +++ b/redsumer-rs/src/redsumer/consumer.rs @@ -312,7 +312,13 @@ pub struct IsStillMineReply { impl IsStillMineReply { /// Get **is still mine**. + #[deprecated(note = "Please use the `belongs_to_me` function instead")] pub fn is_still_mine(&self) -> bool { + self.belongs_to_me() + } + + /// Verify if the message still belongs to the consumer. + pub fn belongs_to_me(&self) -> bool { self.is_still_mine } @@ -793,7 +799,7 @@ mod test_is_still_mine_reply { )); // Verify the result: - assert!(reply.is_still_mine()); + assert!(reply.belongs_to_me()); assert!(reply.get_last_delivered_milliseconds().is_some()); assert!(reply From 0ddcee1debd1a85c25bdb9e2f67715bd35b44dd8 Mon Sep 17 00:00:00 2001 From: JMTamayo Date: Sat, 16 Nov 2024 08:50:44 -0500 Subject: [PATCH 2/8] Unify the Unit Testing and Coverage Steps in CI pipeline --- .github/workflows/CI.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 500cf18..488e618 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -34,9 +34,6 @@ jobs: run: cargo clippy --package redsumer --all-features --verbose - name: Unit Tests - run: cargo test --package redsumer --verbose - - - name: Coverage env: MIN_LINE_COVERAGE_TARGET: 80 run: cargo llvm-cov --package redsumer --all-features --summary-only --fail-under-lines ${{ env.MIN_LINE_COVERAGE_TARGET }} From ff28f49b2c59a4a069ae1cc294230252dbeb423b Mon Sep 17 00:00:00 2001 From: JMTamayo Date: Sat, 16 Nov 2024 08:56:46 -0500 Subject: [PATCH 3/8] Make the Checkout step the first step in the pipeline to ensure that the code is available prior to the execution of the CI flow --- .github/workflows/CI.yml | 6 +++--- redsumer-rs/CHANGELOG.md | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 488e618..7643a63 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -11,6 +11,9 @@ jobs: runs-on: ubuntu-latest steps: + - name: Checkout + uses: actions/checkout@v3 + - name: "Setup: Install Rust" uses: actions-rust-lang/setup-rust-toolchain@v1.8.0 with: @@ -21,9 +24,6 @@ jobs: with: tool: cargo-llvm-cov - - name: Checkout - uses: actions/checkout@v3 - - name: Build run: cargo build --verbose diff --git a/redsumer-rs/CHANGELOG.md b/redsumer-rs/CHANGELOG.md index 2bc4d78..494e35e 100644 --- a/redsumer-rs/CHANGELOG.md +++ b/redsumer-rs/CHANGELOG.md @@ -11,6 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - ⚡ Implement `belongs_to_me()` in `IsStillMineReply` to verify if the message is still in consumer pending list. Function `is_still_mine()` was deprecated. By [@JMTamayo](https://github.com/JMTamayo). +### Changed: + +- 🚀 Unify *Unit Tests* and *Coverage* steps in CI pipeline. By [@JMTamayo](https://github.com/JMTamayo). +- 🚀 Making the *Checkout* step the first step in the pipeline to ensure that the code is available prior to the execution of the CI flow. By [@JMTamayo](https://github.com/JMTamayo). + ## ✨ v0.5.0 [2024-10-26] ### Added: From da1b644bcd3bce72ff176edc2b71d295c0045593 Mon Sep 17 00:00:00 2001 From: JMTamayo Date: Sat, 16 Nov 2024 09:00:33 -0500 Subject: [PATCH 4/8] Remove blank lines in line 15 --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7643a63..b44b977 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -13,7 +13,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - + - name: "Setup: Install Rust" uses: actions-rust-lang/setup-rust-toolchain@v1.8.0 with: From 4a8db930fb912e39d8ec5c797f74869ee2b4fee9 Mon Sep 17 00:00:00 2001 From: JMTamayo Date: Sat, 16 Nov 2024 11:04:19 -0500 Subject: [PATCH 5/8] Update CI pipeline: Apply steps to workspace. Include doc tests in CI --- .github/workflows/CI.yml | 11 +++++++---- Makefile | 17 +++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index b44b977..605aa00 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -25,15 +25,18 @@ jobs: tool: cargo-llvm-cov - name: Build - run: cargo build --verbose + run: cargo build --workspace --all-features - name: Format - run: cargo fmt --package redsumer --all --check + run: cargo fmt --all --check - name: Lints - run: cargo clippy --package redsumer --all-features --verbose + run: cargo clippy --workspace --all-features - name: Unit Tests env: MIN_LINE_COVERAGE_TARGET: 80 - run: cargo llvm-cov --package redsumer --all-features --summary-only --fail-under-lines ${{ env.MIN_LINE_COVERAGE_TARGET }} + run: cargo llvm-cov --workspace --all-features --show-missing-lines --summary-only --fail-under-lines ${{ env.MIN_LINE_COVERAGE_TARGET }} + + - name: Doc Tests + run: cargo test --workspace --all-features --doc diff --git a/Makefile b/Makefile index 89b2534..a1c4de1 100644 --- a/Makefile +++ b/Makefile @@ -5,25 +5,22 @@ fmt-check: cargo fmt --all --check check: - cargo check --all-features + cargo check --workspace --all-features clippy-check: - cargo clippy --all-features + cargo clippy --workspace --all-features install-llvm-cov: cargo install cargo-llvm-cov test-llvm-cov-report: - cargo llvm-cov --html --workspace --all-features + cargo llvm-cov --workspace --all-features --show-missing-lines --open test-llvm-cov-target: - cargo llvm-cov --workspace --all-features --summary-only --fail-under-lines 70 + cargo llvm-cov --workspace --all-features --show-missing-lines --summary-only --fail-under-lines 80 -test: - cargo test --all-features +test-doc: + cargo test --workspace --all-features --doc doc: - cargo doc --all-features - -doc-open: - cargo doc --all-features --open \ No newline at end of file + cargo doc --workspace --all-features --open \ No newline at end of file From 3a14b83232176ad6f3eccc75f13827f536b93357 Mon Sep 17 00:00:00 2001 From: JMTamayo Date: Sat, 16 Nov 2024 11:11:36 -0500 Subject: [PATCH 6/8] Update CHANGELOG.md --- redsumer-rs/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/redsumer-rs/CHANGELOG.md b/redsumer-rs/CHANGELOG.md index 494e35e..8e2efea 100644 --- a/redsumer-rs/CHANGELOG.md +++ b/redsumer-rs/CHANGELOG.md @@ -10,11 +10,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added: - ⚡ Implement `belongs_to_me()` in `IsStillMineReply` to verify if the message is still in consumer pending list. Function `is_still_mine()` was deprecated. By [@JMTamayo](https://github.com/JMTamayo). +- ⚡ Implement *Doc Tests* in CI pipeline. By [@JMTamayo](https://github.com/JMTamayo). ### Changed: - 🚀 Unify *Unit Tests* and *Coverage* steps in CI pipeline. By [@JMTamayo](https://github.com/JMTamayo). - 🚀 Making the *Checkout* step the first step in the pipeline to ensure that the code is available prior to the execution of the CI flow. By [@JMTamayo](https://github.com/JMTamayo). +- 🚀 Apply all steps for workspace in CI pipeline. By [@JMTamayo](https://github.com/JMTamayo). ## ✨ v0.5.0 [2024-10-26] From 31d4a5f1c3797875613bacb077b1a334ff11ff8a Mon Sep 17 00:00:00 2001 From: JMTamayo Date: Sat, 16 Nov 2024 11:19:37 -0500 Subject: [PATCH 7/8] Remove installation info from doc: This information is given by crates.io --- README.md | 16 +--------------- redsumer-rs/src/lib.rs | 14 -------------- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/README.md b/README.md index 0a50913..db30b38 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# redsumer-rs +# REDSUMER
@@ -21,20 +21,6 @@ A lightweight implementation of Redis Streams for Rust, allowing you to manage s - **Produce** new messages in a specific *stream*. - **Consume** messages from specific *stream*, setting config parameters that allow you a flexible implementation. It also provides an option to minimize the possibility of consuming the same message simultaneously by more than one consumers from the same consumer group. -To use ***redsumer*** from GitHub repository with specific version, set the dependency in Cargo.toml file as follows: - -```ini -[dependencies] -redsumer = { git = "https://github.com/enerBit/redsumer-rs.git", package = "redsumer", version = "0.5.0" } -``` - -You can depend on it via cargo by adding the following dependency to your `Cargo.toml` file: - -```ini -[dependencies] -redsumer = { version = "0.5.0" } -``` - ## Basic Usage #### Produce a new stream message: diff --git a/redsumer-rs/src/lib.rs b/redsumer-rs/src/lib.rs index 2308855..67f73ce 100644 --- a/redsumer-rs/src/lib.rs +++ b/redsumer-rs/src/lib.rs @@ -3,20 +3,6 @@ //! - **Produce** new messages in a specific *stream*. //! - **Consume** messages from specific *stream*, setting config parameters that allow you a flexible implementation. It also provides an option to minimize the possibility of consuming the same message simultaneously by more than one consumers from the same consumer group. //! -//! To use ***redsumer*** from GitHub repository with specific version, set the dependency in Cargo.toml file as follows: -//! -//! ```ini -//! [dependencies] -//! redsumer = { git = "https://github.com/enerBit/redsumer-rs.git", package = "redsumer", version = "0.5.0" } -//! ``` -//! -//! You can depend on it via cargo by adding the following dependency to your `Cargo.toml` file: -//! -//! ```ini -//! [dependencies] -//! redsumer = { version = "0.5.0" } -//! ``` -//! //! ## Basic Usage //! //! #### Produce a new stream message: From 6e9b4eb1c59ec7615f89d02da3706f7e21132e01 Mon Sep 17 00:00:00 2001 From: JMTamayo Date: Sat, 16 Nov 2024 11:20:21 -0500 Subject: [PATCH 8/8] Update version in Cargo.toml: v0.5.0 to v0.5.1 --- redsumer-rs/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/redsumer-rs/Cargo.toml b/redsumer-rs/Cargo.toml index ea1708e..15a57d5 100644 --- a/redsumer-rs/Cargo.toml +++ b/redsumer-rs/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "redsumer" description = "Lightweight implementation of Redis Streams for Rust" -version = "0.5.0" +version = "0.5.1" edition = "2021" license-file = "../LICENSE" readme = "../README.md" @@ -20,7 +20,7 @@ authors = [ ] [dependencies] -redis = { version = ">=0.27.2", features = ["tokio-comp", "streams"] } +redis = { version = ">=0.27.2", features = ["streams"] } tracing = { version = ">=0.1.40" } [dev-dependencies]