pub struct Blockstore {
Show 29 fields ledger_path: PathBuf, db: Arc<Database>, meta_cf: LedgerColumn<SlotMeta>, dead_slots_cf: LedgerColumn<DeadSlots>, duplicate_slots_cf: LedgerColumn<DuplicateSlots>, erasure_meta_cf: LedgerColumn<ErasureMeta>, orphans_cf: LedgerColumn<Orphans>, index_cf: LedgerColumn<Index>, data_shred_cf: LedgerColumn<ShredData>, code_shred_cf: LedgerColumn<ShredCode>, transaction_status_cf: LedgerColumn<TransactionStatus>, address_signatures_cf: LedgerColumn<AddressSignatures>, transaction_memos_cf: LedgerColumn<TransactionMemos>, transaction_status_index_cf: LedgerColumn<TransactionStatusIndex>, active_transaction_status_index: RwLock<u64>, rewards_cf: LedgerColumn<Rewards>, blocktime_cf: LedgerColumn<Blocktime>, perf_samples_cf: LedgerColumn<PerfSamples>, block_height_cf: LedgerColumn<BlockHeight>, program_costs_cf: LedgerColumn<ProgramCosts>, bank_hash_cf: LedgerColumn<BankHash>, optimistic_slots_cf: LedgerColumn<OptimisticSlots>, last_root: RwLock<Slot>, insert_shreds_lock: Mutex<()>, new_shreds_signals: Mutex<Vec<Sender<bool>>>, completed_slots_senders: Mutex<Vec<CompletedSlotsSender>>, pub shred_timing_point_sender: Option<PohTimingSender>, pub lowest_cleanup_slot: RwLock<Slot>, pub slots_stats: SlotsStats,
}

Fields§

§ledger_path: PathBuf§db: Arc<Database>§meta_cf: LedgerColumn<SlotMeta>§dead_slots_cf: LedgerColumn<DeadSlots>§duplicate_slots_cf: LedgerColumn<DuplicateSlots>§erasure_meta_cf: LedgerColumn<ErasureMeta>§orphans_cf: LedgerColumn<Orphans>§index_cf: LedgerColumn<Index>§data_shred_cf: LedgerColumn<ShredData>§code_shred_cf: LedgerColumn<ShredCode>§transaction_status_cf: LedgerColumn<TransactionStatus>§address_signatures_cf: LedgerColumn<AddressSignatures>§transaction_memos_cf: LedgerColumn<TransactionMemos>§transaction_status_index_cf: LedgerColumn<TransactionStatusIndex>§active_transaction_status_index: RwLock<u64>§rewards_cf: LedgerColumn<Rewards>§blocktime_cf: LedgerColumn<Blocktime>§perf_samples_cf: LedgerColumn<PerfSamples>§block_height_cf: LedgerColumn<BlockHeight>§program_costs_cf: LedgerColumn<ProgramCosts>§bank_hash_cf: LedgerColumn<BankHash>§optimistic_slots_cf: LedgerColumn<OptimisticSlots>§last_root: RwLock<Slot>§insert_shreds_lock: Mutex<()>§new_shreds_signals: Mutex<Vec<Sender<bool>>>§completed_slots_senders: Mutex<Vec<CompletedSlotsSender>>§shred_timing_point_sender: Option<PohTimingSender>§lowest_cleanup_slot: RwLock<Slot>§slots_stats: SlotsStats

Implementations§

source§

impl Blockstore

source

pub fn purge_slots(&self, from_slot: Slot, to_slot: Slot, purge_type: PurgeType)

Performs cleanup based on the specified deletion range. After this function call, entries within [from_slot, to_slot] will become unavailable to the reader immediately, while its disk space occupied by the deletion entries are reclaimed later via RocksDB’s background compaction.

Note that this function modifies multiple column families at the same time and might break the consistency between different column families as it does not update the associated slot-meta entries that refer to the deleted entries.

For slot-id based column families, the purge is done by range deletion, while the non-slot-id based column families, cf::TransactionStatus, AddressSignature, and cf::TransactionStatusIndex, are cleaned-up based on the purge_type setting.

source

pub fn set_max_expired_slot(&self, to_slot: Slot)

