@@ -81,33 +81,50 @@ impl<D: crate::store::Store> Blobs<D> {
8181 where
8282 C : ChannelTypes < RpcService > ,
8383 {
84- use Request :: * ;
85- let handler = Handler ( self ) ;
86- match msg {
87- Blobs ( msg) => handler. handle_blobs_request ( msg, chan) . await ,
88- Tags ( msg) => handler. handle_tags_request ( msg, chan) . await ,
89- }
84+ Handler {
85+ blobs : self . clone ( ) ,
86+ store : self . store . clone ( ) ,
87+ } . handle_rpc_request ( msg, chan) . await
9088 }
9189}
9290
9391#[ derive( Clone ) ]
94- struct Handler < S > ( Arc < Blobs < S > > ) ;
92+ struct Handler < S > {
93+ blobs : Arc < Blobs < S > > ,
94+ store : S ,
95+ }
9596
9697impl < S > Deref for Handler < S > {
9798 type Target = Blobs < S > ;
9899
99100 fn deref ( & self ) -> & Self :: Target {
100- & self . 0
101+ & self . blobs
101102 }
102103}
103104
104105impl < D : crate :: store:: Store > Handler < D > {
105106 fn store ( & self ) -> & D {
106- & self . 0 . store
107+ & self . store
108+ }
109+
110+ /// Handle an RPC request
111+ pub async fn handle_rpc_request < C > (
112+ self ,
113+ msg : Request ,
114+ chan : RpcChannel < RpcService , C > ,
115+ ) -> std:: result:: Result < ( ) , RpcServerError < C > >
116+ where
117+ C : ChannelTypes < RpcService > ,
118+ {
119+ use Request :: * ;
120+ match msg {
121+ Blobs ( msg) => self . handle_blobs_request ( msg, chan) . await ,
122+ Tags ( msg) => self . handle_tags_request ( msg, chan) . await ,
123+ }
107124 }
108125
109126 /// Handle a tags request
110- pub async fn handle_tags_request < C > (
127+ async fn handle_tags_request < C > (
111128 self ,
112129 msg : proto:: tags:: Request ,
113130 chan : RpcChannel < proto:: RpcService , C > ,
@@ -125,7 +142,7 @@ impl<D: crate::store::Store> Handler<D> {
125142 }
126143
127144 /// Handle a blobs request
128- pub async fn handle_blobs_request < C > (
145+ async fn handle_blobs_request < C > (
129146 self ,
130147 msg : proto:: blobs:: Request ,
131148 chan : RpcChannel < proto:: RpcService , C > ,
0 commit comments