enable unreachable_pub lint

This causes some other lints to start firing too (which is good), but
I'm going to fix them in follow-up commits to keep things organized.
This commit is contained in:
Charles Hall 2024-05-01 22:26:21 -07:00
parent a626e7b0f0
commit d748544f0e
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
111 changed files with 1007 additions and 876 deletions

View file

@ -4,15 +4,15 @@ use crate::Result;
use std::{future::Future, pin::Pin, sync::Arc};
#[cfg(feature = "sqlite")]
pub mod sqlite;
pub(crate) mod sqlite;
#[cfg(feature = "rocksdb")]
pub mod rocksdb;
pub(crate) mod rocksdb;
#[cfg(any(feature = "sqlite", feature = "rocksdb",))]
pub mod watchers;
pub(crate) mod watchers;
pub trait KeyValueDatabaseEngine: Send + Sync {
pub(crate) trait KeyValueDatabaseEngine: Send + Sync {
fn open(config: &Config) -> Result<Self>
where
Self: Sized;
@ -27,7 +27,7 @@ pub trait KeyValueDatabaseEngine: Send + Sync {
fn clear_caches(&self) {}
}
pub trait KvTree: Send + Sync {
pub(crate) trait KvTree: Send + Sync {
fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>>;
fn insert(&self, key: &[u8], value: &[u8]) -> Result<()>;

View file

@ -6,14 +6,14 @@ use std::{
sync::{Arc, RwLock},
};
pub struct Engine {
pub(crate) struct Engine {
rocks: rocksdb::DBWithThreadMode<rocksdb::MultiThreaded>,
max_open_files: i32,
cache: rocksdb::Cache,
old_cfs: Vec<String>,
}
pub struct RocksDbEngineTree<'a> {
pub(crate) struct RocksDbEngineTree<'a> {
db: Arc<Engine>,
name: &'a str,
watchers: Watchers,

View file

@ -18,8 +18,8 @@ thread_local! {
}
struct PreparedStatementIterator<'a> {
pub iterator: Box<dyn Iterator<Item = TupleOfBytes> + 'a>,
pub _statement_ref: NonAliasingBox<rusqlite::Statement<'a>>,
pub(crate) iterator: Box<dyn Iterator<Item = TupleOfBytes> + 'a>,
pub(crate) _statement_ref: NonAliasingBox<rusqlite::Statement<'a>>,
}
impl Iterator for PreparedStatementIterator<'_> {
@ -37,7 +37,7 @@ impl<T> Drop for NonAliasingBox<T> {
}
}
pub struct Engine {
pub(crate) struct Engine {
writer: Mutex<Connection>,
read_conn_tls: ThreadLocal<Connection>,
read_iterator_conn_tls: ThreadLocal<Connection>,
@ -73,7 +73,7 @@ impl Engine {
.get_or(|| Self::prepare_conn(&self.path, self.cache_size_per_thread).unwrap())
}
pub fn flush_wal(self: &Arc<Self>) -> Result<()> {
pub(crate) fn flush_wal(self: &Arc<Self>) -> Result<()> {
self.write_lock()
.pragma_update(Some(Main), "wal_checkpoint", "RESTART")?;
Ok(())
@ -125,7 +125,7 @@ impl KeyValueDatabaseEngine for Arc<Engine> {
}
}
pub struct SqliteTable {
pub(crate) struct SqliteTable {
engine: Arc<Engine>,
name: String,
watchers: Watchers,
@ -153,7 +153,7 @@ impl SqliteTable {
Ok(())
}
pub fn iter_with_guard<'a>(
pub(crate) fn iter_with_guard<'a>(
&'a self,
guard: &'a Connection,
) -> Box<dyn Iterator<Item = TupleOfBytes> + 'a> {

View file

@ -11,7 +11,7 @@ use ruma::{
use crate::{database::KeyValueDatabase, service, services, utils, Error, Result};
pub const COUNTER: &[u8] = b"c";
pub(crate) const COUNTER: &[u8] = b"c";
#[async_trait]
impl service::globals::Data for KeyValueDatabase {