| 12345678910111213141516 |
- package raft
- // WatchHandler defines the function signature for watching key changes
- type WatchHandler func(key, value string, eventType KVCommandType)
- // Watcher interface for specialized handling
- type Watcher interface {
- OnWait(key, value string, eventType KVCommandType)
- }
- // WatcherWrapper adapts a Watcher interface to a WatchHandler function
- func WatcherWrapper(w Watcher) WatchHandler {
- return func(key, value string, eventType KVCommandType) {
- w.OnWait(key, value, eventType)
- }
- }
|