• 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

0.0
/dozer-cache/src/errors.rs
1
use std::path::PathBuf;
2

3
use dozer_types::thiserror;
4
use dozer_types::thiserror::Error;
5

6
use dozer_types::errors::types::{DeserializationError, SerializationError, TypeError};
7
use dozer_types::types::{IndexDefinition, SchemaWithIndex};
×
8

9
#[derive(Error, Debug)]
×
10
pub enum CacheError {
11
    #[error("Io error on {0:?}: {1}")]
12
    Io(PathBuf, #[source] std::io::Error),
13
    #[error("Query error: {0}")]
14
    Query(#[from] QueryError),
15
    #[error("Index error: {0}")]
16
    Index(#[from] IndexError),
17
    #[error("Plan error: {0}")]
18
    Plan(#[from] PlanError),
19
    #[error("Type error: {0}")]
20
    Type(#[from] TypeError),
21
    #[error("Storage error: {0}")]
22
    Storage(#[from] dozer_storage::errors::StorageError),
23
    #[error("Schema is not found")]
24
    SchemaNotFound,
25
    #[error("Schema for {name} mismatch: given {given:?}, stored {stored:?}")]
26
    SchemaMismatch {
27
        name: String,
28
        given: Box<SchemaWithIndex>,
29
        stored: Box<SchemaWithIndex>,
30
    },
31
    #[error("Index definition {0} is not found")]
32
    IndexDefinitionNotFound(String),
33
    #[error("Index definition {name} mismatch: given {given:?}, stored {stored:?}")]
34
    IndexDefinitionMismatch {
35
        name: String,
36
        given: IndexDefinition,
×
37
        stored: IndexDefinition,
×
38
    },
×
39
    #[error("Path not initialized for Cache Reader")]
×
40
    PathNotInitialized,
×
41
    #[error("Primary key is not found")]
×
42
    PrimaryKeyNotFound,
×
43
    #[error("Primary key already exists")]
×
44
    PrimaryKeyExists,
×
45
}
×
46

×
47
impl CacheError {
×
48
    pub fn map_serialization_error(e: dozer_types::bincode::Error) -> CacheError {
×
49
        CacheError::Type(TypeError::SerializationError(SerializationError::Bincode(
×
50
            e,
×
51
        )))
×
52
    }
×
53
    pub fn map_deserialization_error(e: dozer_types::bincode::Error) -> CacheError {
×
54
        CacheError::Type(TypeError::DeserializationError(
×
55
            DeserializationError::Bincode(e),
×
56
        ))
×
57
    }
×
58
}
59

60
#[derive(Error, Debug)]
×
61
pub enum QueryError {
62
    #[error("Failed to get a record by id - {0:?}")]
63
    GetValue(#[source] dozer_storage::lmdb::Error),
64
    #[error("Failed to get a schema by id - {0:?}")]
×
65
    GetSchema(#[source] dozer_storage::lmdb::Error),
66
    #[error("Failed to insert a record - {0:?}")]
67
    InsertValue(#[source] dozer_storage::lmdb::Error),
68
    #[error("Failed to delete a record - {0:?}")]
69
    DeleteValue(#[source] dozer_storage::lmdb::Error),
70
}
71

72
#[derive(Error, Debug)]
×
73
pub enum CompareError {
74
    #[error("cannot read field length")]
75
    CannotReadFieldLength,
76
    #[error("cannot read field")]
×
77
    CannotReadField,
78
    #[error("invalid sort direction")]
79
    InvalidSortDirection(u8),
80
    #[error("deserialization error: {0:?}")]
81
    DeserializationError(#[from] DeserializationError),
82
}
83

84
#[derive(Error, Debug)]
×
85
pub enum IndexError {
86
    #[error("field indexes dont match with index_scan")]
87
    MismatchedIndexAndValues,
88
    #[error("Expected strings for full text search")]
89
    ExpectedStringFullText,
90
    #[error("Field index out of range")]
91
    FieldIndexOutOfRange,
92
    #[error("Full text index generates one key for each field")]
93
    IndexSingleField,
94
    #[error("Field {0} cannot be indexed using full text")]
×
95
    FieldNotCompatibleIndex(usize),
96
    #[error("No secondary indexes defined")]
97
    MissingSecondaryIndexes,
98
    #[error("Unsupported Index: {0}")]
×
99
    UnsupportedIndex(String),
100
    #[error("range queries on multiple fields are not supported ")]
101
    UnsupportedMultiRangeIndex,
102
    #[error("Compound_index is required for fields: {0}")]
103
    MissingCompoundIndex(String),
104
}
105

106
#[derive(Error, Debug)]
×
107
pub enum PlanError {
108
    #[error("Field {0:?} not found in query")]
109
    FieldNotFound(String),
110
    #[error("Type error: {0}")]
111
    TypeError(#[from] TypeError),
112
    #[error("Cannot sort full text filter")]
113
    CannotSortFullTextFilter,
114
    #[error("Conflicting sort options")]
115
    ConflictingSortOptions,
116
    #[error("Cannot have more than one range query")]
117
    RangeQueryLimit,
118
    #[error("Matching index not found")]
119
    MatchingIndexNotFound,
120
}
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