1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//! `limousine_engine` provides a procedural macro to automatically
//! generate an hybrid key-value store design consisting of both
//! classical and learned components.
//!
//! **As of the current version, learned components are not yet fully
//! supported.**
//!
//! ```ignore
//! use limousine_engine::prelude::*;
//!
//! create_kv_store! {
//! name: ExampleStore,
//! layout: [
//! btree_top(),
//! pgm(epsilon = 8),
//! pgm(epsilon = 8),
//! btree(fanout = 32),
//! btree(fanout = 32, persist),
//! btree(fanout = 64, persist)
//! ]
//! }
//! ```
//!
//! To generate a design, we provide a name for the structure and a
//! layout description which consists of a stack of components. For
//! instance in the above example, the key-value store consists of
//! a base layer of on-disk BTree nodes of fanout 64, underneath a
//! layer of on on-disk BTree nodes with fanout 32, underneath an
//! in-memory layer of BTree nodes with fanout 32. On top of this, we
//! have two in-memory PGM learned layers with epsilon parameters of 8,
//! and a tiny in-memory BTree as a top layer.
//!
//! **Since learned components are not yet fully supported, the above example
//! will not compile. To get a working key-value store in the current version,
//! we should only use BTree components.**
//!
//! ```
//! use limousine_engine::prelude::*;
//!
//! create_kv_store! {
//! name: ExampleStore,
//! layout: [
//! btree_top(),
//! btree(fanout = 8),
//! btree(fanout = 8),
//! btree(fanout = 32),
//! btree(fanout = 32, persist),
//! btree(fanout = 64, persist)
//! ]
//! }
//! ```
//!
//! We can then use these generated data structures to perform queries:
//!
//! ```ignore
//! // Load the first two layer of the index from memory
//! let index: ExampleStore<u128, u128> = ExampleStore::open("data/index")?;
//!
//! index.insert(10, 50)?;
//! index.insert(20, 60)?;
//! index.insert(30, 70)?;
//! index.insert(40, 80)?;
//!
//! assert_eq!(index.search(10)?, Some(50));
//! ```
/// Include this at the top of the file when materializing a hybrid index or using a hybrid index.
pub use Result;
pub use limousine_core as private;