Skip to content

Commit 7e2209b

Browse files
committed
renames macros
1 parent 9dfd91a commit 7e2209b

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

ledger/src/blockstore_db.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ const OPTIMISTIC_SLOTS_CF: &str = "optimistic_slots";
102102
/// Column family for merkle roots
103103
const MERKLE_ROOT_META_CF: &str = "merkle_root_meta";
104104

105-
macro_rules! concat_key_bytes {
105+
macro_rules! convert_column_index_to_key_bytes {
106106
($key:ident, $($range:expr => $bytes:expr),* $(,)?) => {{
107107
let mut key = [0u8; std::mem::size_of::<Self::$key>()];
108108
debug_assert_eq!(0 $(+$bytes.len())*, key.len());
@@ -111,7 +111,7 @@ macro_rules! concat_key_bytes {
111111
}};
112112
}
113113

114-
macro_rules! convert_key_bytes {
114+
macro_rules! convert_column_key_bytes_to_index {
115115
($k:ident, $($a:literal..$b:literal => $f:expr),* $(,)?) => {{
116116
($($f(<[u8; $b-$a]>::try_from(&$k[$a..$b]).unwrap())),*)
117117
}};
@@ -852,7 +852,7 @@ impl<T: SlotColumn> Column for T {
852852

853853
/// Converts a RocksDB key to its u64 Index.
854854
fn index(key: &[u8]) -> Self::Index {
855-
convert_key_bytes!(key, 0..8 => Slot::from_be_bytes)
855+
convert_column_key_bytes_to_index!(key, 0..8 => Slot::from_be_bytes)
856856
}
857857

858858
fn slot(index: Self::Index) -> Slot {
@@ -901,7 +901,7 @@ impl Column for columns::TransactionStatus {
901901

902902
#[inline]
903903
fn key((signature, slot): &Self::Index) -> Self::Key {
904-
concat_key_bytes!(Key,
904+
convert_column_index_to_key_bytes!(Key,
905905
..64 => signature.as_ref(),
906906
64.. => &slot.to_be_bytes(),
907907
)
@@ -934,7 +934,7 @@ impl ColumnIndexDeprecation for columns::TransactionStatus {
934934
type DeprecatedKey = [u8; 80];
935935

936936
fn deprecated_key((index, signature, slot): Self::DeprecatedIndex) -> Self::DeprecatedKey {
937-
concat_key_bytes!(DeprecatedKey,
937+
convert_column_index_to_key_bytes!(DeprecatedKey,
938938
..8 => &index.to_be_bytes(),
939939
8..72 => signature.as_ref(),
940940
72.. => &slot.to_be_bytes(),
@@ -945,7 +945,7 @@ impl ColumnIndexDeprecation for columns::TransactionStatus {
945945
if key.len() != std::mem::size_of::<Self::DeprecatedKey>() {
946946
return Err(IndexError::UnpackError);
947947
}
948-
Ok(convert_key_bytes!(key,
948+
Ok(convert_column_key_bytes_to_index!(key,
949949
0..8 => u64::from_be_bytes, // primary index
950950
8..72 => Signature::from,
951951
72..80 => Slot::from_be_bytes,
@@ -956,7 +956,7 @@ impl ColumnIndexDeprecation for columns::TransactionStatus {
956956
if key.len() != Self::CURRENT_INDEX_LEN {
957957
return Err(IndexError::UnpackError);
958958
}
959-
Ok(convert_key_bytes!(key,
959+
Ok(convert_column_key_bytes_to_index!(key,
960960
0..64 => Signature::from,
961961
64..72 => Slot::from_be_bytes,
962962
))
@@ -977,7 +977,7 @@ impl Column for columns::AddressSignatures {
977977

978978
#[inline]
979979
fn key((pubkey, slot, transaction_index, signature): &Self::Index) -> Self::Key {
980-
concat_key_bytes!(Key,
980+
convert_column_index_to_key_bytes!(Key,
981981
..32 => pubkey.as_ref(),
982982
32..40 => &slot.to_be_bytes(),
983983
40..44 => &transaction_index.to_be_bytes(),
@@ -1011,7 +1011,7 @@ impl ColumnIndexDeprecation for columns::AddressSignatures {
10111011
fn deprecated_key(
10121012
(primary_index, pubkey, slot, signature): Self::DeprecatedIndex,
10131013
) -> Self::DeprecatedKey {
1014-
concat_key_bytes!(DeprecatedKey,
1014+
convert_column_index_to_key_bytes!(DeprecatedKey,
10151015
..8 => &primary_index.to_be_bytes(),
10161016
8..40 => pubkey.as_ref(),
10171017
40..48 => &slot.to_be_bytes(),
@@ -1023,7 +1023,7 @@ impl ColumnIndexDeprecation for columns::AddressSignatures {
10231023
if key.len() != std::mem::size_of::<Self::DeprecatedKey>() {
10241024
return Err(IndexError::UnpackError);
10251025
}
1026-
Ok(convert_key_bytes!(key,
1026+
Ok(convert_column_key_bytes_to_index!(key,
10271027
0..8 => u64::from_be_bytes, // primary index
10281028
8..40 => Pubkey::from,
10291029
40..48 => Slot::from_be_bytes,
@@ -1035,7 +1035,7 @@ impl ColumnIndexDeprecation for columns::AddressSignatures {
10351035
if key.len() != Self::CURRENT_INDEX_LEN {
10361036
return Err(IndexError::UnpackError);
10371037
}
1038-
Ok(convert_key_bytes!(key,
1038+
Ok(convert_column_key_bytes_to_index!(key,
10391039
0..32 => Pubkey::from,
10401040
32..40 => Slot::from_be_bytes,
10411041
40..44 => u32::from_be_bytes, // transaction index
@@ -1055,7 +1055,7 @@ impl Column for columns::TransactionMemos {
10551055

10561056
#[inline]
10571057
fn key((signature, slot): &Self::Index) -> Self::Key {
1058-
concat_key_bytes!(Key,
1058+
convert_column_index_to_key_bytes!(Key,
10591059
..64 => signature.as_ref(),
10601060
64.. => &slot.to_be_bytes(),
10611061
)
@@ -1094,7 +1094,7 @@ impl ColumnIndexDeprecation for columns::TransactionMemos {
10941094
if key.len() != Self::CURRENT_INDEX_LEN {
10951095
return Err(IndexError::UnpackError);
10961096
}
1097-
Ok(convert_key_bytes!(key,
1097+
Ok(convert_column_key_bytes_to_index!(key,
10981098
0..64 => Signature::from,
10991099
64..72 => Slot::from_be_bytes,
11001100
))
@@ -1115,7 +1115,7 @@ impl Column for columns::TransactionStatusIndex {
11151115
}
11161116

11171117
fn index(key: &[u8]) -> Self::Index {
1118-
convert_key_bytes!(key, 0..8 => u64::from_be_bytes)
1118+
convert_column_key_bytes_to_index!(key, 0..8 => u64::from_be_bytes)
11191119
}
11201120

11211121
fn slot(_index: Self::Index) -> Slot {
@@ -1175,7 +1175,7 @@ impl Column for columns::ProgramCosts {
11751175
}
11761176

11771177
fn index(key: &[u8]) -> Self::Index {
1178-
convert_key_bytes!(key, 0..32 => Pubkey::from)
1178+
convert_column_key_bytes_to_index!(key, 0..32 => Pubkey::from)
11791179
}
11801180

11811181
fn slot(_index: Self::Index) -> Slot {
@@ -1219,14 +1219,14 @@ impl Column for columns::ShredData {
12191219

12201220
#[inline]
12211221
fn key((slot, index): &Self::Index) -> Self::Key {
1222-
concat_key_bytes!(Key,
1222+
convert_column_index_to_key_bytes!(Key,
12231223
..8 => &slot.to_be_bytes(),
12241224
8.. => &index.to_be_bytes(),
12251225
)
12261226
}
12271227

12281228
fn index(key: &[u8]) -> Self::Index {
1229-
convert_key_bytes!(key,
1229+
convert_column_key_bytes_to_index!(key,
12301230
0..8 => Slot::from_be_bytes,
12311231
8..16 => u64::from_be_bytes, // shred index
12321232
)
@@ -1328,14 +1328,14 @@ impl Column for columns::ErasureMeta {
13281328

13291329
#[inline]
13301330
fn key((slot, fec_set_index): &Self::Index) -> Self::Key {
1331-
concat_key_bytes!(Key,
1331+
convert_column_index_to_key_bytes!(Key,
13321332
..8 => &slot.to_be_bytes(),
13331333
8.. => &fec_set_index.to_be_bytes(),
13341334
)
13351335
}
13361336

13371337
fn index(key: &[u8]) -> Self::Index {
1338-
convert_key_bytes!(key,
1338+
convert_column_key_bytes_to_index!(key,
13391339
0..8 => Slot::from_be_bytes,
13401340
8..16 => u64::from_be_bytes, // fec_set_index
13411341
)
@@ -1370,14 +1370,14 @@ impl Column for columns::MerkleRootMeta {
13701370

13711371
#[inline]
13721372
fn key((slot, fec_set_index): &Self::Index) -> Self::Key {
1373-
concat_key_bytes!(Key,
1373+
convert_column_index_to_key_bytes!(Key,
13741374
..8 => &slot.to_be_bytes(),
13751375
8.. => &fec_set_index.to_be_bytes(),
13761376
)
13771377
}
13781378

13791379
fn index(key: &[u8]) -> Self::Index {
1380-
convert_key_bytes!(key,
1380+
convert_column_key_bytes_to_index!(key,
13811381
0..8 => Slot::from_be_bytes,
13821382
8..12 => u32::from_be_bytes, // fec_set_index
13831383
)

0 commit comments

Comments
 (0)