Skip to content
13 changes: 12 additions & 1 deletion docs/book/src/batch-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum GroveOp {
Patch { element: Element, change_in_bytes: i32 },
RefreshReference { reference_path_type, max_reference_hop, flags, trust_refresh_reference },
Delete,
DeleteTree(TreeType), // Parameterized by tree type
DeleteTree(TreeType, SubelementsDeletionBehavior), // Per-op deletion policy

// Non-Merk tree append operations (user-facing):
CommitmentTreeInsert { cmx: [u8; 32], payload: Vec<u8> },
Expand All @@ -40,6 +40,17 @@ pub enum NonMerkTreeMeta {
}
```

**SubelementsDeletionBehavior** controls how a `DeleteTree` handles non-empty subtrees:

```rust
pub enum SubelementsDeletionBehavior {
DontCheck, // Skip emptiness check; caller guarantees tree is empty
Error, // Return Error::DeletingNonEmptyTree if non-empty
DeleteChildren, // Check, and recursively delete children if non-empty
Skip, // Check, and silently skip deletion if non-empty
}
```

Each operation is wrapped in a `QualifiedGroveDbOp` that includes the path:

```rust
Expand Down
2 changes: 1 addition & 1 deletion docs/book/translations/ar/src/batch-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum GroveOp {
Patch { element: Element, change_in_bytes: i32 },
RefreshReference { reference_path_type, max_reference_hop, flags, trust_refresh_reference },
Delete,
DeleteTree(TreeType), // Parameterized by tree type
DeleteTree(TreeType, SubelementsDeletionBehavior), // Per-op deletion policy

// Non-Merk tree append operations (user-facing):
CommitmentTreeInsert { cmx: [u8; 32], payload: Vec<u8> },
Expand Down
2 changes: 1 addition & 1 deletion docs/book/translations/cs/src/batch-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum GroveOp {
Patch { element: Element, change_in_bytes: i32 },
RefreshReference { reference_path_type, max_reference_hop, flags, trust_refresh_reference },
Delete,
DeleteTree(TreeType), // Parametrizovano typem stromu
DeleteTree(TreeType, SubelementsDeletionBehavior), // Per-op deletion policy

// Operace pridavani ne-Merk stromu (orientovane na uzivatele):
CommitmentTreeInsert { cmx: [u8; 32], payload: Vec<u8> },
Expand Down
2 changes: 1 addition & 1 deletion docs/book/translations/de/src/batch-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum GroveOp {
Patch { element: Element, change_in_bytes: i32 },
RefreshReference { reference_path_type, max_reference_hop, flags, trust_refresh_reference },
Delete,
DeleteTree(TreeType), // Parametrisiert nach Baumtyp
DeleteTree(TreeType, SubelementsDeletionBehavior), // Per-op deletion policy

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Translation is missing the SubelementsDeletionBehavior enum documentation.

The English source documentation (docs/book/src/batch-operations.md) includes a dedicated section documenting the SubelementsDeletionBehavior enum with all four variants (DontCheck, Error, DeleteChildren, Skip). This German translation updates the DeleteTree signature but omits the corresponding enum definition block, leaving readers without an explanation of the new parameter.

Consider adding the translated enum documentation after line 30 to match the English source structure.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/book/translations/de/src/batch-operations.md` at line 16, The German
translation is missing the SubelementsDeletionBehavior enum docs referenced by
the DeleteTree(TreeType, SubelementsDeletionBehavior) signature; add a
translated enum documentation block for SubelementsDeletionBehavior (listing and
describing the four variants: DontCheck, Error, DeleteChildren, Skip) and insert
it in the document structure after the existing section around line 30 so the
translation matches the English source's structure and explains the new
parameter.


// Nicht-Merk-Baum-Anhängeoperationen (benutzerseitig):
CommitmentTreeInsert { cmx: [u8; 32], payload: Vec<u8> },
Expand Down
2 changes: 1 addition & 1 deletion docs/book/translations/es/src/batch-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum GroveOp {
Patch { element: Element, change_in_bytes: i32 },
RefreshReference { reference_path_type, max_reference_hop, flags, trust_refresh_reference },
Delete,
DeleteTree(TreeType), // Parameterized by tree type
DeleteTree(TreeType, SubelementsDeletionBehavior), // Per-op deletion policy

// Non-Merk tree append operations (user-facing):
CommitmentTreeInsert { cmx: [u8; 32], payload: Vec<u8> },
Expand Down
2 changes: 1 addition & 1 deletion docs/book/translations/fr/src/batch-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum GroveOp {
Patch { element: Element, change_in_bytes: i32 },
RefreshReference { reference_path_type, max_reference_hop, flags, trust_refresh_reference },
Delete,
DeleteTree(TreeType), // Parameterized by tree type
DeleteTree(TreeType, SubelementsDeletionBehavior), // Per-op deletion policy

// Non-Merk tree append operations (user-facing):
CommitmentTreeInsert { cmx: [u8; 32], payload: Vec<u8> },
Expand Down
2 changes: 1 addition & 1 deletion docs/book/translations/id/src/batch-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum GroveOp {
Patch { element: Element, change_in_bytes: i32 },
RefreshReference { reference_path_type, max_reference_hop, flags, trust_refresh_reference },
Delete,
DeleteTree(TreeType), // Diparameterisasi berdasarkan tipe pohon
DeleteTree(TreeType, SubelementsDeletionBehavior), // Per-op deletion policy

// Operasi append pohon non-Merk (menghadap pengguna):
CommitmentTreeInsert { cmx: [u8; 32], payload: Vec<u8> },
Expand Down
2 changes: 1 addition & 1 deletion docs/book/translations/it/src/batch-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum GroveOp {
Patch { element: Element, change_in_bytes: i32 },
RefreshReference { reference_path_type, max_reference_hop, flags, trust_refresh_reference },
Delete,
DeleteTree(TreeType), // Parametrizzato per tipo di albero
DeleteTree(TreeType, SubelementsDeletionBehavior), // Per-op deletion policy

// Operazioni di append per alberi non-Merk (rivolte all'utente):
CommitmentTreeInsert { cmx: [u8; 32], payload: Vec<u8> },
Expand Down
2 changes: 1 addition & 1 deletion docs/book/translations/ja/src/batch-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum GroveOp {
Patch { element: Element, change_in_bytes: i32 },
RefreshReference { reference_path_type, max_reference_hop, flags, trust_refresh_reference },
Delete,
DeleteTree(TreeType), // Parameterized by tree type
DeleteTree(TreeType, SubelementsDeletionBehavior), // Per-op deletion policy

// Non-Merk tree append operations (user-facing):
CommitmentTreeInsert { cmx: [u8; 32], payload: Vec<u8> },
Expand Down
2 changes: 1 addition & 1 deletion docs/book/translations/ko/src/batch-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum GroveOp {
Patch { element: Element, change_in_bytes: i32 },
RefreshReference { reference_path_type, max_reference_hop, flags, trust_refresh_reference },
Delete,
DeleteTree(TreeType), // 트리 타입으로 매개변수화
DeleteTree(TreeType, SubelementsDeletionBehavior), // Per-op deletion policy

// 비-Merk 트리 추가 연산 (사용자 대면):
CommitmentTreeInsert { cmx: [u8; 32], payload: Vec<u8> },
Expand Down
2 changes: 1 addition & 1 deletion docs/book/translations/pl/src/batch-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum GroveOp {
Patch { element: Element, change_in_bytes: i32 },
RefreshReference { reference_path_type, max_reference_hop, flags, trust_refresh_reference },
Delete,
DeleteTree(TreeType), // Parametryzowane typem drzewa
DeleteTree(TreeType, SubelementsDeletionBehavior), // Per-op deletion policy

// Operacje dopisywania drzew nie-Merk (uzytkownika):
CommitmentTreeInsert { cmx: [u8; 32], payload: Vec<u8> },
Expand Down
2 changes: 1 addition & 1 deletion docs/book/translations/pt/src/batch-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum GroveOp {
Patch { element: Element, change_in_bytes: i32 },
RefreshReference { reference_path_type, max_reference_hop, flags, trust_refresh_reference },
Delete,
DeleteTree(TreeType), // Parametrizado pelo tipo de arvore
DeleteTree(TreeType, SubelementsDeletionBehavior), // Per-op deletion policy

// Operacoes de append para arvores nao-Merk (voltadas ao usuario):
CommitmentTreeInsert { cmx: [u8; 32], payload: Vec<u8> },
Expand Down
2 changes: 1 addition & 1 deletion docs/book/translations/ru/src/batch-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum GroveOp {
Patch { element: Element, change_in_bytes: i32 },
RefreshReference { reference_path_type, max_reference_hop, flags, trust_refresh_reference },
Delete,
DeleteTree(TreeType), // Parameterized by tree type
DeleteTree(TreeType, SubelementsDeletionBehavior), // Per-op deletion policy

// Non-Merk tree append operations (user-facing):
CommitmentTreeInsert { cmx: [u8; 32], payload: Vec<u8> },
Expand Down
2 changes: 1 addition & 1 deletion docs/book/translations/th/src/batch-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum GroveOp {
Patch { element: Element, change_in_bytes: i32 },
RefreshReference { reference_path_type, max_reference_hop, flags, trust_refresh_reference },
Delete,
DeleteTree(TreeType), // กำหนดพารามิเตอร์ตามประเภทต้นไม้
DeleteTree(TreeType, SubelementsDeletionBehavior), // Per-op deletion policy
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

// การดำเนินการ append สำหรับต้นไม้ non-Merk (ผู้ใช้เรียกใช้):
CommitmentTreeInsert { cmx: [u8; 32], payload: Vec<u8> },
Expand Down
2 changes: 1 addition & 1 deletion docs/book/translations/tr/src/batch-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum GroveOp {
Patch { element: Element, change_in_bytes: i32 },
RefreshReference { reference_path_type, max_reference_hop, flags, trust_refresh_reference },
Delete,
DeleteTree(TreeType), // Agac tipine gore parametrelenmis
DeleteTree(TreeType, SubelementsDeletionBehavior), // Per-op deletion policy

// Merk olmayan agac ekleme islemleri (kullaniciya yonelik):
CommitmentTreeInsert { cmx: [u8; 32], payload: Vec<u8> },
Expand Down
2 changes: 1 addition & 1 deletion docs/book/translations/vi/src/batch-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum GroveOp {
Patch { element: Element, change_in_bytes: i32 },
RefreshReference { reference_path_type, max_reference_hop, flags, trust_refresh_reference },
Delete,
DeleteTree(TreeType), // Tham số hóa theo kiểu cây
DeleteTree(TreeType, SubelementsDeletionBehavior), // Per-op deletion policy

// Thao tác thêm cho cây không phải Merk (dành cho người dùng):
CommitmentTreeInsert { cmx: [u8; 32], payload: Vec<u8> },
Expand Down
2 changes: 1 addition & 1 deletion docs/book/translations/zh/src/batch-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum GroveOp {
Patch { element: Element, change_in_bytes: i32 },
RefreshReference { reference_path_type, max_reference_hop, flags, trust_refresh_reference },
Delete,
DeleteTree(TreeType), // Parameterized by tree type
DeleteTree(TreeType, SubelementsDeletionBehavior), // Per-op deletion policy

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Translation is missing the SubelementsDeletionBehavior enum documentation.

Same as other translations, this Chinese translation updates the DeleteTree signature but omits the SubelementsDeletionBehavior enum definition block from the English source.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/book/translations/zh/src/batch-operations.md` at line 16, The Chinese
translation updated the DeleteTree signature but omitted the
SubelementsDeletionBehavior enum documentation; add the missing
SubelementsDeletionBehavior enum documentation block to this translation
(matching the English source) near the DeleteTree(TreeType,
SubelementsDeletionBehavior) line so the enum members and their descriptions are
present for Chinese readers and consistent with the original.


// Non-Merk tree append operations (user-facing):
CommitmentTreeInsert { cmx: [u8; 32], payload: Vec<u8> },
Expand Down
2 changes: 1 addition & 1 deletion grovedb/src/batch/batch_structure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ where
}
Ok(())
}
GroveOp::RefreshReference { .. } | GroveOp::Delete | GroveOp::DeleteTree(_) => {
GroveOp::RefreshReference { .. } | GroveOp::Delete | GroveOp::DeleteTree(..) => {
Ok(())
}
GroveOp::CommitmentTreeInsert { .. }
Expand Down
5 changes: 3 additions & 2 deletions grovedb/src/batch/estimated_costs/average_case_costs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ impl GroveOp {
propagate,
grove_version,
),
GroveOp::DeleteTree(tree_type) => GroveDb::average_case_merk_delete_tree(
GroveOp::DeleteTree(tree_type, _) => GroveDb::average_case_merk_delete_tree(
key,
*tree_type,
layer_element_estimates,
Expand Down Expand Up @@ -497,7 +497,7 @@ mod tests {
use crate::{
batch::{
estimated_costs::EstimatedCostsType::AverageCaseCostsType, key_info::KeyInfo, GroveOp,
KeyInfoPath, NonMerkTreeMeta, QualifiedGroveDbOp,
KeyInfoPath, NonMerkTreeMeta, QualifiedGroveDbOp, SubelementsDeletionBehavior,
},
reference_path::ReferencePathType,
tests::{common::EMPTY_PATH, make_empty_grovedb},
Expand Down Expand Up @@ -1226,6 +1226,7 @@ mod tests {
vec![vec![7]],
b"tree_key".to_vec(),
TreeType::NormalTree,
SubelementsDeletionBehavior::Error,
)];
let mut paths = HashMap::new();
paths.insert(
Expand Down
5 changes: 3 additions & 2 deletions grovedb/src/batch/estimated_costs/worst_case_costs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ impl GroveOp {
propagate,
grove_version,
),
GroveOp::DeleteTree(tree_type) => GroveDb::worst_case_merk_delete_tree(
GroveOp::DeleteTree(tree_type, _) => GroveDb::worst_case_merk_delete_tree(
key,
*tree_type,
worst_case_layer_element_estimates,
Expand Down Expand Up @@ -464,7 +464,7 @@ mod tests {
use crate::{
batch::{
estimated_costs::EstimatedCostsType::WorstCaseCostsType, key_info::KeyInfo, GroveOp,
KeyInfoPath, NonMerkTreeMeta, QualifiedGroveDbOp,
KeyInfoPath, NonMerkTreeMeta, QualifiedGroveDbOp, SubelementsDeletionBehavior,
},
reference_path::ReferencePathType,
tests::{common::EMPTY_PATH, make_empty_grovedb},
Expand Down Expand Up @@ -919,6 +919,7 @@ mod tests {
vec![vec![7]],
b"tree_key".to_vec(),
TreeType::NormalTree,
SubelementsDeletionBehavior::Error,
)];
let mut paths = HashMap::new();
paths.insert(KeyInfoPath(vec![]), MaxElementsNumber(1));
Expand Down
Loading
Loading