Skip to content

Commit

Permalink
Absl (#97)
Browse files Browse the repository at this point in the history
* Ref counting (#5)

* Reference counting

* reference counting with memdb tests passing

* removed atomic add

* fixes in watch

* fix go mod

* fix memdb tests
  • Loading branch information
absolutelightning committed Jun 21, 2024
1 parent 1a49496 commit 45c6d12
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions txn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down

0 comments on commit 45c6d12

Please sign in to comment.