Skip to content

Commit

Permalink
WIP Sqlite backend
Browse files Browse the repository at this point in the history
This doesn't cursors or any of the optional features. It also
only has a connection pool of size 1 which limits reader parallelism.

It has to do a bit of gymnastics to implement some of the LMDBisms
of the API
  • Loading branch information
jrmuizel committed Apr 22, 2024
1 parent 79da807 commit dba2d71
Show file tree
Hide file tree
Showing 17 changed files with 1,925 additions and 2 deletions.
6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ serde_derive = "1.0"
thiserror = "1.0"
url = "2.0"
uuid = "1.0"
elsa = "1.10.0"
crossbeam-channel = "0.5.12"

[dependencies.rusqlite]
version = "0.26.1"
features = ["bundled"]

[dev-dependencies]
byteorder = "1"
Expand Down
12 changes: 12 additions & 0 deletions src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ mod common;
#[cfg(feature = "lmdb")]
mod impl_lmdb;
mod impl_safe;
mod impl_sqlite;
mod traits;

pub use common::*;
Expand All @@ -38,3 +39,14 @@ pub use impl_safe::{
RwTransactionImpl as SafeModeRwTransaction, StatImpl as SafeModeStat,
WriteFlagsImpl as SafeModeWriteFlags,
};

pub use impl_sqlite::{
DatabaseFlagsImpl as SqliteDatabaseFlags, DatabaseImpl as SqliteDatabase,
EnvironmentBuilderImpl as Sqlite, EnvironmentFlagsImpl as SqliteEnvironmentFlags,
EnvironmentImpl as SqliteEnvironment, ErrorImpl as SqliteError, InfoImpl as SqliteInfo,
IterImpl as SqliteIter, RoCursorImpl as SqliteRoCursor,
RoTransactionImpl as SqliteRoTransaction, RwCursorImpl as SqliteRwCursor,
RwTransactionImpl as SqliteRwTransaction, StatImpl as SqliteStat,
WriteFlagsImpl as SqliteWriteFlags,
};

31 changes: 31 additions & 0 deletions src/backend/impl_sqlite.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2018-2019 Mozilla
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.


mod cursor;
mod database;
mod environment;
mod error;
mod flags;
mod info;
mod iter;
mod stat;
mod transaction;


pub use cursor::{RoCursorImpl, RwCursorImpl};
pub use database::DatabaseImpl;
pub use environment::{EnvironmentBuilderImpl, EnvironmentImpl};
pub use error::ErrorImpl;
pub use flags::{DatabaseFlagsImpl, EnvironmentFlagsImpl, WriteFlagsImpl};
pub use info::InfoImpl;
pub use iter::IterImpl;
pub use stat::StatImpl;
pub use transaction::{RoTransactionImpl, RwTransactionImpl};
Loading

0 comments on commit dba2d71

Please sign in to comment.