Exemplo n.º 1
0
 internal override void Visit(ReadVersionRequest req)
 {
     byte[] valueBytes = req.Result as byte[];
     req.Result = valueBytes == null || valueBytes.Length == 0 ?
                  null :
                  VersionEntry.Deserialize(req.VersionKey, valueBytes, req.LocalVerEntry);
 }
Exemplo n.º 2
0
 internal override void Visit(ReplaceVersionRequest req)
 {
     byte[][] returnBytes = req.Result as byte[][];
     req.Result = returnBytes == null || returnBytes.Length == 0 ?
                  null :
                  VersionEntry.Deserialize(
         req.VersionKey,
         returnBytes.ValueBytes(), req.LocalVerEntry);
 }
Exemplo n.º 3
0
 internal override void Visit(UpdateVersionMaxCommitTsRequest req)
 {
     byte[][] returnBytes = req.Result as byte[][];
     req.Result = returnBytes == null || returnBytes.Length < 2 ?
                  null :
                  VersionEntry.Deserialize(
         req.VersionKey,
         returnBytes.ValueBytes(), req.LocalVerEntry);
 }
Exemplo n.º 4
0
        private int ExtractVersionEntry(
            byte[][] response, TxList <VersionEntry> dest)
        {
            Debug.Assert(response.Length <= 4 || response.Length % 2 == 0);
            int entryCount = response.Length / 2;

            long[] debugKeys = new long[entryCount];
            for (int i = 0; i < entryCount; ++i)
            {
                int  versionKeyIndex = i * 2;
                long versionKey      = BitConverter.ToInt64(
                    response[versionKeyIndex], 0);
                byte[] entryBytes = response[versionKeyIndex + 1];
                VersionEntry.Deserialize(
                    versionKey, entryBytes, dest[i]);
                debugKeys[i] = versionKey;
            }
            if (debugKeys.Length == 2)
            {
                Debug.Assert(debugKeys[0] + 1 == debugKeys[1]);
            }
            return(entryCount);
        }