Metadata-Version: 2.4
Name: rdb-py
Version: 0.3.0
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Dist: maturin >=1.8.0
Requires-Dist: cffi ==1.17.1
License-File: LICENSE
Summary: Add your description here
Keywords: redis,database,rdb,parser
Home-Page: http://rdb.fnordig.de/
Author: Jan-Erik Rediger <badboy@fnordig.de>, Tim Bauer <timderbauer@gmail.com>
Author-email: Jan-Erik Rediger <badboy@fnordig.de>, Tim Bauer <timderbauer@gmail.com>
License: MIT
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Source Code, https://github.com/badboy/rdb-rs

# rdb-rs - RDB parsing, formatting, analyzing. All in one library

This is a fork and refactor of the archived https://github.com/badboy/rdb-rs. 
My goal is to modernize the library, implement support for newer RDB versions and encoding types and also offer python bindings. 

See [changelog](CHANGELOG.md).

Inspired and based on [redis-rdb-tools][].

## Documentation

TBD

## Build

```
cargo build --release
```

## Basic operation

rdb-rs exposes just one important method: `parse`.
This methods takes care of reading the RDB from a stream,
parsing the containted data and calling the provided formatter with already-parsed values.

```rust
use std::io::BufReader;
use std::fs::File;
use std::path::Path;

let file = File::open(&Path::new("dump.rdb")).unwrap();
let reader = BufReader::new(file);
rdb::parse(reader, rdb::formatter::JSON::new(), rdb::filter::Simple::new());
```

### Formatter

rdb-rs brings 4 pre-defined formatters, which can be used:

* `Plain`: Just plain output for testing
* `JSON`: JSON-encoded output
* `Nil`: Surpresses all output
* `Protocol`: Formats the data in [RESP][],
the Redis Serialization Protocol

These formatters adhere to the `Formatter` trait and supply a method for each possible datatype or opcode.
Its up to the formatter to correctly handle all provided data such as lists, sets, hashes, expires and metadata.

### Command-line

rdb-rs brings a Command Line application as well.

This application will take a RDB file as input and format it in the specified format (JSON by default).

Example:

```
$ rdb --format json dump.rdb
[{"key":"value"}]
$ rdb --format protocol dump.rdb
*2
$6
SELECT
$1
0
*3
$3
SET
$3
key
$5
value
```

## Tests

Run tests with:

```
make test
```

This will run the code tests with cargo as well as checking that it can parse all included dump files.

## Contribute

If you find bugs or want to help otherwise, please [open an issue][issues].

## License

MIT. See [LICENSE](LICENSE).

[redis-rdb-tools]: https://github.com/sripathikrishnan/redis-rdb-tools
[RESP]: http://redis.io/topics/protocol
[issues]: https://github.com/badboy/rdb-rs/issues
[doc]: http://rdb.fnordig.de/doc/rdb/

