cuprate/storage/database/src/lib.rs
hinto-janai eead49beb0
lints: opt in manual lint crates (#263)
* cargo.toml: transfer existing lints

* rpc/interface: lints

* rpc/json-rpc: lints

* rpc/types: lints

* storage/blockchain: lints

* rpc/types: fix lints

* cargo.toml: fix lint group priority

* storage/blockchain: fix lints

* fix misc lints

* storage/database: fixes

* storage/txpool: opt in lints + fixes

* types: opt in + fixes

* helper: opt in + fixes

* types: remove borsh

* rpc/interface: fix test

* test fixes

* database: fix lints

* fix lint

* tabs -> spaces

* blockchain: `config/` -> `config.rs`
2024-09-02 18:12:54 +01:00

75 lines
2 KiB
Rust

#![doc = include_str!("../README.md")]
#![allow(
// This lint is allowed because the following
// code exists a lot in this crate:
//
// ```rust
// let env_inner = env.env_inner();
// let tx_rw = env_inner.tx_rw()?;
// OpenTables::create_tables(&env_inner, &tx_rw)?;
// ```
//
// Rust thinks `env_inner` can be dropped earlier
// but it cannot, we need it for the lifetime of
// the database transaction + tables.
clippy::significant_drop_tightening
)]
// Allow some lints in tests.
#![cfg_attr(
test,
allow(
clippy::cognitive_complexity,
clippy::needless_pass_by_value,
clippy::cast_possible_truncation,
clippy::too_many_lines
)
)]
//---------------------------------------------------------------------------------------------------- Public API
// Import private modules, export public types.
//
// Documentation for each module is located in the respective file.
mod backend;
mod constants;
mod database;
mod env;
mod error;
mod key;
mod storable;
mod table;
mod tables;
mod transaction;
pub mod config;
pub mod resize;
pub use backend::ConcreteEnv;
pub use constants::{
DATABASE_BACKEND, DATABASE_CORRUPT_MSG, DATABASE_DATA_FILENAME, DATABASE_LOCK_FILENAME,
};
pub use database::{DatabaseIter, DatabaseRo, DatabaseRw};
pub use env::{Env, EnvInner};
pub use error::{InitError, RuntimeError};
pub use key::{Key, KeyCompare};
pub use storable::{Storable, StorableBytes, StorableStr, StorableVec};
pub use table::Table;
pub use transaction::{TxRo, TxRw};
//---------------------------------------------------------------------------------------------------- Private
#[cfg(test)]
pub(crate) mod tests;
// Used inside public facing macros.
#[doc(hidden)]
pub use paste;
//----------------------------------------------------------------------------------------------------
// HACK: needed to satisfy the `unused_crate_dependencies` lint.
cfg_if::cfg_if! {
if #[cfg(feature = "redb")] {
use redb as _;
} else {
use heed as _;
}
}