Debian Codegraph @

third_party/rust/rkv/src/backend/common.rs

raw
1 // Copyright 2018-2019 Mozilla
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4 // this file except in compliance with the License. You may obtain a copy of the
5 // License at http://www.apache.org/licenses/LICENSE-2.0
6 // Unless required by applicable law or agreed to in writing, software distributed
7 // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
8 // CONDITIONS OF ANY KIND, either express or implied. See the License for the
9 // specific language governing permissions and limitations under the License.
10 #![allow(non_camel_case_types)]
11
12 pub enum EnvironmentFlags {
13 FIXED_MAP,
14 NO_SUB_DIR,
15 WRITE_MAP,
16 READ_ONLY,
17 NO_META_SYNC,
18 NO_SYNC,
19 MAP_ASYNC,
20 NO_TLS,
21 NO_LOCK,
22 NO_READAHEAD,
23 NO_MEM_INIT,
24 }
25
26 pub enum DatabaseFlags {
27 REVERSE_KEY,
28 #[cfg(feature = "db-dup-sort")]
29 DUP_SORT,
30 #[cfg(feature = "db-dup-sort")]
31 DUP_FIXED,
32 #[cfg(feature = "db-int-key")]
33 INTEGER_KEY,
34 INTEGER_DUP,
35 REVERSE_DUP,
36 }
37
38 pub enum WriteFlags {
39 NO_OVERWRITE,
40 NO_DUP_DATA,
41 CURRENT,
42 APPEND,
43 APPEND_DUP,
44 }
45
46 /// Strategy to use when corrupted data is detected while opening a database.
47 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
48 pub enum RecoveryStrategy {
49 /// Bubble up the error on detecting a corrupted data file. The default.
50 Error,
51
52 /// Discard the corrupted data and start with an empty database.
53 Discard,
54
55 /// Move the corrupted data file to `$file.corrupt` and start with an empty database.
56 Rename,
57 }