Repository navigation
Expand file tree
/
Copy pathexport_test.go
More file actions
48 lines (43 loc) · 1.81 KB
/
Copy pathexport_test.go
File metadata and controls
48 lines (43 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package chat
// AdmissionTenantEntries reports the number of live per-tenant admission
// counter entries, for hardening tests proving a tenant whose deliveries all
// released capacity retains no counter entry (ADR 0015 bounded retention).
func AdmissionTenantEntries(c *Chat) int {
assert(c != nil, "AdmissionTenantEntries called on nil runtime")
return c.admission.tenantEntries()
}
// BurstScopeCount reports the number of live burst scope coordinators, for
// hardening tests proving an idle scope retains no map entry (ADR 0015 bounded
// retention).
func BurstScopeCount(c *Chat) int {
assert(c != nil, "BurstScopeCount called on nil runtime")
c.burstMu.Lock()
defer c.burstMu.Unlock()
return len(c.burstScopes)
}
// QueueTurnCount reports the number of live queue turn records, for hardening
// tests proving an idle scope retains no record (ADR 0015 bounded retention).
func QueueTurnCount(c *Chat) int {
assert(c != nil, "QueueTurnCount called on nil runtime")
c.queueMu.Lock()
defer c.queueMu.Unlock()
return len(c.queueTurns)
}
// QueuePendingCount reports the number of live pending queue waiters, for
// hardening tests proving a waiter that ended leaves no stale entry.
func QueuePendingCount(c *Chat) int {
assert(c != nil, "QueuePendingCount called on nil runtime")
c.queueMu.Lock()
defer c.queueMu.Unlock()
return len(c.pending)
}
// QueueDeferredRelease enters scope's queue turn record as the prelude does
// and returns the deferred release dispatch builds for that delivery, with a
// no-op admission release, for hardening tests proving a repeated release
// leaves the scope once.
func QueueDeferredRelease(c *Chat, scope string) func() {
assert(c != nil, "QueueDeferredRelease called on nil runtime")
entry := &queueEntry{}
c.enterQueueScope(scope, entry)
return c.deferredRelease(entry, func() {})
}