mirror of
https://github.com/status-im/consul.git
synced 2025-01-10 22:06:20 +00:00
subscribe: update to use NewSnapshotToFollow event
This commit is contained in:
parent
e3290f5971
commit
f5d11562f2
@ -10,7 +10,7 @@ import (
|
||||
// event is allowed to be sent to this client or not.
|
||||
func enforceACL(authz acl.Authorizer, e stream.Event) acl.EnforcementDecision {
|
||||
switch {
|
||||
case e.IsEndOfSnapshot(), e.IsEndOfEmptySnapshot():
|
||||
case e.IsEndOfSnapshot(), e.IsNewSnapshotToFollow():
|
||||
return acl.Allow
|
||||
}
|
||||
|
||||
|
@ -59,10 +59,11 @@ func (l *eventLogger) Trace(e []stream.Event) {
|
||||
|
||||
first := e[0]
|
||||
switch {
|
||||
case first.IsEndOfSnapshot() || first.IsEndOfEmptySnapshot():
|
||||
case first.IsEndOfSnapshot():
|
||||
l.snapshotDone = true
|
||||
l.logger.Trace("snapshot complete", "index", first.Index, "sent", l.count)
|
||||
|
||||
case first.IsNewSnapshotToFollow():
|
||||
return
|
||||
case l.snapshotDone:
|
||||
l.logger.Trace("sending events", "index", first.Index, "sent", l.count, "batch_size", len(e))
|
||||
}
|
||||
|
@ -169,8 +169,8 @@ func newEventFromStreamEvents(req *pbsubscribe.SubscribeRequest, events []stream
|
||||
case event.IsEndOfSnapshot():
|
||||
e.Payload = &pbsubscribe.Event_EndOfSnapshot{EndOfSnapshot: true}
|
||||
return e
|
||||
case event.IsEndOfEmptySnapshot():
|
||||
e.Payload = &pbsubscribe.Event_EndOfEmptySnapshot{EndOfEmptySnapshot: true}
|
||||
case event.IsNewSnapshotToFollow():
|
||||
e.Payload = &pbsubscribe.Event_NewSnapshotToFollow{NewSnapshotToFollow: true}
|
||||
return e
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user