Skip to content
This repository was archived by the owner on Mar 29, 2025. It is now read-only.

Adding support for RDB version <= 12 and refactoring #19

Merged
merged 35 commits into from
Mar 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4d52810
Add new rdb version and datatypes
bimtauer Dec 19, 2024
865bea2
Begin port to clap and revised structure
bimtauer Dec 19, 2024
677b503
Refactor, fix previous test, add rust integration test
bimtauer Dec 19, 2024
40bea25
Introduce file output and simplify integration test
bimtauer Dec 19, 2024
a28198f
Change encoding of non ascii chars
bimtauer Dec 22, 2024
7b06391
Implement hash list pack
bimtauer Dec 22, 2024
4decc7b
Begin factoring out formatter from parser
bimtauer Dec 23, 2024
3e25fe5
Further refactor formatter
bimtauer Dec 23, 2024
2d11517
Fix tests for refactored json formatter, cleanup pending
bimtauer Dec 25, 2024
0633c9e
Refactor formatter, generic format method
bimtauer Dec 27, 2024
7aaf4ea
Implement skip for hash list pack
bimtauer Dec 27, 2024
8083786
Add integration tests for plain and protocol format
bimtauer Dec 27, 2024
f5c159b
Improve error handling
bimtauer Dec 27, 2024
036be25
Create protocol based integration test across versions
bimtauer Dec 29, 2024
e4bf3c2
Implement listpack handling, better errors, ensure that all previousl…
bimtauer Dec 29, 2024
0439a7b
Implement sorted set v2 and listpack encodings
bimtauer Dec 30, 2024
3115477
Add logging
bimtauer Dec 30, 2024
c0424ae
Small cleanup
bimtauer Dec 30, 2024
b16a169
Restructure code and public lib interface
bimtauer Jan 1, 2025
ca0cd68
Add python bindings
bimtauer Jan 2, 2025
bac656d
Update readme
bimtauer Jan 2, 2025
419a88c
Update changelog
bimtauer Jan 2, 2025
ead9e1a
Link changelog
bimtauer Jan 2, 2025
b7bcbb5
Fix start and end formatting
bimtauer Jan 2, 2025
fcdf100
Integrate shell script tests fully into rust integration tests
bimtauer Jan 2, 2025
8152adf
Remove makefile
bimtauer Jan 2, 2025
74b5836
Update ignore and rm python version
bimtauer Jan 2, 2025
361a432
Heed clippy's call
bimtauer Jan 2, 2025
279fce9
Add Rust CI workflow
bimtauer Jan 2, 2025
7a5bfac
Clean
bimtauer Jan 13, 2025
cd8a83a
Fix Redis Container Integration Test
bimtauer Jan 14, 2025
817f9b4
Adapt python CI
bimtauer Jan 14, 2025
ef4608a
Prep release
bimtauer Jan 14, 2025
2ce44ab
Removing token should use trusted publisher
bimtauer Jan 14, 2025
2a87c62
Rename python project
bimtauer Jan 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @bimtauer
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this in my fork as a precaution against hijacking since I did test-publish the python package rdb-py from there. I used a trusted publisher configured for my fork for this. Publishing the python bindings wont work from here. Let me know if you also want to publish 0.3 of the python lib from here first.
Sorry for not mentioning this ealier.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good! Once I publish the latest version on crates.io, I will hand it over to you and your repo becomes the main one. So we can keep it as that and you can do the rdb-py release afterwards.

148 changes: 148 additions & 0 deletions .github/workflows/Python-CI.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# This file is autogenerated by maturin v1.8.1
# To update, run
#
# maturin generate-ci github --platform linux --platform windows --platform macos
#
name: CI

on:
push:
branches:
- main
- master
tags:
- '*'
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
linux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-22.04
target: x86_64
- runner: ubuntu-22.04
target: x86
- runner: ubuntu-22.04
target: aarch64
- runner: ubuntu-22.04
target: armv7
- runner: ubuntu-22.04
target: s390x
- runner: ubuntu-22.04
target: ppc64le
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.platform.target }}
path: dist