Usually this is paired with .purge_slots() but we can’t internally call this in that function unconditionally. That’s because set_max_expired_slot() expects to purge older slots by the successive chronological order, while .purge_slots() can also be used to purge future slots for –hard-fork thing, preserving older slots. It’d be quite dangerous to purge older slots in that case. So, current legal user of this function is LedgerCleanupService.

source

pub fn purge_and_compact_slots(&self, from_slot: Slot, to_slot: Slot)

source

pub fn purge_from_next_slots(&self, from_slot: Slot, to_slot: Slot)

Ensures that the SlotMeta::next_slots vector for all slots contain no references in the [from_slot,to_slot] range

Dangerous; Use with care

source

pub(crate) fn run_purge( &self, from_slot: Slot, to_slot: Slot, purge_type: PurgeType ) -> Result<bool>

source

pub(crate) fn run_purge_with_stats( &self, from_slot: Slot, to_slot: Slot, purge_type: PurgeType, purge_stats: &mut PurgeStats ) -> Result<bool>

A helper function to purge_slots that executes the ledger clean up. The cleanup applies to [from_slot, to_slot].

When from_slot is 0, any sst-file with a key-range completely older than to_slot will also be deleted.

source

fn purge_files_in_range(&self, from_slot: Slot, to_slot: Slot) -> bool

source

