internal override void Visit(NewTxIdRequest req)
        {
            TxTableEntry txEntry = new TxTableEntry();

            req.Result        = this.txTable.TryAdd(req.TxId, txEntry) ? true : false;
            req.RemoteTxEntry = txEntry;
            req.Finished      = true;
        }
        internal override void Visit(NewTxIdRequest req)
        {
            this.HashId = req.TxId.ToString();
            byte[] keyBytes   = Encoding.ASCII.GetBytes(TxTableEntry.TXID_STRING);
            byte[] valueBytes = BitConverter.GetBytes(req.TxId);

            this.RedisReq = new RedisRequest(this.HashId, keyBytes, valueBytes, RedisRequestType.HSetNX)
            {
                ParentRequest = req
            };
        }
 internal override void Visit(NewTxIdRequest req)
 {
     try
     {
         long ret = (long)req.Result;
         req.Result = ret == 1L;
     }
     catch (Exception)
     {
         req.Result = false;
     }
 }
Beispiel #4
0
        internal override void Visit(NewTxIdRequest req)
        {
            if (this.txTable.ContainsKey(req.TxId))
            {
                req.Result = false;
            }
            else
            {
                TxTableEntry txEntry = new TxTableEntry();
                this.txTable.Add(req.TxId, txEntry);
                req.RemoteTxEntry = txEntry;
                req.Result        = true;
            }

            req.Finished = true;
        }
        internal override void Visit(NewTxIdRequest 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.TXID_STRING);
            byte[] valueBytes = BitConverter.GetBytes(req.TxId);

            RedisRequest redisReq = this.NextRedisRequest();

            redisReq.Set(hashId, keyBytes, valueBytes, RedisRequestType.HSetNX);
            redisReq.ParentRequest = req;
        }
Beispiel #6
0
 internal virtual void Visit(NewTxIdRequest req)
 {
 }