This commit is contained in:
binwiederhier
2026-06-03 20:38:19 -04:00
parent 93d45eba6f
commit 3e81620dac
5 changed files with 525 additions and 517 deletions
+8 -1
View File
@@ -23,9 +23,16 @@ import (
type accessCache struct {
exact map[string]map[string]aclEntry
pattern map[string][]aclEntry
mu sync.RWMutex // Protect exact and pattern
seq uint64 // Bumped on every apply; lets a slow full reload notice that a mutation raced its table scan
mu sync.RWMutex // Protect exact, pattern, and seq
}
// maxFullReloadRetries bounds how many extra times a full reload re-scans the
// table when a per-user mutation keeps landing mid-scan before it gives up for
// this cycle (the local mutation already kept the cache correct; only external
// writes are deferred to the next cycle).
const maxFullReloadRetries = 2
// aclEntry mirrors one user_access row. length feeds better()'s "longer
// pattern wins" tie-break; the stored topic/pattern string itself is not kept
// on the entry (the exact map already keys on it; surfacing wildcard "topics"