forked from aptos-labs/aptos-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Storage][Pruner] Batch pruning support
- Loading branch information
1 parent
9ca378b
commit 203c831
Showing
15 changed files
with
262 additions
and
339 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) Aptos | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use schemadb::SchemaBatch; | ||
|
||
/// Defines the trait for sub-pruner of a parent DB pruner | ||
pub trait DBSubPruner { | ||
/// Performs the actual pruning, a target version is passed, which is the target the pruner | ||
/// tries to prune. | ||
fn prune( | ||
&self, | ||
db_batch: &mut SchemaBatch, | ||
least_readable_version: u64, | ||
target_version: u64, | ||
) -> anyhow::Result<()>; | ||
} |
98 changes: 22 additions & 76 deletions
98
storage/aptosdb/src/pruner/event_store/event_store_pruner.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
storage/aptosdb/src/pruner/ledger_store/ledger_counter_pruner.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) Aptos | ||
// SPDX-License-Identifier: Apache-2.0 | ||
use crate::{pruner::db_sub_pruner::DBSubPruner, LedgerStore}; | ||
use schemadb::SchemaBatch; | ||
use std::sync::Arc; | ||
|
||
pub struct LedgerCounterPruner { | ||
/// Keeps track of the target version that the pruner needs to achieve. | ||
ledger_store: Arc<LedgerStore>, | ||
} | ||
|
||
impl DBSubPruner for LedgerCounterPruner { | ||
fn prune( | ||
&self, | ||
db_batch: &mut SchemaBatch, | ||
least_readable_version: u64, | ||
target_version: u64, | ||
) -> anyhow::Result<()> { | ||
self.ledger_store | ||
.prune_ledger_couners(least_readable_version, target_version, db_batch)?; | ||
Ok(()) | ||
} | ||
} | ||
|
||
impl LedgerCounterPruner { | ||
pub fn new(ledger_store: Arc<LedgerStore>) -> Self { | ||
LedgerCounterPruner { ledger_store } | ||
} | ||
} |
Oops, something went wrong.