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
This commit is contained in:
parent
e6f5f8777a
commit
b99ff04b7b
|
@ -64,39 +64,27 @@ pub trait TieredAccountMeta: Sized {
|
||||||
/// Returns the epoch that this account will next owe rent by parsing
|
/// Returns the epoch that this account will next owe rent by parsing
|
||||||
/// the specified account block. None will be returned if this account
|
/// the specified account block. None will be returned if this account
|
||||||
/// does not persist this optional field.
|
/// does not persist this optional field.
|
||||||
fn rent_epoch(&self, _account_block: &[u8]) -> Option<Epoch> {
|
fn rent_epoch(&self, _account_block: &[u8]) -> Option<Epoch>;
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the account hash by parsing the specified account block. None
|
/// Returns the account hash by parsing the specified account block. None
|
||||||
/// will be returned if this account does not persist this optional field.
|
/// will be returned if this account does not persist this optional field.
|
||||||
fn account_hash<'a>(&self, _account_block: &'a [u8]) -> Option<&'a Hash> {
|
fn account_hash<'a>(&self, _account_block: &'a [u8]) -> Option<&'a Hash>;
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the write version by parsing the specified account block. None
|
/// Returns the write version by parsing the specified account block. None
|
||||||
/// will be returned if this account does not persist this optional field.
|
/// will be returned if this account does not persist this optional field.
|
||||||
fn write_version(&self, _account_block: &[u8]) -> Option<StoredMetaWriteVersion> {
|
fn write_version(&self, _account_block: &[u8]) -> Option<StoredMetaWriteVersion>;
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the offset of the optional fields based on the specified account
|
/// Returns the offset of the optional fields based on the specified account
|
||||||
/// block.
|
/// block.
|
||||||
fn optional_fields_offset(&self, _account_block: &[u8]) -> usize {
|
fn optional_fields_offset(&self, _account_block: &[u8]) -> usize;
|
||||||
unimplemented!();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the length of the data associated to this account based on the
|
/// Returns the length of the data associated to this account based on the
|
||||||
/// specified account block.
|
/// specified account block.
|
||||||
fn account_data_size(&self, _account_block: &[u8]) -> usize {
|
fn account_data_size(&self, _account_block: &[u8]) -> usize;
|
||||||
unimplemented!();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the data associated to this account based on the specified
|
/// Returns the data associated to this account based on the specified
|
||||||
/// account block.
|
/// account block.
|
||||||
fn account_data<'a>(&self, _account_block: &'a [u8]) -> &'a [u8] {
|
fn account_data<'a>(&self, _account_block: &'a [u8]) -> &'a [u8];
|
||||||
unimplemented!();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AccountMetaFlags {
|
impl AccountMetaFlags {
|
||||||
|
|
Loading…
Reference in New Issue