From 45c6d128b3be11383df6485918011df8cdef4120 Mon Sep 17 00:00:00 2001 From: Ashesh Vidyut <134911583+absolutelightning@users.noreply.github.com> Date: Fri, 21 Jun 2024 15:50:57 +0530 Subject: [PATCH] Absl (#97) * Ref counting (#5) * Reference counting * reference counting with memdb tests passing * removed atomic add * fixes in watch * fix go mod * fix memdb tests --- txn.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/txn.go b/txn.go index 73c705e..6e8505c 100644 --- a/txn.go +++ b/txn.go @@ -59,10 +59,10 @@ func (t *RadixTree[T]) Txn(clone bool) *Txn[T] { // Clone makes an independent copy of the transaction. The new transaction // does not track any nodes and has TrackMutate turned off. The cloned transaction will contain any uncommitted writes in the original transaction but further mutations to either will be independent and result in different radix trees on Commit. A cloned transaction may be passed to another goroutine and mutated there independently however each transaction may only be mutated in a single thread. -func (t *Txn[T]) Clone() *Txn[T] { +func (t *Txn[T]) Clone(deep bool) *Txn[T] { // reset the writable node cache to avoid leaking future writes into the clone newTree := &RadixTree[T]{ - t.tree.root.clone(true, false), + t.tree.root.clone(true, deep), t.size, t.tree.maxNodeId, }