@@ -25,9 +25,9 @@ enum Completion {
2525 height : u64 ,
2626 digest : Digest ,
2727 } ,
28- /// The queue entry became redundant because the live certificate path
28+ /// The queue entry was skipped because the live certificate path
2929 /// uploaded the block first.
30- Retired { position : u64 , height : u64 } ,
30+ Skipped { position : u64 , height : u64 } ,
3131}
3232
3333pub struct Consumer < E : Spawner + Clock + Storage + Metrics , C : Client > {
@@ -146,11 +146,8 @@ impl<E: Spawner + Clock + Storage + Metrics, C: Client> Consumer<E, C> {
146146
147147 async fn start_upload ( & mut self , position : u64 , entry : Entry ) {
148148 let Entry { height, digest } = entry;
149- if matches ! (
150- self . uploads. lock( ) . upload_decision( & digest) ,
151- Decision :: Retire
152- ) {
153- self . complete ( Completion :: Retired { position, height } )
149+ if matches ! ( self . uploads. lock( ) . should_upload( & digest) , Decision :: Skip ) {
150+ self . complete ( Completion :: Skipped { position, height } )
154151 . await ;
155152 debug ! ( ?digest, "consumer skipping already-uploaded block" ) ;
156153 return ;
@@ -171,20 +168,20 @@ impl<E: Spawner + Clock + Storage + Metrics, C: Client> Consumer<E, C> {
171168 . await
172169 else {
173170 debug ! ( ?digest, "consumer observed live upload before block upload" ) ;
174- return Completion :: Retired { position, height } ;
171+ return Completion :: Skipped { position, height } ;
175172 } ;
176173
177174 loop {
178175 // A live notarization/finalization upload may complete while this
179176 // queue item is waiting for its block or retrying after failures.
180177 let decision = {
181178 let uploads = uploads. lock ( ) ;
182- uploads. upload_decision ( & digest)
179+ uploads. should_upload ( & digest)
183180 } ;
184181 match decision {
185- Decision :: Retire => {
182+ Decision :: Skip => {
186183 debug ! ( ?digest, "consumer observed live upload before block upload" ) ;
187- return Completion :: Retired { position, height } ;
184+ return Completion :: Skipped { position, height } ;
188185 }
189186 Decision :: Wait => {
190187 context. sleep ( retry) . await ;
@@ -238,8 +235,8 @@ impl<E: Spawner + Clock + Storage + Metrics, C: Client> Consumer<E, C> {
238235 loop {
239236 let next = {
240237 let uploads = uploads. lock ( ) ;
241- match uploads. upload_decision ( & digest) {
242- Decision :: Retire => NextBlock :: AlreadyUploaded ,
238+ match uploads. should_upload ( & digest) {
239+ Decision :: Skip => NextBlock :: AlreadyUploaded ,
243240 Decision :: Wait => NextBlock :: WaitForCertificate ,
244241 Decision :: Proceed => {
245242 if let Some ( block) = uploads. cached_block ( & digest) {
@@ -284,7 +281,7 @@ impl<E: Spawner + Clock + Storage + Metrics, C: Client> Consumer<E, C> {
284281 self . uploads . lock ( ) . mark_uploaded ( digest, height) ;
285282 ( position, height)
286283 }
287- Completion :: Retired { position, height } => ( position, height) ,
284+ Completion :: Skipped { position, height } => ( position, height) ,
288285 } ;
289286
290287 let floor = self . reader . ack_floor ( ) . await ;
0 commit comments