Skip to content

Commit

Permalink
trigger tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kaatinga committed Mar 12, 2024
1 parent df074ac commit addd228
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion avl_models.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package luna

// Item is an AVL tree node
// Item is an AVL tree node.
type Item[K Ordered, V any] struct {
Key K
Value V
Expand Down
2 changes: 2 additions & 0 deletions worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func (c *WorkerPool[K, V]) Get(key K) *Item[K, V] {
return itm
}

// Do executes a function on the item with the given key and updates the item with the result of the function.
func (c *WorkerPool[K, V]) Do(key K, f func(*Item[K, V]) *Item[K, V]) (executed bool) {
c.me.Lock()
itm := Search(c.Root, key)
Expand All @@ -56,6 +57,7 @@ func (c *WorkerPool[K, V]) Do(key K, f func(*Item[K, V]) *Item[K, V]) (executed
return
}

// Read executes a function on the item with the given key but does not update the item with the result of the function.
func (c *WorkerPool[K, V]) Read(key K, f func(*Item[K, V])) (executed bool) {
c.me.Lock()
itm := Search(c.Root, key)
Expand Down

0 comments on commit addd228

Please sign in to comment.