Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
runtime: make {Stored,Account}Meta repr(C) (#30027)
Browse files Browse the repository at this point in the history
Co-authored-by: Richard Patel <ripatel@jumptrading.com>
  • Loading branch information
ripatel-fd and riptl authored Feb 1, 2023
1 parent 04a6a63 commit 179b406
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions runtime/src/append_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,29 +148,31 @@ impl<'a: 'b, 'b, T: ReadableAccount + Sync + 'b, U: StorableAccounts<'a, T>, V:
/// This struct will be backed by mmaped and snapshotted data files.
/// So the data layout must be stable and consistent across the entire cluster!
#[derive(Clone, PartialEq, Eq, Debug)]
#[repr(C)]
pub struct StoredMeta {
/// global write version
/// This will be made completely obsolete such that we stop storing it.
/// We will not support multiple append vecs per slot anymore, so this concept is no longer necessary.
/// Order of stores of an account to an append vec will determine 'latest' account data per pubkey.
pub write_version_obsolete: StoredMetaWriteVersion,
pub data_len: u64,
/// key for the account
pub pubkey: Pubkey,
pub data_len: u64,
}

/// This struct will be backed by mmaped and snapshotted data files.
/// So the data layout must be stable and consistent across the entire cluster!
#[derive(Serialize, Deserialize, Clone, Debug, Default, Eq, PartialEq)]
#[repr(C)]
pub struct AccountMeta {
/// lamports in the account
pub lamports: u64,
/// the epoch at which this account will next owe rent
pub rent_epoch: Epoch,
/// the program that owns this account. If executable, the program that loads this account.
pub owner: Pubkey,
/// this account's data contains a loaded program (and is now read-only)
pub executable: bool,
/// the epoch at which this account will next owe rent
pub rent_epoch: Epoch,
}

impl<'a, T: ReadableAccount> From<&'a T> for AccountMeta {
Expand Down

0 comments on commit 179b406

Please sign in to comment.