@@ -86,11 +86,10 @@ static size_t sizeofTimeoutNow(void)
86
86
sizeof (uint64_t ) /* Last log term. */ ;
87
87
}
88
88
89
- size_t uvSizeofBatchHeader (size_t n , bool with_local_data )
89
+ size_t uvSizeofBatchHeader (size_t n )
90
90
{
91
91
size_t res = 8 + /* Number of entries in the batch, little endian */
92
92
16 * n ; /* One header per entry */ ;
93
- (void )with_local_data ;
94
93
return res ;
95
94
}
96
95
@@ -139,7 +138,7 @@ static void encodeAppendEntries(const struct raft_append_entries *p, void *buf)
139
138
bytePut64 (& cursor , p -> prev_log_term ); /* Previous term. */
140
139
bytePut64 (& cursor , p -> leader_commit ); /* Commit index. */
141
140
142
- uvEncodeBatchHeader (p -> entries , p -> n_entries , cursor , false /* no local data */ );
141
+ uvEncodeBatchHeader (p -> entries , p -> n_entries , cursor );
143
142
}
144
143
145
144
static void encodeAppendEntriesResult (
@@ -297,17 +296,14 @@ int uvEncodeMessage(const struct raft_message *message,
297
296
298
297
void uvEncodeBatchHeader (const struct raft_entry * entries ,
299
298
unsigned n ,
300
- void * buf ,
301
- bool with_local_data )
299
+ void * buf )
302
300
{
303
301
unsigned i ;
304
302
void * cursor = buf ;
305
303
306
304
/* Number of entries in the batch, little endian */
307
305
bytePut64 (& cursor , n );
308
306
309
- (void )with_local_data ;
310
-
311
307
for (i = 0 ; i < n ; i ++ ) {
312
308
const struct raft_entry * entry = & entries [i ];
313
309
@@ -368,8 +364,7 @@ static void decodeRequestVoteResult(const uv_buf_t *buf,
368
364
369
365
int uvDecodeBatchHeader (const void * batch ,
370
366
struct raft_entry * * entries ,
371
- unsigned * n ,
372
- uint64_t * local_data_size )
367
+ unsigned * n )
373
368
{
374
369
const void * cursor = batch ;
375
370
size_t i ;
@@ -382,8 +377,6 @@ int uvDecodeBatchHeader(const void *batch,
382
377
return 0 ;
383
378
}
384
379
385
- (void )local_data_size ;
386
-
387
380
* entries = raft_malloc (* n * sizeof * * entries );
388
381
389
382
if (* entries == NULL ) {
@@ -438,7 +431,7 @@ static int decodeAppendEntries(const uv_buf_t *buf,
438
431
args -> prev_log_term = byteGet64 (& cursor );
439
432
args -> leader_commit = byteGet64 (& cursor );
440
433
441
- rv = uvDecodeBatchHeader (cursor , & args -> entries , & args -> n_entries , false );
434
+ rv = uvDecodeBatchHeader (cursor , & args -> entries , & args -> n_entries );
442
435
if (rv != 0 ) {
443
436
return rv ;
444
437
}
@@ -560,8 +553,7 @@ int uvDecodeMessage(uint16_t type,
560
553
int uvDecodeEntriesBatch (uint8_t * batch ,
561
554
size_t offset ,
562
555
struct raft_entry * entries ,
563
- unsigned n ,
564
- uint64_t local_data_size )
556
+ unsigned n )
565
557
{
566
558
uint8_t * cursor ;
567
559
@@ -581,10 +573,6 @@ int uvDecodeEntriesBatch(uint8_t *batch,
581
573
}
582
574
583
575
entry -> is_local = false;
584
-
585
- entry -> local_data = (struct raft_entry_local_data ){};
586
- assert (local_data_size <= sizeof (entry -> local_data .buf ));
587
- assert (local_data_size % 8 == 0 );
588
576
}
589
577
return 0 ;
590
578
}
0 commit comments