rename flag

This commit is contained in:
Carl 2019-02-12 14:45:16 -08:00 committed by Grimes
parent 3c8a8640aa
commit b33becabca
3 changed files with 8 additions and 8 deletions

View File

@ -91,7 +91,7 @@ impl Broadcast {
inc_new_counter_info!("streamer-broadcast-sent", blobs.len());
if contains_last_tick {
blobs.last().unwrap().write().unwrap().set_is_last_blob();
blobs.last().unwrap().write().unwrap().set_is_last_in_slot();
}
blocktree.write_shared_blobs(&blobs)?;

View File

@ -292,7 +292,7 @@ macro_rules! align {
pub const BLOB_HEADER_SIZE: usize = align!(SIZE_RANGE.end, 8);
pub const BLOB_FLAG_IS_LAST: u32 = 0x2;
pub const BLOB_FLAG_IS_LAST_IN_SLOT: u32 = 0x2;
pub const BLOB_FLAG_IS_CODING: u32 = 0x1;
@ -352,13 +352,13 @@ impl Blob {
self.set_flags(flags | BLOB_FLAG_IS_CODING);
}
pub fn set_is_last_blob(&mut self) {
pub fn set_is_last_in_slot(&mut self) {
let flags = self.flags();
self.set_flags(flags | BLOB_FLAG_IS_LAST);
self.set_flags(flags | BLOB_FLAG_IS_LAST_IN_SLOT);
}
pub fn is_last_blob(&self) -> bool {
(self.flags() & BLOB_FLAG_IS_LAST) != 0
pub fn is_last_in_slot(&self) -> bool {
(self.flags() & BLOB_FLAG_IS_LAST_IN_SLOT) != 0
}
pub fn data_size(&self) -> u64 {

View File

@ -1657,14 +1657,14 @@ fn test_broadcast_last_tick() {
for b in blobs {
let b_r = b.read().unwrap();
if b_r.index() == last_tick_entry_index as u64 {
assert!(b_r.is_last_blob());
assert!(b_r.is_last_in_slot());
debug!("last_tick_blob: {:?}", b_r);
let actual_last_tick = &reconstruct_entries_from_blobs(vec![&*b_r])
.expect("Expected to be able to reconstruct entries from blob")
.0[0];
assert_eq!(actual_last_tick, expected_last_tick);
} else {
assert!(!b_r.is_last_blob());
assert!(!b_r.is_last_in_slot());
}
}
}