#tuple #table #mmap #engine #storage

bin+lib tuple_storage

A type-safe and small table engine for any Tuple of Ints

2 releases

Uses old Rust 2015

0.1.1 Jul 7, 2018
0.1.0 Jul 6, 2018

#203 in Database implementations

Custom license

41KB
916 lines

tuple_storage

pipeline status

Store one kind of tuple per file with ease. Every access is type-safe.

The database is memory mapped for fast access even as the set grows.

Example usage

$ cargo run create target/demo.ts '(u8, i16, u32, i64)'
$ cargo run show target/demo.ts
(u8, i16, u32, i64)

$ cargo run insert target/demo.ts '(1, 2, 3, 4)'
$ cargo run insert target/demo.ts '(6, 7, 8, 9)'
$ cargo run insert target/demo.ts '(3, 4, 5, 6)'

$ cargo run search target/demo.ts
[
    (1, 2, 3, 4)
    (3, 4, 5, 6)
    (6, 7, 8, 9)
]
found 3 Tuples

$ cargo run search target/demo.ts '<3'
[
    (1, 2, 3, 4)
]
found 1 Tuples
$ cargo run search target/demo.ts '=3'
[
    (3, 4, 5, 6)
]
found 1 Tuples
$ cargo run search target/demo.ts '>3'
[
    (6, 7, 8, 9)
]
found 1 Tuples

$ cargo run remove target/demo.ts '>3'
removed 1 Tuples
$ cargo run search target/demo.ts '>3'
[]
found 0 Tuples


# inserting Tuple violating the Schema:
$ cargo run insert target/demo.ts '(-23, 0, 0, 0)'
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }', libcore/result.rs:945:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

# searching with an invalid search index
$ cargo run search target/demo.ts '=-2'
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }', libcore/result.rs:945:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Dependencies

~3.5–5.5MB
~97K SLoC