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;
        }
Exemplo n.º 2
0
        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
            };
        }
Exemplo n.º 3
0
 internal override void Visit(NewTxIdRequest req)
 {
     try
     {
         long ret = (long)req.Result;
         req.Result = ret == 1L;
     }
     catch (Exception)
     {
         req.Result = false;
     }
 }
Exemplo n.º 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;
        }
Exemplo n.º 5
0
        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;
        }
Exemplo n.º 6
0
 internal virtual void Visit(NewTxIdRequest req)
 {
 }