@@ -952,7 +952,7 @@ where
952
952
providers,
953
953
closest_peers : Default :: default ( ) ,
954
954
} ) ) ,
955
- index : Index {
955
+ step : ProgressStep {
956
956
count : 1 ,
957
957
last : false ,
958
958
} ,
@@ -1272,7 +1272,7 @@ where
1272
1272
peer,
1273
1273
num_remaining,
1274
1274
} ) ) ,
1275
- index : Index {
1275
+ step : ProgressStep {
1276
1276
count : 1 ,
1277
1277
last : true ,
1278
1278
} ,
@@ -1287,7 +1287,7 @@ where
1287
1287
key,
1288
1288
peers : result. peers . collect ( ) ,
1289
1289
} ) ) ,
1290
- index : Index {
1290
+ step : ProgressStep {
1291
1291
count : 1 ,
1292
1292
last : true ,
1293
1293
} ,
@@ -1309,7 +1309,7 @@ where
1309
1309
providers_so_far : providers_found,
1310
1310
closest_peers : result. peers . collect ( ) ,
1311
1311
} ) ) ,
1312
- index : Index {
1312
+ step : ProgressStep {
1313
1313
count, // FIXME: count?
1314
1314
last : true ,
1315
1315
} ,
@@ -1349,13 +1349,13 @@ where
1349
1349
id : query_id,
1350
1350
stats : get_closest_peers_stats. merge ( result. stats ) ,
1351
1351
result : QueryResult :: StartProviding ( Ok ( AddProviderOk { key } ) ) ,
1352
- index : Index :: single ( ) ,
1352
+ step : ProgressStep :: single ( ) ,
1353
1353
} ) ,
1354
1354
AddProviderContext :: Republish => Some ( KademliaEvent :: OutboundQueryProgressed {
1355
1355
id : query_id,
1356
1356
stats : get_closest_peers_stats. merge ( result. stats ) ,
1357
1357
result : QueryResult :: RepublishProvider ( Ok ( AddProviderOk { key } ) ) ,
1358
- index : Index :: single ( ) ,
1358
+ step : ProgressStep :: single ( ) ,
1359
1359
} ) ,
1360
1360
} ,
1361
1361
@@ -1406,7 +1406,7 @@ where
1406
1406
id : query_id,
1407
1407
stats : result. stats ,
1408
1408
result : QueryResult :: GetRecord ( results) ,
1409
- index : Index :: single ( ) ,
1409
+ step : ProgressStep :: single ( ) ,
1410
1410
} )
1411
1411
}
1412
1412
@@ -1457,14 +1457,14 @@ where
1457
1457
id : query_id,
1458
1458
stats : get_closest_peers_stats. merge ( result. stats ) ,
1459
1459
result : QueryResult :: PutRecord ( mk_result ( record. key ) ) ,
1460
- index : Index :: single ( ) ,
1460
+ step : ProgressStep :: single ( ) ,
1461
1461
} )
1462
1462
}
1463
1463
PutRecordContext :: Republish => Some ( KademliaEvent :: OutboundQueryProgressed {
1464
1464
id : query_id,
1465
1465
stats : get_closest_peers_stats. merge ( result. stats ) ,
1466
1466
result : QueryResult :: RepublishRecord ( mk_result ( record. key ) ) ,
1467
- index : Index :: single ( ) ,
1467
+ step : ProgressStep :: single ( ) ,
1468
1468
} ) ,
1469
1469
PutRecordContext :: Replicate => {
1470
1470
debug ! ( "Record replicated: {:?}" , record. key) ;
@@ -1512,7 +1512,7 @@ where
1512
1512
peer,
1513
1513
num_remaining,
1514
1514
} ) ) ,
1515
- index : Index :: single ( ) ,
1515
+ step : ProgressStep :: single ( ) ,
1516
1516
} )
1517
1517
}
1518
1518
@@ -1521,13 +1521,13 @@ where
1521
1521
id : query_id,
1522
1522
stats : result. stats ,
1523
1523
result : QueryResult :: StartProviding ( Err ( AddProviderError :: Timeout { key } ) ) ,
1524
- index : Index :: single ( ) ,
1524
+ step : ProgressStep :: single ( ) ,
1525
1525
} ,
1526
1526
AddProviderContext :: Republish => KademliaEvent :: OutboundQueryProgressed {
1527
1527
id : query_id,
1528
1528
stats : result. stats ,
1529
1529
result : QueryResult :: RepublishProvider ( Err ( AddProviderError :: Timeout { key } ) ) ,
1530
- index : Index :: single ( ) ,
1530
+ step : ProgressStep :: single ( ) ,
1531
1531
} ,
1532
1532
} ) ,
1533
1533
@@ -1538,7 +1538,7 @@ where
1538
1538
key,
1539
1539
peers : result. peers . collect ( ) ,
1540
1540
} ) ) ,
1541
- index : Index :: single ( ) ,
1541
+ step : ProgressStep :: single ( ) ,
1542
1542
} ) ,
1543
1543
1544
1544
QueryInfo :: PutRecord {
@@ -1561,14 +1561,14 @@ where
1561
1561
id : query_id,
1562
1562
stats : result. stats ,
1563
1563
result : QueryResult :: PutRecord ( err) ,
1564
- index : Index :: single ( ) ,
1564
+ step : ProgressStep :: single ( ) ,
1565
1565
} )
1566
1566
}
1567
1567
PutRecordContext :: Republish => Some ( KademliaEvent :: OutboundQueryProgressed {
1568
1568
id : query_id,
1569
1569
stats : result. stats ,
1570
1570
result : QueryResult :: RepublishRecord ( err) ,
1571
- index : Index :: single ( ) ,
1571
+ step : ProgressStep :: single ( ) ,
1572
1572
} ) ,
1573
1573
PutRecordContext :: Replicate => match phase {
1574
1574
PutRecordPhase :: GetClosestPeers => {
@@ -1608,7 +1608,7 @@ where
1608
1608
records,
1609
1609
quorum,
1610
1610
} ) ) ,
1611
- index : Index :: single ( ) ,
1611
+ step : ProgressStep :: single ( ) ,
1612
1612
} ) ,
1613
1613
1614
1614
QueryInfo :: GetProviders { key, .. } => Some ( KademliaEvent :: OutboundQueryProgressed {
@@ -1618,7 +1618,7 @@ where
1618
1618
key,
1619
1619
closest_peers : result. peers . collect ( ) ,
1620
1620
} ) ) ,
1621
- index : Index :: single ( ) ,
1621
+ step : ProgressStep :: single ( ) ,
1622
1622
} ) ,
1623
1623
}
1624
1624
}
@@ -2136,7 +2136,7 @@ where
2136
2136
providers_so_far : * providers_found,
2137
2137
closest_peers,
2138
2138
} ) ) ,
2139
- index : Index {
2139
+ step : ProgressStep {
2140
2140
count : * count,
2141
2141
last : false ,
2142
2142
} ,
@@ -2494,16 +2494,16 @@ pub enum KademliaEvent {
2494
2494
// is made of multiple requests across multiple remote peers.
2495
2495
InboundRequest { request : InboundRequest } ,
2496
2496
2497
- /// An outbound query has finished .
2497
+ /// An outbound query has made progress .
2498
2498
OutboundQueryProgressed {
2499
2499
/// The ID of the query that finished.
2500
2500
id : QueryId ,
2501
- /// The optional final result of the query.
2501
+ /// The intermediate result of the query.
2502
2502
result : QueryResult ,
2503
2503
/// Execution statistics from the query.
2504
2504
stats : QueryStats ,
2505
- /// Indicates which event this is, if therer are multiple responses for a single request .
2506
- index : Index ,
2505
+ /// Indicates which event this is, if therer are multiple responses for a single query .
2506
+ step : ProgressStep ,
2507
2507
} ,
2508
2508
2509
2509
/// The routing table has been updated with a new peer and / or
@@ -2559,14 +2559,14 @@ pub enum KademliaEvent {
2559
2559
2560
2560
/// Information about progress events.
2561
2561
#[ derive( Debug , Clone ) ]
2562
- pub struct Index {
2562
+ pub struct ProgressStep {
2563
2563
/// The index into the event
2564
2564
pub count : usize ,
2565
2565
/// Is this the final event?
2566
2566
pub last : bool ,
2567
2567
}
2568
2568
2569
- impl Index {
2569
+ impl ProgressStep {
2570
2570
/// Generates an index for the case only a single event is emitted.
2571
2571
pub ( crate ) fn single ( ) -> Self {
2572
2572
Self {
0 commit comments