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

getdozer / dozer / 4116183752

pending completion
4116183752

push

github

GitHub
refactor: Make `LmdbRoCache` and `LmdbRwCache` `Send` and `Sync` (#821)

790 of 790 new or added lines in 44 files covered. (100.0%)

23005 of 33842 relevant lines covered (67.98%)

56312.85 hits per line

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

36.0
/dozer-cache/src/errors.rs
1
use dozer_types::serde_json::Value;
2
use dozer_types::thiserror;
3
use dozer_types::thiserror::Error;
4

5
use dozer_types::errors::internal::BoxedError;
6
use dozer_types::errors::types::{DeserializationError, SerializationError, TypeError};
7

8
#[derive(Error, Debug)]
×
9
pub enum CacheError {
10
    #[error(transparent)]
×
11
    QueryValidation(#[from] QueryValidationError),
12
    #[error(transparent)]
13
    Internal(#[from] BoxedError),
14
    #[error(transparent)]
15
    Query(#[from] QueryError),
16
    #[error(transparent)]
17
    Index(#[from] IndexError),
18
    #[error(transparent)]
19
    Plan(#[from] PlanError),
20
    #[error(transparent)]
21
    Type(#[from] TypeError),
22
    #[error(transparent)]
23
    Storage(#[from] dozer_storage::errors::StorageError),
24
    #[error("Schema Identifier is not present")]
25
    SchemaIdentifierNotFound,
26
    #[error("Path not initialized for Cache Reader")]
27
    PathNotInitialized,
28
    #[error("Secondary index database is not found")]
29
    SecondaryIndexDatabaseNotFound,
30
}
31

32
impl CacheError {
33
    pub fn map_serialization_error(e: dozer_types::bincode::Error) -> CacheError {
×
34
        CacheError::Type(TypeError::SerializationError(SerializationError::Bincode(
×
35
            e,
×
36
        )))
×
37
    }
×
38
    pub fn map_deserialization_error(e: dozer_types::bincode::Error) -> CacheError {
×
39
        CacheError::Type(TypeError::DeserializationError(
×
40
            DeserializationError::Bincode(e),
×
41
        ))
×
42
    }
×
43
}
44

45
#[derive(Error, Debug)]
×
46
pub enum QueryError {
47
    #[error("Failed to get a record by id - {0:?}")]
48
    GetValue(#[source] dozer_storage::lmdb::Error),
49
    #[error("Get by primary key is not supported when it is composite: {0:?}")]
50
    MultiIndexFetch(String),
51
    #[error("Failed to get a schema by id - {0:?}")]
52
    GetSchema(#[source] dozer_storage::lmdb::Error),
53
    #[error("Failed to insert a record - {0:?}")]
54
    InsertValue(#[source] dozer_storage::lmdb::Error),
55
    #[error("Failed to delete a record - {0:?}")]
56
    DeleteValue(#[source] dozer_storage::lmdb::Error),
57
}
58

59
#[derive(Error, Debug)]
×
60
pub enum CompareError {
61
    #[error("cannot read field length")]
62
    CannotReadFieldLength,
63
    #[error("cannot read field")]
64
    CannotReadField,
65
    #[error("invalid sort direction")]
66
    InvalidSortDirection(u8),
67
    #[error(transparent)]
68
    DeserializationError(#[from] DeserializationError),
69
}
70

71
#[derive(Error, Debug)]
×
72
pub enum IndexError {
73
    #[error("field indexes dont match with index_scan")]
74
    MismatchedIndexAndValues,
75
    #[error("Expected strings for full text search")]
76
    ExpectedStringFullText,
77
    #[error("Field index out of range")]
78
    FieldIndexOutOfRange,
79
    #[error("Full text index generates one key for each field")]
80
    IndexSingleField,
81
    #[error("Field {0} cannot be indexed using full text")]
82
    FieldNotCompatibleIndex(usize),
83
    #[error("No secondary indexes defined")]
84
    MissingSecondaryIndexes,
85
    #[error("Unsupported Index: {0}")]
86
    UnsupportedIndex(String),
87
    #[error("range queries on multiple fields are not supported ")]
88
    UnsupportedMultiRangeIndex,
89
    #[error("Compound_index is required for fields: {0}")]
90
    MissingCompoundIndex(String),
91
}
92

93
#[derive(Error, Debug)]
32✔
94
pub enum QueryValidationError {
95
    #[error("String cannot contain special character")]
96
    SpecialCharacterError,
97
    #[error("empty object passed as value")]
98
    EmptyObjectAsValue,
99
    #[error("empty array passed as value")]
100
    EmptyArrayAsValue,
101

102
    #[error("unexpected character : {0}")]
103
    UnexpectedCharacter(String),
104

105
    #[error("unexpected object: {0}")]
106
    UnexpectedObject(Value),
107

108
    #[error("unidentified operator {0}")]
109
    UnidentifiedOperator(String),
110

111
    #[error("More than one statement passed in Simple Expression")]
112
    MoreThanOneStmt,
113

114
    #[error("Invalid Expression")]
115
    InvalidExpression,
116

117
    #[error("Invalid Expression")]
118
    InvalidAndExpression,
119

120
    #[error("order value not a string")]
121
    OrderValueNotString,
122

123
    #[error("unidentified order {0}")]
124
    UnidentifiedOrder(String),
125
}
126

127
#[derive(Error, Debug)]
×
128
pub enum PlanError {
129
    #[error("Field {0:?} not found in query")]
130
    FieldNotFound(String),
131
    #[error(transparent)]
132
    TypeError(#[from] TypeError),
133
    #[error("Cannot sort full text filter")]
134
    CannotSortFullTextFilter,
135
    #[error("Conflicting sort options")]
136
    ConflictingSortOptions,
137
    #[error("Cannot have more than one range query")]
138
    RangeQueryLimit,
139
    #[error("Matching index not found")]
140
    MatchingIndexNotFound,
141
}
142

143
pub fn validate_query(
2,336✔
144
    condition: bool,
2,336✔
145
    err: QueryValidationError,
2,336✔
146
) -> Result<(), QueryValidationError> {
2,336✔
147
    if !condition {
2,336✔
148
        Err(err)
8✔
149
    } else {
150
        Ok(())
2,328✔
151
    }
152
}
2,336✔
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