コード例 #1
0
        public long Snapshot(Stream output)
        {
            long sum = 0;

            Etcdserverpb.SnapshotRequest request = new Etcdserverpb.SnapshotRequest();
            var rsp = maintenanceClient.Snapshot(request);

            if (rsp.GetStatus().StatusCode == Grpc.Core.StatusCode.OK)
            {
                rsp.ResponseStream.Current.Blob.WriteTo(output);
                sum = rsp.ResponseStream.Current.Blob.Length;
                System.Threading.CancellationToken cancellationToken = new System.Threading.CancellationToken();
                while (true)
                {
                    var task = rsp.ResponseStream.MoveNext(cancellationToken);
                    if (task.Result)
                    {
                        rsp.ResponseStream.Current.Blob.WriteTo(output);
                        sum = rsp.ResponseStream.Current.Blob.Length;
                    }
                    else
                    {
                        break;
                    }
                }
            }
            return(sum);
        }
コード例 #2
0
        public long Snapshot()
        {
            Etcdserverpb.SnapshotRequest request = new Etcdserverpb.SnapshotRequest();
            var rsp = maintenanceClient.Snapshot(request);

            return(0);
        }