Skip to content

Commit

Permalink
Merge pull request #23 from JMTamayo/main
Browse files Browse the repository at this point in the history
Feature v0.5.1
  • Loading branch information
JMTamayo authored Nov 27, 2024
2 parents 58df379 + 52bcd60 commit 98bad8e
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 54 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: "Setup: Install Rust"
uses: actions-rust-lang/[email protected]
with:
Expand All @@ -21,22 +24,19 @@ jobs:
with:
tool: cargo-llvm-cov

- name: Checkout
uses: actions/checkout@v3

- 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
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 }}
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
17 changes: 7 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
cargo doc --workspace --all-features --open
18 changes: 2 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# redsumer-rs
# REDSUMER

<div align="left">
<img src="https://img.shields.io/github/license/enerBit/redsumer-rs">
Expand All @@ -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:
Expand Down Expand Up @@ -170,7 +156,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);
// ...
Expand Down
13 changes: 13 additions & 0 deletions redsumer-rs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ 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).
- ⚡ 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]

### Added:
Expand Down
4 changes: 2 additions & 2 deletions redsumer-rs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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]
Expand Down
16 changes: 1 addition & 15 deletions redsumer-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -154,7 +140,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);
//! // ...
Expand Down
8 changes: 7 additions & 1 deletion redsumer-rs/src/redsumer/consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 98bad8e

Please sign in to comment.