• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

getdozer / dozer / 4354627675

pending completion
4354627675

push

github

GitHub
chore: Use `LmdbMap` and `LmdbMultimap` instead of raw database in cache (#1156)

754 of 754 new or added lines in 15 files covered. (100.0%)

29895 of 39630 relevant lines covered (75.44%)

38604.24 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.73
/dozer-cache/src/cache/lmdb/tests/utils.rs
1
use std::borrow::Cow;
2

3
use dozer_storage::lmdb::Transaction;
4
use dozer_types::types::{Field, IndexDefinition, Record, Schema};
5

6
use crate::cache::{
×
7
    lmdb::cache::{LmdbRwCache, SecondaryIndexDatabases},
×
8
    RwCache,
×
9
};
×
10

×
11
pub fn create_cache(
8✔
12
    schema_name: &str,
8✔
13
    schema_gen: impl FnOnce() -> (Schema, Vec<IndexDefinition>),
8✔
14
) -> (LmdbRwCache, Schema, Vec<IndexDefinition>) {
8✔
15
    let (schema, secondary_indexes) = schema_gen();
8✔
16
    let cache = LmdbRwCache::create(
8✔
17
        [(
8✔
18
            schema_name.to_string(),
8✔
19
            schema.clone(),
8✔
20
            secondary_indexes.clone(),
8✔
21
        )],
8✔
22
        Default::default(),
8✔
23
        Default::default(),
8✔
24
    )
8✔
25
    .unwrap();
8✔
26
    (cache, schema, secondary_indexes)
8✔
27
}
8✔
28

×
29
pub fn insert_rec_1(
16✔
30
    cache: &LmdbRwCache,
16✔
31
    schema: &Schema,
16✔
32
    (a, b, c): (i64, Option<String>, Option<i64>),
16✔
33
) {
16✔
34
    let mut record = Record::new(
16✔
35
        schema.identifier,
16✔
36
        vec![
16✔
37
            Field::Int(a),
16✔
38
            b.map_or(Field::Null, Field::String),
16✔
39
            c.map_or(Field::Null, Field::Int),
16✔
40
        ],
16✔
41
        None,
16✔
42
    );
16✔
43
    cache.insert(&mut record).unwrap();
16✔
44
}
16✔
45

×
46
pub fn insert_full_text(
1✔
47
    cache: &LmdbRwCache,
1✔
48
    schema: &Schema,
1✔
49
    (a, b): (Option<String>, Option<String>),
1✔
50
) {
1✔
51
    let mut record = Record::new(
1✔
52
        schema.identifier,
1✔
53
        vec![
1✔
54
            a.map_or(Field::Null, Field::String),
1✔
55
            b.map_or(Field::Null, Field::Text),
1✔
56
        ],
1✔
57
        None,
1✔
58
    );
1✔
59
    cache.insert(&mut record).unwrap();
1✔
60
}
1✔
61

×
62
pub fn get_indexes<'txn, T: Transaction>(
3✔
63
    txn: &'txn T,
3✔
64
    secondary_index_databases: &SecondaryIndexDatabases,
3✔
65
) -> Vec<Vec<(Cow<'txn, [u8]>, Cow<'txn, u64>)>> {
3✔
66
    let mut items = Vec::new();
3✔
67
    for db in secondary_index_databases.values() {
10✔
68
        items.push(
10✔
69
            db.iter(txn)
10✔
70
                .unwrap()
10✔
71
                .map(|result| result.unwrap())
16✔
72
                .collect(),
10✔
73
        );
10✔
74
    }
10✔
75
    items
3✔
76
}
3✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc