File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -116,6 +116,37 @@ impl<
116116
117117 /// Adds the provided checkpoint to the set of checkpoints to be retained
118118 /// across pruning operations.
119+ ///
120+ /// TODO: A bit more documentation.
121+ ///
122+ /// # Examples
123+ ///
124+ /// ```
125+ /// use incrementalmerkletree::Retention;
126+ /// use shardtree::ShardTree;
127+ ///
128+ /// # fn load_shardtree_from_disk() -> ShardTree<SomeShardStore> {
129+ /// # todo!("Kris returns something useful for testing here.")
130+ /// # }
131+ /// # fn checkpoints_to_retain() -> Vec<SomeCheckpointId> {
132+ /// # vec![] // TODO: Return something useful for testing here.
133+ /// # }
134+ /// # fn get_next_leaf() -> SomeLeafType {
135+ /// # todo!("Kris returns something useful for testing here.")
136+ /// # }
137+ /// # fn main() -> Result<(), Box<dyn std::error::Error>> {
138+ /// let mut tree = load_shardtree_from_disk();
139+ ///
140+ /// // The required checkpoints are stored separately from the tree.
141+ /// for checkpoint_id in checkpoints_to_retain() {
142+ /// tree.ensure_retained(checkpoint_id);
143+ /// }
144+ ///
145+ /// // Now perform operations that might prune the tree.
146+ /// tree.append(get_next_leaf(), Retention::Ephemeral)?;
147+ /// # Ok(())
148+ /// # }
149+ /// ```
119150 pub fn ensure_retained ( & mut self , checkpoint_id : C ) {
120151 self . to_retain . insert ( checkpoint_id) ;
121152 }
You can’t perform that action at this time.
0 commit comments