Add registers c. Returns false if an entry for the same tuple already exists.
(c *Connection)
| 111 | |
| 112 | // Add registers c. Returns false if an entry for the same tuple already exists. |
| 113 | func (t *Table) Add(c *Connection) bool { |
| 114 | t.mu.Lock() |
| 115 | defer t.mu.Unlock() |
| 116 | if _, exists := t.m[c.Tuple]; exists { |
| 117 | return false |
| 118 | } |
| 119 | t.m[c.Tuple] = c |
| 120 | return true |
| 121 | } |
| 122 | |
| 123 | // Get returns the connection for the given tuple, if any. |
| 124 | func (t *Table) Get(k Tuple) (*Connection, bool) { |
no outgoing calls