Skip to content

Commit 5cf60dd

Browse files
committed
docs: Update comments on patch
1 parent 628affc commit 5cf60dd

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

mutable_tree.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -771,11 +771,14 @@ func (tree *MutableTree) SaveVersion() ([]byte, int64, error) {
771771
}
772772
}
773773

774-
// PATCH for backwards compatibility:
775-
// On InitialVersion, this is a new tree.
776-
// Add a reference node from InitialVersion -> 1 (root node)
777-
// Note: Node version != nodekey.Version due to patch
774+
// Addition to node version patch for backwards compatibility:
775+
// This is to resolve queries at InitialVersion, loading the tree at
776+
// InitialVersion when the root node has version 1.
777+
// Note: version != nodekey.Version due to patch.
778778
if tree.ndb.opts.InitialVersion > 0 && version == int64(tree.ndb.opts.InitialVersion) {
779+
// SaveRoot is meant for saving a tree when there are no updates, which
780+
// simply creates a reference node to the root node. We reuse this to
781+
// create a reference node from InitialVersion -> 1 (root node).
779782
if err := tree.ndb.SaveRoot(version, tree.root.nodeKey); err != nil {
780783
return nil, 0, err
781784
}

0 commit comments

Comments
 (0)