pub struct LedgerCleanupService { /* private fields */ }
Implementations
sourceimpl LedgerCleanupService
impl LedgerCleanupService
pub fn new(
new_root_receiver: Receiver<Slot>,
blockstore: Arc<Blockstore>,
max_ledger_shreds: u64,
exit: &Arc<AtomicBool>,
compaction_interval: Option<u64>,
max_compaction_jitter: Option<u64>
) -> Self
sourcepub fn cleanup_ledger(
new_root_receiver: &Receiver<Slot>,
blockstore: &Arc<Blockstore>,
max_ledger_shreds: u64,
last_purge_slot: &mut u64,
purge_interval: u64,
last_compact_slot: &Arc<AtomicU64>
) -> Result<(), RecvTimeoutError>
pub fn cleanup_ledger(
new_root_receiver: &Receiver<Slot>,
blockstore: &Arc<Blockstore>,
max_ledger_shreds: u64,
last_purge_slot: &mut u64,
purge_interval: u64,
last_compact_slot: &Arc<AtomicU64>
) -> Result<(), RecvTimeoutError>
Checks for new roots and initiates a cleanup if the last cleanup was at
least purge_interval
slots ago. A cleanup will no-op if the ledger
already has fewer than max_ledger_shreds
; otherwise, the cleanup will
purge enough slots to get the ledger size below max_ledger_shreds
.
[new_root_receiver
]: signal receiver which contains the information
about what Slot
is the current root.
[max_ledger_shreds
]: the number of shreds to keep since the new root.
[last_purge_slot
]: an both an input and output parameter indicating
the id of the last purged slot. As an input parameter, it works
together with purge_interval
on whether it is too early to perform
ledger cleanup. As an output parameter, it will be updated if this
function actually performs the ledger cleanup.
[purge_interval
]: the minimum slot interval between two ledger
cleanup. When the root derived from new_root_receiver
minus
last_purge_slot
is fewer than purge_interval
, the function will
simply return Ok
without actually running the ledger cleanup.
In this case, purge_interval
will remain unchanged.
[last_compact_slot
]: an output value which indicates the most recent
slot which has been cleaned up after this call. If this parameter is
updated after this function call, it means the ledger cleanup has
been performed.
Also see blockstore::purge_slot
.
pub fn compact_ledger(
blockstore: &Arc<Blockstore>,
last_compaction_slot: &mut u64,
compaction_interval: u64,
highest_compact_slot: &Arc<AtomicU64>,
compaction_jitter: &mut u64,
max_jitter: Option<u64>
)
pub fn join(self) -> Result<()>
Auto Trait Implementations
impl !RefUnwindSafe for LedgerCleanupService
impl Send for LedgerCleanupService
impl Sync for LedgerCleanupService
impl Unpin for LedgerCleanupService
impl !UnwindSafe for LedgerCleanupService
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 · sourcefn borrow_mut(&mut self) -> &mut T
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
sourcefn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message T
in a tonic::Request
sourceimpl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
sourcefn into_request(self) -> Request<T>
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
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 T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
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