windows:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: windows-latest
target: x64
- runner: windows-latest
target: x86
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
architecture: ${{ matrix.platform.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.platform.target }}
path: dist

macos:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: macos-13
target: x86_64
- runner: macos-14
target: aarch64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.platform.target }}
path: dist

sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: dist

release:
name: Release
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
needs: [linux, windows, macos, sdist]
permissions:
# Use to sign the release artifacts
id-token: write
# Used to upload release artifacts
contents: write
# Used to generate artifact attestation
attestations: write
steps:
- uses: actions/download-artifact@v4
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-path: 'wheels-*/*'
- name: Publish to PyPI
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: PyO3/maturin-action@v1
with:
command: upload
args: --non-interactive --skip-existing wheels-*/*
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will fail in this repository

40 changes: 40 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Cargo Build & Test

on:
push:
pull_request:

env:
CARGO_TERM_COLOR: always

jobs:
build_and_test:
name: Rust project - latest
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- stable
- beta
- nightly
steps:
- uses: actions/checkout@v4
- name: setup toolchain
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}

- name: Cache cargo
uses: Swatinem/rust-cache@v2

- name: cargo build
run: cargo build --verbose

- name: cargo test
run: cargo test --verbose

- name: Check formatting
if: matrix.toolchain == 'stable'
run: cargo fmt --all -- --check

- name: Clippy
if: matrix.toolchain == 'stable'
run: cargo clippy --all --all-features --tests -- -D warnings
23 changes: 17 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
/target
/Cargo.lock
/utils/pkg
/utils/src
/utils/rdb-rs
*.tar.gz
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

# Python
.python-version
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
# Changelog

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
- New RDB version and Datatypes
- Rust based integration tests
- Fixtures for protocol and plain output
- Redis integration test covering 6.2 - 7.4
- Option to output to file
- Error handling with thiserror
- Support for new encoding types:
- listpack
- quicklist
- sorted set v2
- Python bindings with Maturin

### Changed
- Ported CLI to clap
- Encoding of non-ascii characters - previously escaped, resulting in possible duplicate json keys, now as hex string
- Separated decoding and formatting logic

### Removed
- Previous docs and build pipeline


---
# Previous:

### 0.2.1 - 2016-08-03

* Bug fix: Correctly handle skipping blobs
Expand Down
35 changes: 28 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
[package]

name = "rdb"
version = "0.2.1"
authors = ["Jan-Erik Rediger <[email protected]>"]

keywords = ["redis", "database"]
edition = "2021"
version = "0.3.0"
authors = ["Jan-Erik Rediger <[email protected]>", "Tim Bauer <[email protected]>"]
keywords = ["redis", "database", "rdb", "parser"]
description = "Fast and efficient RDB parsing utility"

readme = "README.md"
license = "MIT"

homepage = "http://rdb.fnordig.de/"
documentation = "http://rdb.fnordig.de/doc/rdb/"
repository = "https://github.com/badboy/rdb-rs"
Expand All @@ -28,9 +25,33 @@ name = "rdb"
path = "src/main.rs"
doc = false

[lib]
name = "rdb"
crate-type = ["cdylib", "rlib"]

[dependencies]
lzf = "0.3"
getopts = "0.2"
rustc-serialize = "0.3"
regex = "0.1"
byteorder = "0.5"
thiserror = "1.0"
pyo3 = { version = "0.23.3", features = ["extension-module"], optional = true }
clap = { version = "4.4", features = ["derive"] }
indexmap = "2.7.0"
log = "0.4.22"

[dev-dependencies]
async-std = { version = "1.13.0", features = ["attributes"] }
tokio = { version = "1.0", features = ["full"] }
pretty_assertions = "1.4.1"
redis = "0.27.6"
rstest = "0.23.0"
testcontainers = "0.23.1"
testcontainers-modules = { version = "0.11.4", features = ["redis"] }
tempfile = "3.14.0"
assert_cmd = "2.0.16"

[features]
default = []
python = ["pyo3"]
57 changes: 0 additions & 57 deletions Makefile

This file was deleted.

Loading