예제 #1
0
        public IWatcher Watch(ByteSequence key, WatchOption watchOption)
        {
            if (IsClosed())
            {
                throw new ClosedWatchClientException();
            }
            WatcherImpl watcher = new WatcherImpl(key, watchOption, this);

            // this.pendingWatchers.Enqueue(watcher);

            Etcdserverpb.WatchRequest       request       = new Etcdserverpb.WatchRequest();
            Etcdserverpb.WatchCreateRequest createRequest = new Etcdserverpb.WatchCreateRequest();
            createRequest.Key            = key.GetByteString();
            createRequest.PrevKv         = watchOption.isPrevKV();
            createRequest.ProgressNotify = watchOption.isProgressNotify();
            createRequest.RangeEnd       = watchOption.getEndKey().GetByteString();
            createRequest.StartRevision  = watchOption.getRevision();
            request.CreateRequest        = createRequest;
            Grpc.Core.CallOptions callOptions = new Grpc.Core.CallOptions();
            watchClient.Watch(callOptions);
            // watchClient.Watch()
            // watchClient.Watch()

            //  if (this.pendingWatchers.Count == 1) {
            // head of the queue send watchCreate request.
            //  WatchRequest request = this.toWatchCreateRequest(watcher);
            // this.getGrpcWatchStreamObserver().onNext(request);
            // }

            return(watcher);
        }
예제 #2
0
 public WatcherImpl(ByteSequence key, WatchOption watchOption, WatchImpl owner)
 {
     this.key         = key;
     this.watchOption = watchOption;
     this.revision    = watchOption.getRevision();
     this.owner       = owner;
 }