revert: Entry -> entry bc Put() doesnt use it
All checks were successful
CI / Check PR Title (pull_request) Successful in 31s
CI / Go Lint (pull_request) Successful in 56s
CI / Markdown Lint (pull_request) Successful in 35s
CI / Makefile Lint (pull_request) Successful in 54s
CI / Unit Tests (pull_request) Successful in 56s
CI / Fuzz Tests (pull_request) Successful in 1m25s
CI / Mutation Tests (pull_request) Successful in 1m9s
All checks were successful
CI / Check PR Title (pull_request) Successful in 31s
CI / Go Lint (pull_request) Successful in 56s
CI / Markdown Lint (pull_request) Successful in 35s
CI / Makefile Lint (pull_request) Successful in 54s
CI / Unit Tests (pull_request) Successful in 56s
CI / Fuzz Tests (pull_request) Successful in 1m25s
CI / Mutation Tests (pull_request) Successful in 1m9s
This commit is contained in:
14
table.go
14
table.go
@@ -57,12 +57,12 @@ func (t *Table[K, V]) load() float64 {
|
||||
// insert attempts to put/update an entry in the table, without modifying the
|
||||
// size of the table. Returns a displaced entry and 'homeless = true' if an
|
||||
// entry could not be placed after exhausting evictions.
|
||||
func (t *Table[K, V]) insert(entry Entry[K, V]) (displaced Entry[K, V], homeless bool) {
|
||||
if t.tableA.update(entry.Key, entry.Value) {
|
||||
func (t *Table[K, V]) insert(entry entry[K, V]) (displaced entry[K, V], homeless bool) {
|
||||
if t.tableA.update(entry.key, entry.value) {
|
||||
return
|
||||
}
|
||||
|
||||
if t.tableB.update(entry.Key, entry.Value) {
|
||||
if t.tableB.update(entry.key, entry.value) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ func (t *Table[K, V]) resize(capacity uint64) bool {
|
||||
updated := t.resized(capacity)
|
||||
|
||||
for k, v := range t.Entries() {
|
||||
if _, failed := updated.insert(Entry[K, V]{k, v}); failed {
|
||||
if _, failed := updated.insert(entry[K, V]{k, v}); failed {
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -156,7 +156,7 @@ func (t *Table[K, V]) Has(key K) (exists bool) {
|
||||
// Put sets the value for a key. If it cannot be set, an error is returned.
|
||||
func (t *Table[K, V]) Put(key K, value V) (err error) {
|
||||
var (
|
||||
entry = Entry[K, V]{key, value}
|
||||
entry = entry[K, V]{key, value}
|
||||
homeless bool
|
||||
)
|
||||
|
||||
@@ -202,7 +202,7 @@ func (t *Table[K, V]) Entries() iter.Seq2[K, V] {
|
||||
return func(yield func(K, V) bool) {
|
||||
for _, slot := range t.tableA.slots {
|
||||
if slot.occupied {
|
||||
if !yield(slot.Key, slot.Value) {
|
||||
if !yield(slot.key, slot.value) {
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -210,7 +210,7 @@ func (t *Table[K, V]) Entries() iter.Seq2[K, V] {
|
||||
|
||||
for _, slot := range t.tableB.slots {
|
||||
if slot.occupied {
|
||||
if !yield(slot.Key, slot.Value) {
|
||||
if !yield(slot.key, slot.value) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user