Skip to content

Commit

Permalink
Merge pull request #27 from JMTamayo/main
Browse files Browse the repository at this point in the history
Upgrade Redis dependency to version >=0.28.0. Remove Makefile and connection.rs module
  • Loading branch information
JMTamayo authored Jan 28, 2025
2 parents 783e3f5 + 10a3164 commit f34f088
Show file tree
Hide file tree
Showing 8 changed files with 131 additions and 100 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ name: CI

on:
push:
branches: ["main"]
branches:
- "main"
pull_request:
branches: ["main"]
branches:
- "main"
schedule:
- cron: "0 5 * * 0"

Expand All @@ -15,7 +17,7 @@ env:

jobs:
Project-Config:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Fetch Repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -47,7 +49,7 @@ jobs:
run: taplo fmt --check --verbose --diff

Docs:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: Project-Config
steps:
- name: Fetch Repository
Expand All @@ -63,7 +65,7 @@ jobs:
run: cargo test --workspace --all-features --doc

Build:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: Project-Config
steps:
- name: Fetch Repository
Expand All @@ -84,7 +86,7 @@ jobs:
run: cargo build --workspace --all-features

Tests:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: Build
steps:
- name: Fetch Repository
Expand All @@ -99,7 +101,7 @@ jobs:
run: cargo llvm-cov nextest --workspace --all-features --show-missing-lines --summary-only --fail-under-lines ${{ env.MIN_LINE_COVERAGE_TARGET }}

Security:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: Build
steps:
- name: Fetch Repository
Expand Down
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,20 @@ 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).

## ✨ v0.5.2 [*Pending*]
## ✨ v0.5.3 [*Pending*]

### Changed:

- 🚀 Update Redis version to be greater than or equal to 0.28.0. By [@JMTamayo](https://github.com/JMTamayo).
- 🚀 Update development dependencies to the latest version. By [@JMTamayo](https://github.com/JMTamayo).
- 🚀 Include useful commands in README.md for the development process. By [@JMTamayo](https://github.com/JMTamayo).

### Removed:

- ❌ Remove unnecessary module connection.rs. By [@JMTamayo](https://github.com/JMTamayo).
- ❌ Remove Makefile. By [@JMTamayo](https://github.com/JMTamayo).

## ✨ v0.5.2 [2024-12-05]

### Added:

Expand Down
100 changes: 98 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ 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.

## Basic Usage
## BASIC OPERATION

#### Produce a new stream message:

Expand Down Expand Up @@ -191,7 +191,103 @@ The **redis** module provides utilities from the **redis** crate. You can use th

The **Value** enum represents a Redis value. It can be converted to a specific type using the **from_redis_value** function. This function can be imported from the **redis** module.

## Contributing
## DEVELOPMENT
To try **redsumer**, follow these recommendations:

#### Install required tools:
Install the following tools required for the development process.

##### [Cargo LLVM cov](https://github.com/taiki-e/cargo-llvm-cov/blob/main/README.md):
```bash
cargo install cargo-llvm-cov
```

##### [Cargo Nextest](https://nexte.std):
```bash
cargo install cargo-nextest
```

##### [Cargo Deny](https://embarkstudios.github.io/cargo-deny/):
```bash
cargo install cargo-deny
```

##### [Taplo Client](https://taplo.tamasfe.dev):
```bash
cargo install taplo-cli
```

##### [Yamlfmt](https://github.com/google/yamlfmt/blob/main/README.md):
```bash
go install github.com/google/yamlfmt/cmd/yamlfmt@latest
```

#### To format the code:
```bash
cargo fmt --all
```

#### To verify the code format:
```bash
cargo fmt --all --check
```

#### To verify lints:
```bash
cargo clippy --workspace --all-features
```

#### To check the project:
```bash
cargo check --workspace --all-features
```

#### To format TOML files:
```bash
taplo fmt
```

#### To verify the TOML files format:
```bash
taplo fmt --check --verbose --diff
```

#### To check correctness of crate manifest:
```bash
cargo verify-project --verbose
```

#### To format yaml files:
```bash
yamlfmt .
```

#### To verify the yaml files format:
```bash
yamlfmt --lint .
```

#### To generate the documentation:
```bash
cargo doc --workspace --all-features --document-private-items --verbose --open
```

#### To run doc tests:
```bash
cargo test --workspace --all-features --doc
```

#### To test using llvm-cov:
```bash
cargo llvm-cov nextest --workspace --all-features --show-missing-lines --open
```

### Security analysis:
```bash
cargo deny --log-level debug check
```

## CONTRIBUTING

We welcome contributions to **redsumer**. Here are some ways you can contribute:

Expand Down
12 changes: 6 additions & 6 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.2"
version = "0.5.3"
edition = "2021"
license-file = "../LICENSE"
readme = "../README.md"
Expand All @@ -13,11 +13,11 @@ categories = ["database-implementations"]
authors = ["Juan Manuel Tamayo <[email protected]>"]

[dependencies]
redis = { version = ">=0.27.2", features = ["streams"] }
redis = { version = ">=0.28.0", features = ["streams"] }
tracing = { version = ">=0.1.40" }

[dev-dependencies]
redis-test = { version = "0.6.0" }
tokio = { version = "1.41.1", features = ["full"] }
time = { version = "0.3.36" }
uuid = { version = "1.11.0", features = ["v4"] }
redis-test = { version = "0.8.0" }
tokio = { version = "1.43.0", features = ["full"] }
time = { version = "0.3.37" }
uuid = { version = "1.12.1", features = ["v4"] }
77 changes: 0 additions & 77 deletions redsumer-rs/src/core/connection.rs

This file was deleted.

1 change: 0 additions & 1 deletion redsumer-rs/src/core/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pub mod client;
pub mod connection;
pub mod result;
pub mod streams;
5 changes: 2 additions & 3 deletions redsumer-rs/src/redsumer/consumer.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use redis::{streams::StreamId, Client};
use redis::{streams::StreamId, Client, Commands};
use tracing::{debug, info};

use crate::core::streams::types::{LatestPendingMessageId, NextIdToClaim};
#[allow(unused_imports)]
use crate::core::{
client::{ClientArgs, RedisClientBuilder},
connection::VerifyConnection,
result::{RedsumerError, RedsumerResult},
streams::{
consumer::{ConsumerCommands, BEGINNING_OF_TIME_ID},
Expand Down Expand Up @@ -437,7 +436,7 @@ impl Consumer {
);

let mut client: Client = args.build()?;
client.ping()?;
client.ping::<String>()?;

client.verify_if_stream_exists(config.get_stream_name())?;
client.create_consumer_group(
Expand Down
5 changes: 2 additions & 3 deletions redsumer-rs/src/redsumer/producer.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use redis::{Client, ToRedisArgs};
use redis::{Client, Commands, ToRedisArgs};
use tracing::{debug, info};

#[allow(unused_imports)]
use crate::core::{
client::{ClientArgs, ClientCredentials, RedisClientBuilder},
connection::VerifyConnection,
result::{RedsumerError, RedsumerResult},
streams::{producer::ProducerCommands, types::Id},
};
Expand Down Expand Up @@ -101,7 +100,7 @@ impl Producer {
);

let mut client: Client = args.build()?;
client.ping()?;
client.ping::<String>()?;

info!("Producer instance created successfully and it is ready to be used");

Expand Down

0 comments on commit f34f088

Please sign in to comment.