Skip to content

Commit

Permalink
etcdserver/api/v3rpc: watch with storagepb.WatchResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
gyuho committed Jan 3, 2016
1 parent b32db02 commit ffc77d3
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions etcdserver/api/v3rpc/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (

pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
"github.com/coreos/etcd/storage"
"github.com/coreos/etcd/storage/storagepb"
)

type watchServer struct {
Expand Down Expand Up @@ -111,20 +110,12 @@ func (sws *serverWatchStream) recvLoop() error {
func (sws *serverWatchStream) sendLoop() {
for {
select {
case evs, ok := <-sws.watchStream.Chan():
case wresp, ok := <-sws.watchStream.Chan():
if !ok {
return
}

// TODO: evs is []storagepb.Event type
// either return []*storagepb.Event from storage package
// or define protocol buffer with []storagepb.Event.
events := make([]*storagepb.Event, len(evs))
for i := range evs {
events[i] = &evs[i]
}

err := sws.gRPCStream.Send(&pb.WatchResponse{Events: events})
err := sws.gRPCStream.Send(&pb.WatchResponse{WatchId: wresp.WatchID, Events: wresp.Events})
storage.ReportEventReceived()
if err != nil {
return
Expand Down

0 comments on commit ffc77d3

Please sign in to comment.