From b99ff04b7b689199f072716496e79c29a15a982c Mon Sep 17 00:00:00 2001 From: Brooks Date: Thu, 13 Jul 2023 01:45:19 -0400 Subject: [PATCH] Removes default impls on TieredAccountMeta (#32464) #### Problem `TieredAccountMeta` has default impls on many of its methods. But I don't think it should, because these defaults are not actually useful defaults (i.e. they are `unimplemented!()`). We're only going to have a small number of structs that'll implement this trait, and each struct should be responsible for picking the correct impl for each method. Currently, `HotAccountMeta` is the only one, and it implements every method. #### Summary of Changes Remove default impls on TieredAccountMeta --- runtime/src/tiered_storage/meta.rs | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/runtime/src/tiered_storage/meta.rs b/runtime/src/tiered_storage/meta.rs index 34533edc62..15a4d7aefb 100644 --- a/runtime/src/tiered_storage/meta.rs +++ b/runtime/src/tiered_storage/meta.rs @@ -64,39 +64,27 @@ pub trait TieredAccountMeta: Sized { /// Returns the epoch that this account will next owe rent by parsing /// the specified account block. None will be returned if this account /// does not persist this optional field. - fn rent_epoch(&self, _account_block: &[u8]) -> Option { - None - } + fn rent_epoch(&self, _account_block: &[u8]) -> Option; /// Returns the account hash by parsing the specified account block. None /// will be returned if this account does not persist this optional field. - fn account_hash<'a>(&self, _account_block: &'a [u8]) -> Option<&'a Hash> { - None - } + fn account_hash<'a>(&self, _account_block: &'a [u8]) -> Option<&'a Hash>; /// Returns the write version by parsing the specified account block. None /// will be returned if this account does not persist this optional field. - fn write_version(&self, _account_block: &[u8]) -> Option { - None - } + fn write_version(&self, _account_block: &[u8]) -> Option; /// Returns the offset of the optional fields based on the specified account /// block. - fn optional_fields_offset(&self, _account_block: &[u8]) -> usize { - unimplemented!(); - } + fn optional_fields_offset(&self, _account_block: &[u8]) -> usize; /// Returns the length of the data associated to this account based on the /// specified account block. - fn account_data_size(&self, _account_block: &[u8]) -> usize { - unimplemented!(); - } + fn account_data_size(&self, _account_block: &[u8]) -> usize; /// Returns the data associated to this account based on the specified /// account block. - fn account_data<'a>(&self, _account_block: &'a [u8]) -> &'a [u8] { - unimplemented!(); - } + fn account_data<'a>(&self, _account_block: &'a [u8]) -> &'a [u8]; } impl AccountMetaFlags {