Actor-Model Socket Registry
+ Add Socket
? Get Socket
- Delete Socket
∞ Iterate
What a mutex looks like
Reset
Caller Goroutines
Channel Registry & Actor
State (Socket Map)
sole writer
resp
MUTEX LOCK
client 1
client 2
broadcast
gc sweep
addSocketC
getSocketC
deleteSocketC
iterateSocketsC
OPERATE
(ACTOR LOOP)
single thread
socketMap
0x01
0x02
0x03
0x04
0x05
0x06
0x07
0x08
0x09
0x0A
0x0B
0x0C
Operations Served:
0
Callers Waiting:
0
Active Sockets:
3 / 12
Trade-off: Race-free and simple to reason about, but every lookup is serialized through one goroutine.