Commit d704b413 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 2dad1860
......@@ -249,17 +249,24 @@ func (s *storage) watcher() {
return
}
switch event := event.(type) {
switch e := event.(type) {
default:
panic(fmt.Sprintf("unexpected event: %T", event))
panic(fmt.Sprintf("unexpected event: %T", e))
case *EventError:
// ok
case *EventCommit:
// XXX verify event.Tid ↑ (else e.g. δtail.Append will panic)
// verify event.Tid ↑ (else e.g. δtail.Append will panic)
// if !↑ - stop the storage with error.
s.drvHead = event.Tid
if !(e.Tid > s.drvHead) {
event = &EventError{fmt.Errorf(
"%s: driver notified with δ.tid not ↑ (%s -> %s)",
s.URL(), s.drvHead, e.Tid)}
// XXX also shutdown storage
} else {
s.drvHead = e.Tid
}
}
// deliver event to all watchers
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment