Пример #1
0
 internal override void Visit(GetTxEntryRequest req)
 {
     this.HashId = req.TxId.ToString();
     byte[][] keyBytes =
     {
         Encoding.ASCII.GetBytes(TxTableEntry.STATUS_STRING),
         Encoding.ASCII.GetBytes(TxTableEntry.COMMIT_TIME_STRING),
         Encoding.ASCII.GetBytes(TxTableEntry.COMMIT_LOWER_BOUND_STRING)
     };
     this.RedisReq = new RedisRequest(this.HashId, keyBytes, RedisRequestType.HMGet)
     {
         ParentRequest = req
     };
 }
Пример #2
0
        internal override void Visit(GetTxEntryRequest req)
        {
            TxTableEntry txEntry = req.RemoteTxEntry;

            if (txEntry == null)
            {
                txEntry           = txTable[req.TxId];
                req.RemoteTxEntry = txEntry;
            }

            TxTableEntry.CopyValue(txEntry, req.LocalTxEntry);

            req.Result   = req.LocalTxEntry;
            req.Finished = true;
        }
Пример #3
0
        internal override void Visit(GetTxEntryRequest req)
        {
            byte[][] valueBytes = req.Result as byte[][];

            if (valueBytes == null || valueBytes.Length == 0)
            {
                req.Result = null;
            }
            else
            {
                TxTableEntry txEntry = req.LocalTxEntry;
                txEntry.Set(
                    req.TxId,
                    (TxStatus)BitConverter.ToInt32(valueBytes[0], 0),
                    BitConverter.ToInt64(valueBytes[1], 0),
                    BitConverter.ToInt64(valueBytes[2], 0));
                req.Result = txEntry;
            }
        }
Пример #4
0
        internal override void Visit(GetTxEntryRequest req)
        {
            string hashId = req.TxId.ToString();

            if (this.redisVersionDbMode == RedisVersionDbMode.Cluster)
            {
                hashId = RedisVersionDb.PACK_KEY(RedisVersionDb.TX_KEY_PREFIX, hashId);
            }

            byte[][] keyBytes =
            {
                Encoding.ASCII.GetBytes(TxTableEntry.STATUS_STRING),
                Encoding.ASCII.GetBytes(TxTableEntry.COMMIT_TIME_STRING),
                Encoding.ASCII.GetBytes(TxTableEntry.COMMIT_LOWER_BOUND_STRING)
            };

            RedisRequest redisReq = this.NextRedisRequest();

            redisReq.Set(hashId, keyBytes, RedisRequestType.HMGet);
            redisReq.ParentRequest = req;
        }
        internal override void Visit(GetTxEntryRequest req)
        {
            TxTableEntry txEntry = req.RemoteTxEntry;

            if (txEntry == null || req.TxId != txEntry.TxId)
            {
                if (!this.txTable.TryGetValue(req.TxId, out txEntry))
                {
                    throw new TransactionException("The specified tx does not exist.");
                }
                // return back the txEntry
                req.RemoteTxEntry = txEntry;
            }

            while (Interlocked.CompareExchange(ref txEntry.latch, 1, 0) != 0)
            {
                ;
            }
            TxTableEntry.CopyValue(txEntry, req.LocalTxEntry);
            Interlocked.Exchange(ref txEntry.latch, 0);

            req.Result   = req.LocalTxEntry;
            req.Finished = true;
        }
Пример #6
0
 internal virtual void Visit(GetTxEntryRequest req)
 {
 }