Struct solana_ledger::blockstore::Blockstore
source · [−]pub struct Blockstore {
pub new_shreds_signals: Vec<SyncSender<bool>>,
pub completed_slots_senders: Vec<CompletedSlotsSender>,
pub lowest_cleanup_slot: Arc<RwLock<Slot>>,
/* private fields */
}
Fields
new_shreds_signals: Vec<SyncSender<bool>>
completed_slots_senders: Vec<CompletedSlotsSender>
lowest_cleanup_slot: Arc<RwLock<Slot>>
Implementations
sourceimpl Blockstore
impl Blockstore
sourcepub fn purge_slots(&self, from_slot: Slot, to_slot: Slot, purge_type: PurgeType)
pub fn purge_slots(&self, from_slot: Slot, to_slot: Slot, purge_type: PurgeType)
Silently deletes all blockstore column families in the range [from_slot,to_slot] Dangerous; Use with care: Does not check for integrity and does not update slot metas that refer to deleted slots Modifies multiple column families simultaneously
sourcepub fn set_max_expired_slot(&self, to_slot: Slot)
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.
pub fn purge_and_compact_slots(&self, from_slot: Slot, to_slot: Slot)
sourcepub fn purge_from_next_slots(&self, from_slot: Slot, to_slot: Slot)
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
pub fn compact_storage(&self, from_slot: Slot, to_slot: Slot) -> Result<bool>
sourceimpl Blockstore
impl Blockstore
pub fn db(self) -> Arc<Database>
pub fn ledger_path(&self) -> &PathBuf
sourcepub fn open(ledger_path: &Path) -> Result<Blockstore>
pub fn open(ledger_path: &Path) -> Result<Blockstore>
Opens a Ledger in directory, provides “infinite” window of shreds
pub fn open_with_access_type(
ledger_path: &Path,
access_type: AccessType,
recovery_mode: Option<BlockstoreRecoveryMode>,
enforce_ulimit_nofile: bool
) -> Result<Blockstore>
pub fn open_with_signal(
ledger_path: &Path,
recovery_mode: Option<BlockstoreRecoveryMode>,
enforce_ulimit_nofile: bool
) -> Result<BlockstoreSignals>
pub fn add_tree(
&self,
forks: Tree<Slot>,
is_orphan: bool,
is_slot_complete: bool,
num_ticks: u64,
starting_hash: Hash
)
pub fn set_no_compaction(&mut self, no_compaction: bool)
pub fn destroy(ledger_path: &Path) -> Result<()>
pub fn meta(&self, slot: Slot) -> Result<Option<SlotMeta>>
pub fn is_full(&self, slot: Slot) -> bool
pub fn orphan(&self, slot: Slot) -> Result<Option<bool>>
pub fn max_root(&self) -> Slot
pub fn slot_meta_iterator(
&self,
slot: Slot
) -> Result<impl Iterator<Item = (Slot, SlotMeta)> + '_>
pub fn live_slots_iterator(
&self,
root: Slot
) -> impl Iterator<Item = (Slot, SlotMeta)> + '_
pub fn slot_data_iterator(
&self,
slot: Slot,
index: u64
) -> Result<impl Iterator<Item = ((u64, u64), Box<[u8]>)> + '_>
pub fn slot_coding_iterator(
&self,
slot: Slot,
index: u64
) -> Result<impl Iterator<Item = ((u64, u64), Box<[u8]>)> + '_>
pub fn rooted_slot_iterator(
&self,
slot: Slot
) -> Result<impl Iterator<Item = u64> + '_>
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<Shred>>>,
handle_duplicate: &F,
metrics: &mut BlockstoreInsertionMetrics
) -> Result<(Vec<CompletedDataSetInfo>, Vec<usize>)> where
F: Fn(Shred),
pub fn clear_unconfirmed_slot(&self, slot: Slot)
pub fn insert_shreds(
&self,
shreds: Vec<Shred>,
leader_schedule: Option<&LeaderScheduleCache>,
is_trusted: bool
) -> Result<(Vec<CompletedDataSetInfo>, Vec<usize>)>
pub fn get_data_shred(&self, slot: Slot, index: u64) -> Result<Option<Vec<u8>>>
pub fn get_data_shreds_for_slot(
&self,
slot: Slot,
start_index: u64
) -> ShredResult<Vec<Shred>>
pub fn get_coding_shred(
&self,
slot: Slot,
index: u64
) -> Result<Option<Vec<u8>>>
pub fn get_coding_shreds_for_slot(
&self,
slot: Slot,
start_index: u64
) -> ShredResult<Vec<Shred>>
pub fn get_index(&self, slot: Slot) -> Result<Option<Index>>
sourcepub fn put_meta_bytes(&self, slot: Slot, bytes: &[u8]) -> Result<()>
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.
pub fn find_missing_data_indexes(
&self,
slot: Slot,
first_timestamp: u64,
start_index: u64,
end_index: u64,
max_missing: usize
) -> Vec<u64>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
pub fn get_block_time(&self, slot: Slot) -> Result<Option<UnixTimestamp>>
pub fn cache_block_time(
&self,
slot: Slot,
timestamp: UnixTimestamp
) -> Result<()>
pub fn get_block_height(&self, slot: Slot) -> Result<Option<u64>>
pub fn cache_block_height(&self, slot: Slot, block_height: u64) -> Result<()>
pub fn get_first_available_block(&self) -> Result<Slot>
pub fn get_rooted_block(
&self,
slot: Slot,
require_previous_blockhash: bool
) -> Result<ConfirmedBlock>
pub fn get_complete_block(
&self,
slot: Slot,
require_previous_blockhash: bool
) -> Result<ConfirmedBlock>
pub fn map_transactions_to_statuses(
&self,
slot: Slot,
iterator: impl Iterator<Item = VersionedTransaction>
) -> Result<Vec<TransactionWithStatusMeta>>
pub fn read_transaction_status(
&self,
index: (Signature, Slot)
) -> Result<Option<TransactionStatusMeta>>
pub fn write_transaction_status(
&self,
slot: Slot,
signature: Signature,
writable_keys: Vec<&Pubkey>,
readonly_keys: Vec<&Pubkey>,
status: TransactionStatusMeta
) -> Result<()>
pub fn read_transaction_memos(
&self,
signature: Signature
) -> Result<Option<String>>
pub fn write_transaction_memos(
&self,
signature: &Signature,
memos: String
) -> Result<()>
sourcepub fn get_rooted_transaction_status(
&self,
signature: Signature
) -> Result<Option<(Slot, TransactionStatusMeta)>>
pub fn get_rooted_transaction_status(
&self,
signature: Signature
) -> Result<Option<(Slot, TransactionStatusMeta)>>
Returns a transaction status
sourcepub fn get_transaction_status(
&self,
signature: Signature,
confirmed_unrooted_slots: &[Slot]
) -> Result<Option<(Slot, TransactionStatusMeta)>>
pub fn get_transaction_status(
&self,
signature: Signature,
confirmed_unrooted_slots: &[Slot]
) -> Result<Option<(Slot, TransactionStatusMeta)>>
Returns a transaction status
sourcepub fn get_rooted_transaction(
&self,
signature: Signature
) -> Result<Option<ConfirmedTransaction>>
pub fn get_rooted_transaction(
&self,
signature: Signature
) -> Result<Option<ConfirmedTransaction>>
Returns a complete transaction if it was processed in a root
sourcepub fn get_complete_transaction(
&self,
signature: Signature,
highest_confirmed_slot: Slot
) -> Result<Option<ConfirmedTransaction>>
pub fn get_complete_transaction(
&self,
signature: Signature,
highest_confirmed_slot: Slot
) -> Result<Option<ConfirmedTransaction>>
Returns a complete transaction
pub fn get_confirmed_signatures_for_address(
&self,
pubkey: Pubkey,
start_slot: Slot,
end_slot: Slot
) -> Result<Vec<Signature>>
pub fn get_confirmed_signatures_for_address2(
&self,
address: Pubkey,
highest_slot: Slot,
before: Option<Signature>,
until: Option<Signature>,
limit: usize
) -> Result<SignatureInfosForAddress>
pub fn read_rewards(&self, index: Slot) -> Result<Option<Rewards>>
pub fn write_rewards(&self, index: Slot, rewards: Rewards) -> Result<()>
pub fn get_recent_perf_samples(
&self,
num: usize
) -> Result<Vec<(Slot, PerfSample)>>
pub fn write_perf_sample(
&self,
index: Slot,
perf_sample: &PerfSample
) -> Result<()>
pub fn read_program_costs(&self) -> Result<Vec<(Pubkey, u64)>>
pub fn write_program_cost(&self, key: &Pubkey, value: &u64) -> Result<()>
pub fn delete_program_cost(&self, key: &Pubkey) -> Result<()>
sourcepub fn get_slot_entries(
&self,
slot: Slot,
shred_start_index: u64
) -> Result<Vec<Entry>>
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
sourcepub fn get_slot_entries_with_shred_info(
&self,
slot: Slot,
start_index: u64,
allow_dead_slots: bool
) -> Result<(Vec<Entry>, u64, bool)>
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).
pub fn get_entries_in_data_block(
&self,
slot: Slot,
start_index: u32,
end_index: u32,
slot_meta: Option<&SlotMeta>
) -> Result<Vec<Entry>>
pub fn get_slots_since(&self, slots: &[u64]) -> Result<HashMap<u64, Vec<u64>>>
pub fn is_root(&self, slot: Slot) -> bool
sourcepub fn is_skipped(&self, slot: Slot) -> bool
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.
pub fn insert_bank_hash(
&self,
slot: Slot,
frozen_hash: Hash,
is_duplicate_confirmed: bool
)
pub fn get_bank_hash(&self, slot: Slot) -> Option<Hash>
pub fn is_duplicate_confirmed(&self, slot: Slot) -> bool
pub fn set_duplicate_confirmed_slots_and_hashes(
&self,
duplicate_confirmed_slot_hashes: impl Iterator<Item = (Slot, Hash)>
) -> Result<()>
pub fn set_roots<'a>(
&self,
rooted_slots: impl Iterator<Item = &'a Slot>
) -> Result<()>
pub fn is_dead(&self, slot: Slot) -> bool
pub fn set_dead_slot(&self, slot: Slot) -> Result<()>
pub fn remove_dead_slot(&self, slot: Slot) -> Result<()>
pub fn store_duplicate_if_not_existing(
&self,
slot: Slot,
shred1: Vec<u8>,
shred2: Vec<u8>
) -> Result<()>
pub fn store_duplicate_slot(
&self,
slot: Slot,
shred1: Vec<u8>,
shred2: Vec<u8>
) -> Result<()>
pub fn get_duplicate_slot(&self, slot: u64) -> Option<DuplicateSlotProof>
pub fn is_shred_duplicate(
&self,
shred: ShredId,
payload: Vec<u8>
) -> Option<Vec<u8>>
pub fn has_duplicate_shreds_in_slot(&self, slot: Slot) -> bool
pub fn orphans_iterator(
&self,
slot: Slot
) -> Result<impl Iterator<Item = u64> + '_>
pub fn dead_slots_iterator(
&self,
slot: Slot
) -> Result<impl Iterator<Item = Slot> + '_>
pub fn duplicate_slots_iterator(
&self,
slot: Slot
) -> Result<impl Iterator<Item = Slot> + '_>
pub fn last_root(&self) -> Slot
pub fn lowest_slot(&self) -> Slot
pub fn lowest_cleanup_slot(&self) -> Slot
pub fn storage_size(&self) -> Result<u64>
pub fn is_primary_access(&self) -> bool
pub fn scan_and_fix_roots(&self, exit: &Arc<AtomicBool>) -> Result<()>
Auto Trait Implementations
impl RefUnwindSafe for Blockstore
impl Send for Blockstore
impl Sync for Blockstore
impl Unpin for Blockstore
impl UnwindSafe for Blockstore
Blanket Implementations
sourceimpl<T> AbiExample for T
impl<T> AbiExample for T
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
sourcepub fn into_request(self) -> Request<T>
pub fn into_request(self) -> Request<T>
Wrap the input message T
in a tonic::Request
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> TupleTree<T, ()> for T
impl<T> TupleTree<T, ()> for T
pub const SIZE: Size
pub fn descendants(_indirect_level: usize) -> usize
pub fn height() -> usize
pub fn preorder(self, f: &mut impl FnMut(Visit<T>))
pub fn preorder_with_size_hint(self, f: &mut impl FnMut(Visit<T>, Size))
pub fn postorder(self, f: &mut impl FnMut(Visit<T>))
pub fn postorder_with_size_hint(self, f: &mut impl FnMut(Visit<T>, Size))
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more