SetCallback sets a function to execute whenever new peers are refreshed or updated.
(callback func())
| 442 | // SetCallback sets a function to execute whenever new peers |
| 443 | // are refreshed or updated. |
| 444 | func (m *Manager) SetCallback(callback func()) { |
| 445 | m.mutex.Lock() |
| 446 | defer m.mutex.Unlock() |
| 447 | m.callback = callback |
| 448 | // Instantly call the callback to inform replicas! |
| 449 | go callback() |
| 450 | } |
| 451 | |
| 452 | func (m *Manager) Close() error { |
| 453 | m.closeMutex.Lock() |