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

getdozer / dozer / 4382580286

pending completion
4382580286

push

github

GitHub
feat: Separate cache operation log environment and index environments (#1199)

1370 of 1370 new or added lines in 33 files covered. (100.0%)

28671 of 41023 relevant lines covered (69.89%)

51121.29 hits per line

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

89.23
/dozer-cache/src/cache/lmdb/tests/read_write.rs
1
use crate::cache::expression::{FilterExpression, Operator, QueryExpression};
2
use crate::cache::lmdb::cache::{CacheCommonOptions, CacheWriteOptions, LmdbRoCache, LmdbRwCache};
3
use crate::cache::{lmdb::tests::utils as lmdb_utils, test_utils, RoCache, RwCache};
4
use dozer_types::serde_json::Value;
5
use dozer_types::types::Field;
6
use tempdir::TempDir;
7
#[test]
1✔
8
fn read_and_write() {
1✔
9
    let path = TempDir::new("dozer").unwrap();
1✔
10
    let path = (path.path().to_path_buf(), "cache".to_string());
1✔
11

1✔
12
    // write and read from cache from two different threads.
1✔
13

1✔
14
    let schema = test_utils::schema_1();
1✔
15
    let cache_writer = LmdbRwCache::create(
1✔
16
        &schema,
1✔
17
        &CacheCommonOptions {
1✔
18
            max_readers: 1,
1✔
19
            max_db_size: 100,
1✔
20
            path: Some(path.clone()),
1✔
21
            intersection_chunk_size: 1,
1✔
22
        },
1✔
23
        CacheWriteOptions {
1✔
24
            max_size: 1024 * 1024,
1✔
25
        },
1✔
26
    )
1✔
27
    .unwrap();
1✔
28

1✔
29
    let items = vec![
1✔
30
        (1, Some("a".to_string()), Some(521)),
1✔
31
        (2, Some("a".to_string()), None),
1✔
32
        (3, None, Some(521)),
1✔
33
        (4, None, None),
1✔
34
    ];
1✔
35

×
36
    for val in items.clone() {
4✔
37
        lmdb_utils::insert_rec_1(&cache_writer, &schema.0, val.clone());
4✔
38
    }
4✔
39
    cache_writer.commit().unwrap();
1✔
40

1✔
41
    let read_options = CacheCommonOptions {
1✔
42
        path: Some(path),
1✔
43
        ..Default::default()
1✔
44
    };
1✔
45
    let cache_reader = LmdbRoCache::new(&read_options).unwrap();
1✔
46
    for (a, b, c) in items {
5✔
47
        let rec = cache_reader.get(&Field::Int(a).encode()).unwrap();
4✔
48
        let values = vec![
4✔
49
            Field::Int(a),
4✔
50
            b.map_or(Field::Null, Field::String),
4✔
51
            c.map_or(Field::Null, Field::Int),
4✔
52
        ];
4✔
53
        assert_eq!(rec.record.values, values, "should be equal");
4✔
54
    }
×
55
    let records = cache_reader
1✔
56
        .query(&QueryExpression {
1✔
57
            filter: Some(FilterExpression::Simple(
1✔
58
                "a".to_string(),
1✔
59
                Operator::EQ,
1✔
60
                Value::from(1),
1✔
61
            )),
1✔
62
            ..Default::default()
1✔
63
        })
1✔
64
        .unwrap();
1✔
65
    assert_eq!(records.len(), 1);
1✔
66
}
1✔
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