Example #1
0
        public async Task <MutateResponse> Append(MutateCall apd, CancellationToken?token = null)
        {
            apd.MutationType = MutationProto.Types.MutationType.Append;
            var res = await SendRPCToRegion <MutateResponse>(apd, token);

            return(res);
        }
Example #2
0
        public async Task <MutateResponse> Delete(MutateCall del, CancellationToken?token = null)
        {
            del.MutationType = MutationProto.Types.MutationType.Delete;
            var res = await SendRPCToRegion <MutateResponse>(del, token);

            return(res);
        }
Example #3
0
        public async Task <MutateResponse> Put(MutateCall put, CancellationToken?token = null)
        {
            put.MutationType = MutationProto.Types.MutationType.Put;
            var res = await SendRPCToRegion <MutateResponse>(put, token);

            return(res);
        }
Example #4
0
        public async Task <bool> CheckAndPut(MutateCall put, string family, string qualifier,
                                             byte[] expectedValue, CancellationToken?token = null)
        {
            var cas = new CheckAndPutCall(put, family, qualifier, expectedValue);
            var res = await SendRPCToRegion <MutateResponse>(cas, token);

            return(res != null && res.Processed);
        }
Example #5
0
        public async Task ExecCheckAndPut()
        {
            var rowKey = Program.GenerateRandomKey();
            var put    = new MutateCall(Program.Table, rowKey, Program.Values);
            var result = await _client.CheckAndPut(put, ConstString.DefaultFamily, "key", null, new CancellationToken());

            Log.Information($"check and put key:{rowKey},result:{result}");
            result = await _client.CheckAndPut(put, ConstString.DefaultFamily, "key", null, new CancellationToken());

            Log.Information($"check and put key:{rowKey} again,result:{result}");
        }
Example #6
0
        public async Task <long?> Increment(MutateCall inc, CancellationToken?token = null)
        {
            inc.MutationType = MutationProto.Types.MutationType.Increment;
            var res = await SendRPCToRegion <MutateResponse>(inc, token);

            if (res?.Result?.Cell?.Count == 1)
            {
                return((long)BinaryPrimitives.ReadUInt64BigEndian(res?.Result?.Cell[0].Value.ToByteArray()));
            }

            return(null);
        }