fn purge_special_columns_exact( &self, batch: &mut WriteBatch<'_>, from_slot: Slot, to_slot: Slot ) -> Result<()>

Purges special columns (using a non-Slot primary-index) exactly, by deserializing each slot being purged and iterating through all transactions to determine the keys of individual records.

The purge range applies to [from_slot, to_slot].

This method is very slow.

source

fn purge_special_columns_with_primary_index( &self, write_batch: &mut WriteBatch<'_>, columns_purged: &mut bool, w_active_transaction_status_index: &mut u64, to_slot: Slot ) -> Result<()>

Purges special columns (using a non-Slot primary-index) by range. Purge occurs if frozen primary index has a max-slot less than the highest slot being purged.

source§

impl Blockstore

source

pub fn db(self) -> Arc<Database>

source

pub fn ledger_path(&self) -> &PathBuf

source

pub fn banking_trace_path(&self) -> PathBuf

source

pub fn open(ledger_path: &Path) -> Result<Blockstore>

Opens a Ledger in directory, provides “infinite” window of shreds

source

pub fn open_with_options( ledger_path: &Path, options: BlockstoreOptions ) -> Result<Blockstore>

source

fn do_open(ledger_path: &Path, options: BlockstoreOptions) -> Result<Blockstore>

source

pub fn open_with_signal( ledger_path: &Path, options: BlockstoreOptions ) -> Result<BlockstoreSignals>

source

pub fn add_tree( &self, forks: Tree<Slot>, is_orphan: bool, is_slot_complete: bool, num_ticks: u64, starting_hash: Hash )

source

pub fn destroy(ledger_path: &Path) -> Result<()>

Deletes the blockstore at the specified path.

Note that if the ledger_path has multiple rocksdb instances, this function will destroy all.

source

pub fn meta(&self, slot: Slot) -> Result<Option<SlotMeta>>

Returns the SlotMeta of the specified slot.

source

pub fn is_full(&self, slot: Slot) -> bool

Returns true if the specified slot is full.

source

fn erasure_meta(&self, erasure_set: ErasureSetId) -> Result<Option<ErasureMeta>>

source

pub fn orphan(&self, slot: Slot) -> Result<Option<bool>>

Check whether the specified slot is an orphan slot which does not have a parent slot.

Returns true if the specified slot does not have a parent slot. For other return values, it means either the slot is not in the blockstore or the slot isn’t an orphan slot.

source

pub fn max_root(&self) -> Slot

Returns the max root or 0 if it does not exist.

source

pub fn slot_meta_iterator( &self, slot: Slot ) -> Result<impl Iterator<Item = (Slot, SlotMeta)> + '_>

source

pub fn live_slots_iterator( &self, root: Slot ) -> impl Iterator<Item = (Slot, SlotMeta)> + '_

source

pub fn live_files_metadata(&self) -> Result<Vec<LiveFile>>

source

pub fn slot_data_iterator( &self, slot: Slot, index: u64 ) -> Result<impl Iterator<Item = ((u64, u64), Box<[u8]>)> + '_>

source

pub fn slot_coding_iterator( &self, slot: Slot, index: u64 ) -> Result<impl Iterator<Item = ((u64, u64), Box<[u8]>)> + '_>

source

fn prepare_rooted_slot_iterator( &self, slot: Slot, direction: IteratorDirection ) -> Result<impl Iterator<Item = Slot> + '_>

source

pub fn rooted_slot_iterator( &self, slot: Slot ) -> Result<impl Iterator<Item = Slot> + '_>

source

pub fn reversed_rooted_slot_iterator( &self, slot: Slot ) -> Result<impl Iterator<Item = Slot> + '_>

source

pub fn reversed_optimistic_slots_iterator( &self ) -> Result<impl Iterator<Item = (Slot, Hash, UnixTimestamp)> + '_>

source

pub fn slot_range_connected( &self, starting_slot: Slot, ending_slot: Slot ) -> bool

Determines if we can iterate from starting_slot to >= ending_slot by full slots starting_slot is excluded from the is_full() check

source

fn get_recovery_data_shreds<'a>( index: &'a Index, slot: Slot, erasure_meta: &'a ErasureMeta, prev_inserted_shreds: &'a HashMap<ShredId, Shred>, data_cf: &'a LedgerColumn<ShredData> ) -> impl Iterator<Item = Shred> + 'a

source

fn get_recovery_coding_shreds<'a>( index: &'a Index, slot: Slot, erasure_meta: &'a ErasureMeta, prev_inserted_shreds: &'a HashMap<ShredId, Shred>, code_cf: &'a LedgerColumn<ShredCode> ) -> impl Iterator<Item = Shred> + 'a

source

fn recover_shreds( index: &mut Index, erasure_meta: &ErasureMeta, prev_inserted_shreds: &HashMap<ShredId, Shred>, recovered_shreds: &mut Vec<Shred>, data_cf: &LedgerColumn<ShredData>, code_cf: &LedgerColumn<ShredCode>, reed_solomon_cache: &ReedSolomonCache )

source

fn submit_metrics( slot: Slot, erasure_meta: &ErasureMeta, attempted: bool, status: String, recovered: usize )

source

pub fn submit_rocksdb_cf_metrics_for_all_cfs(&self)

Collects and reports BlockstoreRocksDbColumnFamilyMetrics for the all the column families.

source

fn try_shred_recovery( db: &Database, erasure_metas: &HashMap<ErasureSetId, ErasureMeta>, index_working_set: &mut HashMap<u64, IndexMetaWorkingSetEntry>, prev_inserted_shreds: &HashMap<ShredId, Shred>, reed_solomon_cache: &ReedSolomonCache ) -> Vec<Shred>

source

pub fn insert_shreds_handle_duplicate<F>( &self, shreds: Vec<Shred>, is_repaired: Vec<bool>, leader_schedule: Option<&LeaderScheduleCache>, is_trusted: bool, retransmit_sender: Option<&Sender<Vec<Vec<u8>>>>, handle_duplicate: &F, reed_solomon_cache: &ReedSolomonCache, metrics: &mut BlockstoreInsertionMetrics ) -> Result<Vec<CompletedDataSetInfo>>where F: Fn(Shred),

The main helper function that performs the shred insertion logic and updates corresponding meta-data.

This function updates the following column families:

  • cf::DeadSlots: mark a shred as “dead” if its meta-data indicates there is no need to replay this shred. Specifically when both the following conditions satisfy,
    • We get a new shred N marked as the last shred in the slot S, but N.index() is less than the current slot_meta.received for slot S.
    • The slot is not currently full It means there’s an alternate version of this slot. See check_insert_data_shred for more details.
  • cf::ShredData: stores data shreds (in check_insert_data_shreds).
  • cf::ShredCode: stores coding shreds (in check_insert_coding_shreds).
  • cf::SlotMeta: the SlotMeta of the input shreds and their related shreds are updated. Specifically:
    • handle_chaining() updates cf::SlotMeta in two ways. First, it updates the in-memory slot_meta_working_set, which will later be persisted in commit_slot_meta_working_set(). Second, for the newly chained slots (updated inside handle_chaining_for_slot()), it will directly persist their slot-meta into cf::SlotMeta.
    • In commit_slot_meta_working_set(), persists everything stored in the in-memory structure slot_meta_working_set, which is updated by both check_insert_data_shred() and handle_chaining().
  • cf::Orphans: add or remove the ID of a slot to cf::Orphans if it becomes / is no longer an orphan slot in handle_chaining().
  • cf::ErasureMeta: the associated ErasureMeta of the coding and data shreds inside shreds will be updated and committed to cf::ErasureMeta.
  • pair to the cf::Index column family for each index_working_set_entry which insert did occur in this function call.

Arguments:

  • shreds: the shreds to be inserted.
  • is_repaired: a boolean vector aligned with shreds where each boolean indicates whether the corresponding shred is repaired or not.
  • leader_schedule: the leader schedule
  • is_trusted: whether the shreds come from a trusted source. If this is set to true, then the function will skip the shred duplication and integrity checks.
  • retransmit_sender: the sender for transmitting any recovered data shreds.
  • handle_duplicate: a function for handling shreds that have the same slot and index.
  • metrics: the metric for reporting detailed stats

On success, the function returns an Ok result with a vector of CompletedDataSetInfo and a vector of its corresponding index in the input shreds vector.

source

pub fn add_new_shred_signal(&self, s: Sender<bool>)

source

pub fn add_completed_slots_signal(&self, s: CompletedSlotsSender)

source

pub fn get_new_shred_signals_len(&self) -> usize

source

pub fn get_new_shred_signal(&self, index: usize) -> Option<Sender<bool>>

source

pub fn drop_signal(&self)

source

pub fn clear_unconfirmed_slot(&self, slot: Slot)

Range-delete all entries which prefix matches the specified slot, remove slot its’ parents SlotMeta next_slots list, and clear slot’s SlotMeta (except for next_slots).

This function currently requires insert_shreds_lock, as both clear_unconfirmed_slot() and insert_shreds_handle_duplicate() try to perform read-modify-write operation on cf::SlotMeta column family.

source

pub fn insert_shreds( &self, shreds: Vec<Shred>, leader_schedule: Option<&LeaderScheduleCache>, is_trusted: bool ) -> Result<Vec<CompletedDataSetInfo>>

source

fn check_insert_coding_shred<F>( &self, shred: Shred, erasure_metas: &mut HashMap<ErasureSetId, ErasureMeta>, index_working_set: &mut HashMap<u64, IndexMetaWorkingSetEntry>, write_batch: &mut WriteBatch<'_>, just_received_shreds: &mut HashMap<ShredId, Shred>, index_meta_time_us: &mut u64, handle_duplicate: &F, is_trusted: bool, shred_source: ShredSource, metrics: &mut BlockstoreInsertionMetrics ) -> boolwhere F: Fn(Shred),

source

fn find_conflicting_coding_shred( &self, shred: &Shred, slot: Slot, erasure_meta: &ErasureMeta, just_received_shreds: &HashMap<ShredId, Shred> ) -> Option<Vec<u8>>

source

fn check_insert_data_shred<F>( &self, shred: Shred, erasure_metas: &mut HashMap<ErasureSetId, ErasureMeta>, index_working_set: &mut HashMap<u64, IndexMetaWorkingSetEntry>, slot_meta_working_set: &mut HashMap<u64, SlotMetaWorkingSetEntry>, write_batch: &mut WriteBatch<'_>, just_inserted_shreds: &mut HashMap<ShredId, Shred>, index_meta_time_us: &mut u64, is_trusted: bool, handle_duplicate: &F, leader_schedule: Option<&LeaderScheduleCache>, shred_source: ShredSource ) -> Result<Vec<CompletedDataSetInfo>, InsertDataShredError>where F: Fn(Shred),

Create an entry to the specified write_batch that performs shred insertion and associated metadata update. The function also updates its in-memory copy of the associated metadata.

Currently, this function must be invoked while holding insert_shreds_lock as it performs read-modify-write operations on multiple column families.

The resulting write_batch may include updates to cf::DeadSlots and cf::ShredData. Note that it will also update the in-memory copy of erasure_metas and index_working_set, which will later be used to update other column families such as cf::ErasureMeta and cf::Index.

Arguments:

  • shred: the shred to be inserted
  • erasure_metas: the in-memory hash-map that maintains the dirty copy of the erasure meta. It will later be written to cf::ErasureMeta in insert_shreds_handle_duplicate().
  • index_working_set: the in-memory hash-map that maintains the dirty copy of the index meta. It will later be written to cf::Index in insert_shreds_handle_duplicate().
  • slot_meta_working_set: the in-memory hash-map that maintains the dirty copy of the index meta. It will later be written to cf::SlotMeta in insert_shreds_handle_duplicate().
  • write_batch: the collection of the current writes which will be committed atomically.
  • just_inserted_data_shreds: a (slot, shred index within the slot) to shred map which maintains which data shreds have been inserted.
  • index_meta_time_us: the time spent on loading or creating the index meta entry from the db.
  • is_trusted: if false, this function will check whether the input shred is duplicate.
  • handle_duplicate: the function that handles duplication.
  • leader_schedule: the leader schedule will be used to check whether it is okay to insert the input shred.
  • shred_source: the source of the shred.
source

fn should_insert_coding_shred(shred: &Shred, last_root: &RwLock<u64>) -> bool

source

fn insert_coding_shred( &self, index_meta: &mut Index, shred: &Shred, write_batch: &mut WriteBatch<'_> ) -> Result<()>

source

fn is_data_shred_present( shred: &Shred, slot_meta: &SlotMeta, data_index: &ShredIndex ) -> bool

source

fn get_data_shred_from_just_inserted_or_db<'a>( &'a self, just_inserted_shreds: &'a HashMap<ShredId, Shred>, slot: Slot, index: u64 ) -> Cow<'a, Vec<u8>>

source

fn should_insert_data_shred( &self, shred: &Shred, slot_meta: &SlotMeta, just_inserted_shreds: &HashMap<ShredId, Shred>, last_root: &RwLock<u64>, leader_schedule: Option<&LeaderScheduleCache>, shred_source: ShredSource ) -> bool

source

fn send_slot_full_timing(&self, slot: Slot)

send slot full timing point to poh_timing_report service

source

fn insert_data_shred( &self, slot_meta: &mut SlotMeta, data_index: &mut ShredIndex, shred: &Shred, write_batch: &mut WriteBatch<'_>, shred_source: ShredSource ) -> Result<Vec<CompletedDataSetInfo>>

source

pub fn get_data_shred(&self, slot: Slot, index: u64) -> Result<Option<Vec<u8>>>

source

pub fn get_data_shreds_for_slot( &self, slot: Slot, start_index: u64 ) -> Result<Vec<Shred>, Error>

source

pub fn get_coding_shred( &self, slot: Slot, index: u64 ) -> Result<Option<Vec<u8>>>

source

pub fn get_coding_shreds_for_slot( &self, slot: Slot, start_index: u64 ) -> Result<Vec<Shred>, Error>

source

pub(crate) fn write_entries( &self, start_slot: Slot, num_ticks_in_start_slot: u64, start_index: u32, ticks_per_slot: u64, parent: Option<u64>, is_full_slot: bool, keypair: &Keypair, entries: Vec<Entry>, version: u16 ) -> Result<usize>

source

pub fn get_index(&self, slot: Slot) -> Result<Option<Index>>

source

pub fn put_meta_bytes(&self, slot: Slot, bytes: &[u8]) -> Result<()>

Manually update the meta for a slot. Can interfere with automatic meta update and potentially break chaining. Dangerous. Use with care.

source

pub fn put_meta(&self, slot: Slot, meta: &SlotMeta) -> Result<()>

Manually update the meta for a slot. Can interfere with automatic meta update and potentially break chaining. Dangerous. Use with care.

source

fn find_missing_indexes<C>( db_iterator: &mut DBRawIterator<'_>, slot: Slot, first_timestamp: u64, defer_threshold_ticks: u64, start_index: u64, end_index: u64, max_missing: usize ) -> Vec<u64>where C: Column<Index = (u64, u64)>,

source

pub fn find_missing_data_indexes( &self, slot: Slot, first_timestamp: u64, defer_threshold_ticks: u64, start_index: u64, end_index: u64, max_missing: usize ) -> Vec<u64>

source

pub fn get_block_time(&self, slot: Slot) -> Result<Option<UnixTimestamp>>

source

pub fn cache_block_time( &self, slot: Slot, timestamp: UnixTimestamp ) -> Result<()>

source

pub fn get_block_height(&self, slot: Slot) -> Result<Option<u64>>

source

pub fn cache_block_height(&self, slot: Slot, block_height: u64) -> Result<()>

source

pub fn get_first_available_block(&self) -> Result<Slot>

The first complete block that is available in the Blockstore ledger

source

pub fn get_rooted_block( &self, slot: Slot, require_previous_blockhash: bool ) -> Result<VersionedConfirmedBlock>

source

pub fn get_complete_block( &self, slot: Slot, require_previous_blockhash: bool ) -> Result<VersionedConfirmedBlock>

source

pub fn map_transactions_to_statuses( &self, slot: Slot, iterator: impl Iterator<Item = VersionedTransaction> ) -> Result<Vec<VersionedTransactionWithStatusMeta>>

source

fn initialize_transaction_status_index(&self) -> Result<()>

Initializes the TransactionStatusIndex column family with two records, 0 and 1, which are used as the primary index for entries in the TransactionStatus and AddressSignatures columns. At any given time, one primary index is active (ie. new records are stored under this index), the other is frozen.

source

fn toggle_transaction_status_index( &self, batch: &mut WriteBatch<'_>, w_active_transaction_status_index: &mut u64, to_slot: Slot ) -> Result<Option<u64>>

Toggles the active primary index between 0 and 1, and clears the stored max-slot of the frozen index in preparation for pruning.

source

fn get_primary_index_to_write( &self, slot: Slot, w_active_transaction_status_index: &RwLockWriteGuard<'_, Slot> ) -> Result<u64>

source

pub fn read_transaction_status( &self, index: (Signature, Slot) ) -> Result<Option<TransactionStatusMeta>>

source

pub fn write_transaction_status( &self, slot: Slot, signature: Signature, writable_keys: Vec<&Pubkey>, readonly_keys: Vec<&Pubkey>, status: TransactionStatusMeta ) -> Result<()>

source

pub fn read_transaction_memos( &self, signature: Signature ) -> Result<Option<String>>

source

pub fn write_transaction_memos( &self, signature: &Signature, memos: String ) -> Result<()>

source

fn check_lowest_cleanup_slot( &self, slot: Slot ) -> Result<RwLockReadGuard<'_, Slot>>

Acquires the lowest_cleanup_slot lock and returns a tuple of the held lock and lowest available slot.

The function will return BlockstoreError::SlotCleanedUp if the input slot has already been cleaned-up.

source

fn ensure_lowest_cleanup_slot(&self) -> (RwLockReadGuard<'_, Slot>, Slot)

Acquires the lock of lowest_cleanup_slot and returns the tuple of the held lock and the lowest available slot.

This function ensures a consistent result by using lowest_cleanup_slot as the lower bound for reading columns that do not employ strong read consistency with slot-based delete_range.

source

fn get_transaction_status_with_counter( &self, signature: Signature, confirmed_unrooted_slots: &[Slot] ) -> Result<(Option<(Slot, TransactionStatusMeta)>, u64)>

source

pub fn get_rooted_transaction_status( &self, signature: Signature ) -> Result<Option<(Slot, TransactionStatusMeta)>>

Returns a transaction status

source

pub fn get_transaction_status( &self, signature: Signature, confirmed_unrooted_slots: &[Slot] ) -> Result<Option<(Slot, TransactionStatusMeta)>>

Returns a transaction status

source

pub fn get_rooted_transaction( &self, signature: Signature ) -> Result<Option<ConfirmedTransactionWithStatusMeta>>

Returns a complete transaction if it was processed in a root

source

pub fn get_complete_transaction( &self, signature: Signature, highest_confirmed_slot: Slot ) -> Result<Option<ConfirmedTransactionWithStatusMeta>>

Returns a complete transaction

source

fn get_transaction_with_status( &self, signature: Signature, confirmed_unrooted_slots: &[Slot] ) -> Result<Option<ConfirmedTransactionWithStatusMeta>>

source

fn find_transaction_in_slot( &self, slot: Slot, signature: Signature ) -> Result<Option<VersionedTransaction>>

source

fn find_address_signatures( &self, pubkey: Pubkey, start_slot: Slot, end_slot: Slot ) -> Result<Vec<(Slot, Signature)>>

source

fn find_address_signatures_for_slot( &self, pubkey: Pubkey, slot: Slot ) -> Result<Vec<(Slot, Signature)>>

source

pub fn get_confirmed_signatures_for_address( &self, pubkey: Pubkey, start_slot: Slot, end_slot: Slot ) -> Result<Vec<Signature>>

source

fn get_sorted_block_signatures(&self, slot: Slot) -> Result<Vec<Signature>>

source

pub fn get_confirmed_signatures_for_address2( &self, address: Pubkey, highest_slot: Slot, before: Option<Signature>, until: Option<Signature>, limit: usize ) -> Result<SignatureInfosForAddress>

source

pub fn read_rewards(&self, index: Slot) -> Result<Option<Rewards>>

source

pub fn write_rewards(&self, index: Slot, rewards: Rewards) -> Result<()>

source

pub fn get_recent_perf_samples( &self, num: usize ) -> Result<Vec<(Slot, PerfSample)>>

source

pub fn write_perf_sample( &self, index: Slot, perf_sample: &PerfSampleV2 ) -> Result<()>

source

pub fn read_program_costs(&self) -> Result<Vec<(Pubkey, u64)>>

source

pub fn write_program_cost(&self, key: &Pubkey, value: &u64) -> Result<()>

source

pub fn delete_program_cost(&self, key: &Pubkey) -> Result<()>

source

pub fn get_slot_entries( &self, slot: Slot, shred_start_index: u64 ) -> Result<Vec<Entry>>

Returns the entry vector for the slot starting with shred_start_index

source

pub fn get_slot_entries_with_shred_info( &self, slot: Slot, start_index: u64, allow_dead_slots: bool ) -> Result<(Vec<Entry>, u64, bool)>

Returns the entry vector for the slot starting with shred_start_index, the number of shreds that comprise the entry vector, and whether the slot is full (consumed all shreds).

source

pub fn get_accounts_used_in_range( &self, bank: &Bank, starting_slot: Slot, ending_slot: Slot ) -> DashSet<Pubkey>

Gets accounts used in transactions in the slot range [starting_slot, ending_slot]. Used by ledger-tool to create a minimized snapshot

source

fn get_completed_ranges( &self, slot: Slot, start_index: u64 ) -> Result<(Vec<(u32, u32)>, Option<SlotMeta>)>

source

fn get_completed_data_ranges( start_index: u32, completed_data_indexes: &BTreeSet<u32>, consumed: u32 ) -> Vec<(u32, u32)>

source

pub fn get_entries_in_data_block( &self, slot: Slot, start_index: u32, end_index: u32, slot_meta: Option<&SlotMeta> ) -> Result<Vec<Entry>>

source

fn get_any_valid_slot_entries(&self, slot: Slot, start_index: u64) -> Vec<Entry>

source

pub fn get_slots_since( &self, slots: &[Slot] ) -> Result<HashMap<Slot, Vec<Slot>>>

Returns a mapping from each elements of slots to a list of the element’s children slots.

source

pub fn is_root(&self, slot: Slot) -> bool

source

pub fn is_skipped(&self, slot: Slot) -> bool

Returns true if a slot is between the rooted slot bounds of the ledger, but has not itself been rooted. This is either because the slot was skipped, or due to a gap in ledger data, as when booting from a newer snapshot.

source

pub fn insert_bank_hash( &self, slot: Slot, frozen_hash: Hash, is_duplicate_confirmed: bool )

source

pub fn get_bank_hash(&self, slot: Slot) -> Option<Hash>

source

pub fn is_duplicate_confirmed(&self, slot: Slot) -> bool

source

pub fn insert_optimistic_slot( &self, slot: Slot, hash: &Hash, timestamp: UnixTimestamp ) -> Result<()>

source

pub fn get_latest_optimistic_slots( &self, num: usize ) -> Result<Vec<(Slot, Hash, UnixTimestamp)>>

source

pub fn set_duplicate_confirmed_slots_and_hashes( &self, duplicate_confirmed_slot_hashes: impl Iterator<Item = (Slot, Hash)> ) -> Result<()>

source

pub fn set_roots<'a>( &self, rooted_slots: impl Iterator<Item = &'a Slot> ) -> Result<()>

source

pub fn mark_slots_as_if_rooted_normally_at_startup( &self, slots: Vec<(Slot, Option<Hash>)>, with_hash: bool ) -> Result<()>

source

pub fn is_dead(&self, slot: Slot) -> bool

source

pub fn set_dead_slot(&self, slot: Slot) -> Result<()>

source

pub fn remove_dead_slot(&self, slot: Slot) -> Result<()>

source

pub fn store_duplicate_if_not_existing( &self, slot: Slot, shred1: Vec<u8>, shred2: Vec<u8> ) -> Result<()>

source

pub fn store_duplicate_slot( &self, slot: Slot, shred1: Vec<u8>, shred2: Vec<u8> ) -> Result<()>

source

pub fn get_duplicate_slot(&self, slot: u64) -> Option<DuplicateSlotProof>

source

pub fn is_shred_duplicate( &self, shred: ShredId, payload: Vec<u8> ) -> Option<Vec<u8>>

source

pub fn has_duplicate_shreds_in_slot(&self, slot: Slot) -> bool

source

pub fn orphans_iterator( &self, slot: Slot ) -> Result<impl Iterator<Item = u64> + '_>

source

pub fn dead_slots_iterator( &self, slot: Slot ) -> Result<impl Iterator<Item = Slot> + '_>

source

pub fn duplicate_slots_iterator( &self, slot: Slot ) -> Result<impl Iterator<Item = Slot> + '_>

source

pub fn last_root(&self) -> Slot

source

pub fn lowest_slot(&self) -> Slot

source

fn lowest_slot_with_genesis(&self) -> Slot

source

pub fn highest_slot(&self) -> Result<Option<Slot>>

Returns the highest available slot in the blockstore

source

pub fn lowest_cleanup_slot(&self) -> Slot

source

pub fn storage_size(&self) -> Result<u64>

source

pub fn total_data_shred_storage_size(&self) -> Result<i64>

Returns the total physical storage size contributed by all data shreds.

Note that the reported size does not include those recently inserted shreds that are still in memory.

source

pub fn total_coding_shred_storage_size(&self) -> Result<i64>

Returns the total physical storage size contributed by all coding shreds.

Note that the reported size does not include those recently inserted shreds that are still in memory.

source

pub fn is_primary_access(&self) -> bool

Returns whether the blockstore has primary (read and write) access

source

pub fn scan_and_fix_roots(&self, exit: &AtomicBool) -> Result<()>

source

pub fn set_and_chain_connected_on_root_and_next_slots( &self, root: Slot ) -> Result<()>

Mark a root slot as connected, traverse slot’s children and update the children’s connected status if appropriate.

A ledger with a full path of blocks from genesis to the latest root will have all of the rooted blocks marked as connected such that new blocks could also be connected. However, starting from some root (such as from a snapshot) is a valid way to join a cluster. For this case, mark this root as connected such that the node that joined midway through can have their slots considered connected.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> AbiExample for T

source§

default fn example() -> T

source§

impl<T> AbiExample for T

source§

default fn example() -> T

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> TupleTree<T, ()> for T

§

const SIZE: Size = Size{ degree: 0, descendants: 0,}

§

fn descendants(_indirect_level: usize) -> usize

§

fn height() -> usize

§

fn preorder(self, f: &mut impl FnMut(Visit<T>))

§

fn preorder_with_size_hint(self, f: &mut impl FnMut(Visit<T>, Size))

§

fn postorder(self, f: &mut impl FnMut(Visit<T>))

§

fn postorder_with_size_hint(self, f: &mut impl FnMut(Visit<T>, Size))

§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more