@@ -46,7 +46,7 @@ const (
4646 InvalidWatchID = - 1
4747)
4848
49- type Event mvccpb.Event
49+ type Event = mvccpb.Event
5050
5151type WatchChan <- chan WatchResponse
5252
@@ -116,16 +116,6 @@ type WatchResponse struct {
116116 CancelReason string
117117}
118118
119- // IsCreate returns true if the event tells that the key is newly created.
120- func (e * Event ) IsCreate () bool {
121- return e .Type == EventTypePut && e .Kv .CreateRevision == e .Kv .ModRevision
122- }
123-
124- // IsModify returns true if the event tells that a new value is put on existing key.
125- func (e * Event ) IsModify () bool {
126- return e .Type == EventTypePut && e .Kv .CreateRevision != e .Kv .ModRevision
127- }
128-
129119// Err is the error value if this WatchResponse holds an error.
130120func (wr * WatchResponse ) Err () error {
131121 switch {
@@ -719,14 +709,10 @@ func (w *watchGRPCStream) nextResume() *watcherStream {
719709
720710// dispatchEvent sends a WatchResponse to the appropriate watcher stream
721711func (w * watchGRPCStream ) dispatchEvent (pbresp * pb.WatchResponse ) bool {
722- events := make ([]* Event , len (pbresp .Events ))
723- for i , ev := range pbresp .Events {
724- events [i ] = (* Event )(ev )
725- }
726712 // TODO: return watch ID?
727713 wr := & WatchResponse {
728714 Header : ensureWatchHeader (pbresp .Header ),
729- Events : events ,
715+ Events : pbresp . Events ,
730716 CompactRevision : pbresp .CompactRevision ,
731717 Created : pbresp .Created ,
732718 Canceled : pbresp .Canceled ,
0 commit comments