mirror of
https://github.com/Cuprate/cuprate.git
synced 2025-03-12 09:29:11 +00:00
Apply suggestions from code review
Co-authored-by: hinto-janai <hinto.janai@protonmail.com>
This commit is contained in:
parent
d646eac694
commit
161cdbf084
4 changed files with 11 additions and 5 deletions
|
@ -21,10 +21,10 @@ service = ["dep:thread_local", "dep:rayon"]
|
|||
# FIXME:
|
||||
# We only need the `thread` feature if `service` is enabled.
|
||||
# Figure out how to enable features of an already pulled in dependency conditionally.
|
||||
cuprate-database = { path = "../database" }
|
||||
cuprate-database = { path = "../database" }
|
||||
cuprate-database-service = { path = "../service" }
|
||||
cuprate-helper = { path = "../../helper", features = ["fs", "thread", "map"] }
|
||||
cuprate-types = { path = "../../types", features = ["blockchain"] }
|
||||
cuprate-helper = { path = "../../helper", features = ["fs", "thread", "map"] }
|
||||
cuprate-types = { path = "../../types", features = ["blockchain"] }
|
||||
|
||||
bitflags = { workspace = true, features = ["serde", "bytemuck"] }
|
||||
bytemuck = { version = "1.14.3", features = ["must_cast", "derive", "min_const_generics", "extern_crate_alloc"] }
|
||||
|
|
|
@ -11,6 +11,7 @@ use cuprate_helper::fs::cuprate_blockchain_dir;
|
|||
|
||||
// re-exports
|
||||
pub use cuprate_database_service::ReaderThreads;
|
||||
|
||||
//---------------------------------------------------------------------------------------------------- ConfigBuilder
|
||||
/// Builder for [`Config`].
|
||||
///
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#![doc = include_str!("../README.md")]
|
||||
|
||||
mod reader_threads;
|
||||
mod service;
|
||||
|
||||
|
|
|
@ -12,7 +12,10 @@ use cuprate_helper::asynch::InfallibleOneshotReceiver;
|
|||
|
||||
/// The [`rayon::ThreadPool`] service.
|
||||
///
|
||||
/// Uses an inner request handler and a rayon thread-pool to asynchronously handler requests.
|
||||
/// Uses an inner request handler and a rayon thread-pool to asynchronously handle requests.
|
||||
///
|
||||
/// - `Req` is the request type
|
||||
/// - `Res` is the response type
|
||||
pub struct DatabaseReadService<Req, Res> {
|
||||
/// Handle to the custom `rayon` DB reader thread-pool.
|
||||
///
|
||||
|
@ -24,7 +27,7 @@ pub struct DatabaseReadService<Req, Res> {
|
|||
inner_handler: Arc<dyn Fn(Req) -> Result<Res, RuntimeError> + Send + Sync + 'static>,
|
||||
}
|
||||
|
||||
// deriving clone means Req & Res needs to be clone, when they don't.
|
||||
// Deriving [`Clone`] means `Req` & `Res` need to be `Clone`, even if they aren't.
|
||||
impl<Req, Res> Clone for DatabaseReadService<Req, Res> {
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
|
|
Loading…
Reference in a new issue