Debian Codegraph @

third_party/rust/rkv/src/store.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
11 pub mod keys;
12 pub mod single;
13
14 #[cfg(feature = "db-dup-sort")]
15 pub mod multi;
16
17 #[cfg(feature = "db-int-key")]
18 pub mod integer;
19
20 #[cfg(all(feature = "db-dup-sort", feature = "db-int-key"))]
21 pub mod integermulti;
22
23 use crate::backend::BackendDatabaseFlags;
24
25 #[derive(Default, Debug, Copy, Clone)]
26 pub struct Options<F> {
27 pub create: bool,
28 pub flags: F,
29 }
30
31 impl<F> Options<F>
32 where
33 F: BackendDatabaseFlags,
34 {
35 pub fn create() -> Options<F> {
36 Options {
37 create: true,
38 flags: F::empty(),
39 }
40 }
41 }
42
43 #[derive(Default, Debug, Copy, Clone)]
44 pub struct CloseOptions {
45 pub delete: bool,
46 }
47
48 impl CloseOptions {
49 pub fn delete_files_on_disk() -> CloseOptions {
50 CloseOptions { delete: true }
51 }
52 }