mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: make StaticFileProvider generic over NodePrimitives (#12565)
This commit is contained in:
@ -495,7 +495,7 @@ where
|
||||
}
|
||||
|
||||
/// Returns the static file provider to interact with the static files.
|
||||
pub fn static_file_provider(&self) -> StaticFileProvider {
|
||||
pub fn static_file_provider(&self) -> StaticFileProvider<T::Primitives> {
|
||||
self.right().static_file_provider()
|
||||
}
|
||||
|
||||
@ -766,7 +766,7 @@ where
|
||||
}
|
||||
|
||||
/// Returns the static file provider to interact with the static files.
|
||||
pub fn static_file_provider(&self) -> StaticFileProvider {
|
||||
pub fn static_file_provider(&self) -> StaticFileProvider<<T::Types as NodeTypes>::Primitives> {
|
||||
self.provider_factory().static_file_provider()
|
||||
}
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ repository.workspace = true
|
||||
|
||||
[dependencies]
|
||||
reth-db-api.workspace = true
|
||||
reth-primitives-traits.workspace = true
|
||||
reth-provider.workspace = true
|
||||
reth-metrics.workspace = true
|
||||
reth-tasks.workspace = true
|
||||
|
||||
@ -1,7 +1,12 @@
|
||||
use metrics_process::Collector;
|
||||
use reth_db_api::database_metrics::DatabaseMetrics;
|
||||
use reth_primitives_traits::NodePrimitives;
|
||||
use reth_provider::providers::StaticFileProvider;
|
||||
use std::{fmt, sync::Arc};
|
||||
use std::{
|
||||
fmt::{self},
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
pub(crate) trait Hook: Fn() + Send + Sync {}
|
||||
impl<T: Fn() + Send + Sync> Hook for T {}
|
||||
|
||||
@ -22,10 +27,11 @@ pub struct Hooks {
|
||||
|
||||
impl Hooks {
|
||||
/// Create a new set of hooks
|
||||
pub fn new<Metrics: DatabaseMetrics + 'static + Send + Sync>(
|
||||
db: Metrics,
|
||||
static_file_provider: StaticFileProvider,
|
||||
) -> Self {
|
||||
pub fn new<Metrics, N>(db: Metrics, static_file_provider: StaticFileProvider<N>) -> Self
|
||||
where
|
||||
Metrics: DatabaseMetrics + 'static + Send + Sync,
|
||||
N: NodePrimitives,
|
||||
{
|
||||
let hooks: Vec<Box<dyn Hook<Output = ()>>> = vec![
|
||||
Box::new(move || db.report_metrics()),
|
||||
Box::new(move || {
|
||||
|
||||
Reference in New Issue
Block a user