@@ -4,10 +4,7 @@ use fuel_core_services::{
44 ServiceRunner ,
55 StateWatcher ,
66} ;
7- use std:: {
8- collections:: HashSet ,
9- time:: Duration ,
10- } ;
7+ use std:: time:: Duration ;
118use tokio:: {
129 sync:: broadcast:: Sender ,
1310 time:: {
@@ -16,13 +13,13 @@ use tokio::{
1613 } ,
1714} ;
1815
19- use crate :: v1:: da_source_adapter :: DaBlockCosts ;
16+ use crate :: v1:: da_source_service :: DaBlockCosts ;
2017pub use anyhow:: Result ;
2118
2219#[ derive( Clone ) ]
23- pub struct DaBlockCostsSharedState ( Sender < DaBlockCosts > ) ;
20+ pub struct SharedState ( Sender < DaBlockCosts > ) ;
2421
25- impl DaBlockCostsSharedState {
22+ impl SharedState {
2623 fn new ( sender : Sender < DaBlockCosts > ) -> Self {
2724 Self ( sender)
2825 }
@@ -33,27 +30,27 @@ impl DaBlockCostsSharedState {
3330
3431/// This struct houses the shared_state, polling interval
3532/// and a source, which does the actual fetching of the data
36- pub struct DaBlockCostsService < Source >
33+ pub struct DaSourceService < Source >
3734where
3835 Source : DaBlockCostsSource ,
3936{
4037 poll_interval : Interval ,
4138 source : Source ,
42- shared_state : DaBlockCostsSharedState ,
39+ shared_state : SharedState ,
4340}
4441
4542const DA_BLOCK_COSTS_CHANNEL_SIZE : usize = 10 ;
4643const POLLING_INTERVAL_MS : u64 = 10_000 ;
4744
48- impl < Source > DaBlockCostsService < Source >
45+ impl < Source > DaSourceService < Source >
4946where
5047 Source : DaBlockCostsSource ,
5148{
5249 pub fn new ( source : Source , poll_interval : Option < Duration > ) -> Self {
5350 let ( sender, _) = tokio:: sync:: broadcast:: channel ( DA_BLOCK_COSTS_CHANNEL_SIZE ) ;
5451 #[ allow( clippy:: arithmetic_side_effects) ]
5552 Self {
56- shared_state : DaBlockCostsSharedState :: new ( sender) ,
53+ shared_state : SharedState :: new ( sender) ,
5754 poll_interval : interval (
5855 poll_interval. unwrap_or ( Duration :: from_millis ( POLLING_INTERVAL_MS ) ) ,
5956 ) ,
@@ -70,13 +67,13 @@ pub trait DaBlockCostsSource: Send + Sync {
7067}
7168
7269#[ async_trait:: async_trait]
73- impl < Source > RunnableService for DaBlockCostsService < Source >
70+ impl < Source > RunnableService for DaSourceService < Source >
7471where
7572 Source : DaBlockCostsSource ,
7673{
77- const NAME : & ' static str = "DaBlockCostsService " ;
74+ const NAME : & ' static str = "DaSourceService " ;
7875
79- type SharedData = DaBlockCostsSharedState ;
76+ type SharedData = SharedState ;
8077
8178 type Task = Self ;
8279
9794}
9895
9996#[ async_trait:: async_trait]
100- impl < Source > RunnableTask for DaBlockCostsService < Source >
97+ impl < Source > RunnableTask for DaSourceService < Source >
10198where
10299 Source : DaBlockCostsSource ,
103100{
@@ -130,6 +127,6 @@ where
130127pub fn new_service < S : DaBlockCostsSource > (
131128 da_source : S ,
132129 poll_interval : Option < Duration > ,
133- ) -> ServiceRunner < DaBlockCostsService < S > > {
134- ServiceRunner :: new ( DaBlockCostsService :: new ( da_source, poll_interval) )
130+ ) -> ServiceRunner < DaSourceService < S > > {
131+ ServiceRunner :: new ( DaSourceService :: new ( da_source, poll_interval) )
135132}
0 commit comments