@@ -2,17 +2,28 @@ use apollo_committer_types::communication::{CommitterRequest, CommitterResponse}
22use apollo_infra:: component_definitions:: ComponentRequestHandler ;
33use apollo_infra:: component_server:: { LocalComponentServer , RemoteComponentServer } ;
44use async_trait:: async_trait;
5- use starknet_committer:: db:: forest_trait:: ForestStorageWithEmptyReadContext ;
5+ #[ cfg( feature = "os_input" ) ]
6+ use starknet_committer:: db:: forest_trait:: ForestStorageWithWitnesses ;
7+ #[ cfg( not( feature = "os_input" ) ) ]
8+ use starknet_committer:: db:: forest_trait:: {
9+ ForestStorageWithEmptyReadContext ,
10+ ForestWriterWithMetadataAndWitnesses ,
11+ } ;
12+ #[ cfg( feature = "os_input" ) ]
13+ use starknet_patricia_storage:: storage_trait:: ImmutableReadOnlyStorage ;
614
715use crate :: committer:: { ApolloCommitter , Committer , StorageConstructor } ;
816
917pub type LocalCommitterServer =
1018 LocalComponentServer < ApolloCommitter , CommitterRequest , CommitterResponse > ;
1119pub type RemoteCommitterServer = RemoteComponentServer < CommitterRequest , CommitterResponse > ;
1220
21+ #[ cfg( not( feature = "os_input" ) ) ]
1322#[ async_trait]
14- impl < S : StorageConstructor , ForestDB : ForestStorageWithEmptyReadContext < Storage = S > >
15- ComponentRequestHandler < CommitterRequest , CommitterResponse > for Committer < S , ForestDB >
23+ impl < S : StorageConstructor , ForestDB > ComponentRequestHandler < CommitterRequest , CommitterResponse >
24+ for Committer < S , ForestDB >
25+ where
26+ ForestDB : ForestStorageWithEmptyReadContext < Storage = S > + ForestWriterWithMetadataAndWitnesses ,
1627{
1728 async fn handle_request ( & mut self , request : CommitterRequest ) -> CommitterResponse {
1829 match request {
@@ -25,3 +36,28 @@ impl<S: StorageConstructor, ForestDB: ForestStorageWithEmptyReadContext<Storage
2536 }
2637 }
2738}
39+
40+ #[ cfg( feature = "os_input" ) ]
41+ #[ async_trait]
42+ impl < S , ForestDB > ComponentRequestHandler < CommitterRequest , CommitterResponse >
43+ for Committer < S , ForestDB >
44+ where
45+ S : StorageConstructor + ImmutableReadOnlyStorage + ' static ,
46+ ForestDB : ForestStorageWithWitnesses < Storage = S > ,
47+ {
48+ async fn handle_request ( & mut self , request : CommitterRequest ) -> CommitterResponse {
49+ match request {
50+ CommitterRequest :: CommitBlock ( commit_block_request) => {
51+ CommitterResponse :: CommitBlock ( self . commit_block ( commit_block_request) . await )
52+ }
53+ CommitterRequest :: RevertBlock ( revert_block_request) => {
54+ CommitterResponse :: RevertBlock ( self . revert_block ( revert_block_request) . await )
55+ }
56+ CommitterRequest :: ReadPathsAndCommitBlock ( req) => {
57+ CommitterResponse :: ReadPathsAndCommitBlock (
58+ self . read_paths_and_commit_block ( req) . await ,
59+ )
60+ }
61+ }
62+ }
63+ }
0 commit comments