Esempio n. 1
0
 public void Set(long txId, TxStatus status, long commitTime, long commitLowerBound)
 {
     this.TxId             = txId;
     this.Status           = status;
     this.CommitTime       = commitTime;
     this.CommitLowerBound = commitLowerBound;
 }
Esempio n. 2
0
        public Transaction(
            ILogStore logStore,
            VersionDb versionDb,
            long txId = -1,
            Queue <long> garbageQueueTxId       = null,
            Queue <long> garbageQueueFinishTime = null)
        {
            this.logStore             = logStore;
            this.versionDb            = versionDb;
            this.readSet              = new Dictionary <string, Dictionary <object, ReadSetEntry> >();
            this.writeSet             = new Dictionary <string, Dictionary <object, object> >();
            this.abortSet             = new Dictionary <string, Dictionary <object, List <PostProcessingEntry> > >();
            this.commitSet            = new Dictionary <string, Dictionary <object, List <PostProcessingEntry> > >();
            this.largestVersionKeyMap = new Dictionary <string, Dictionary <object, long> >();
            this.validationVersions   = new List <Tuple <string, object, VersionEntry> >();

            this.txId     = txId < 0 ? this.versionDb.InsertNewTx() : txId;
            this.txStatus = TxStatus.Ongoing;

            this.commitTs            = TxTableEntry.DEFAULT_COMMIT_TIME;
            this.maxCommitTsOfWrites = -1L;
            this.beginTimestamp      = Transaction.DEFAULT_TX_BEGIN_TIMESTAMP;

            this.garbageQueueTxId       = garbageQueueTxId;
            this.garbageQueueFinishTime = garbageQueueFinishTime;
        }
Esempio n. 3
0
 public void Set(long txId, TxStatus status, TxTableEntry remoteEntry = null)
 {
     this.TxId          = txId;
     this.SenderId      = txId;
     this.TxStatus      = status;
     this.RemoteTxEntry = remoteEntry;
 }
Esempio n. 4
0
 public TxTableEntry(long txId, TxStatus status, long commitTime, long commitLowerBound)
 {
     this.TxId             = txId;
     this.Status           = status;
     this.CommitTime       = commitTime;
     this.CommitLowerBound = commitLowerBound;
 }
Esempio n. 5
0
        public void Clear(long txId)
        {
            this.readSet.Clear();
            this.writeSet.Clear();
            this.abortSet.Clear();
            this.commitSet.Clear();
            this.largestVersionKeyMap.Clear();
            this.validationVersions.Clear();

            this.txId     = txId;
            this.txStatus = TxStatus.Ongoing;

            this.commitTs            = TxTableEntry.DEFAULT_COMMIT_TIME;
            this.maxCommitTsOfWrites = -1L;
            this.beginTimestamp      = Transaction.DEFAULT_TX_BEGIN_TIMESTAMP;
        }
        public async Task UpdateStatusAsync(string id, TxStatus status)
        {
            using (var context = _contextFactory.CreateDataContext())
            {
                var entity = await context.TransactionReports.FindAsync(Guid.Parse(id));

                if (entity == null)
                {
                    throw new InvalidOperationException($"Could find operation with id = {id}");
                }

                entity.Status = status.ToString();
                context.Update(entity);

                await context.SaveChangesAsync();
            }
        }
Esempio n. 7
0
        public Transaction Confirm(String txHash, int maxAttempts, int interval)
        {
            this.Status = TxStatus.Pending;
            for (int i = 0; i < maxAttempts; i++)
            {
                bool tracked = this.TrackTx(txHash);
                Thread.Sleep(interval * 1000);

                if (tracked)
                {
                    this.Status = TxStatus.Confirmed;
                    return(this);
                }
            }
            this.Status = TxStatus.Rejected;
            return(this);
        }
Esempio n. 8
0
        public bool TrackTx(string txHash)
        {
            Transaction response;

            try
            {
                response = this.Provider.GetTransaction(txHash).Result;
            }
            catch (IOException e)
            {
                Console.WriteLine("transaction not confirmed yet");
                return(false);
            }

            if (null == response)
            {
                Console.WriteLine("transaction not confirmed yet");
                return(false);
            }


            this.ID      = response.ID;
            this.Receipt = response.Receipt;

            if (response.Receipt != null && response.Receipt.Success)
            {
                Console.WriteLine("Transaction confirmed!");
                this.Status = TxStatus.Confirmed;
            }
            else
            {
                this.Status = TxStatus.Rejected;
                Console.WriteLine("Transaction rejected!");
            }
            return(true);
        }
Esempio n. 9
0
 private void FilterUTXO_Checked(object sender, RoutedEventArgs e)
 {
     filterOff    = false;
     filterStatus = TxStatus.UTXO;
     Refresh();
 }
Esempio n. 10
0
 private void FilterReceived_Checked(object sender, RoutedEventArgs e)
 {
     filterOff    = false;
     filterStatus = TxStatus.Received;
     Refresh();
 }
 public TxResult(TxStatus status, long?blockIndex, string?blockHash)
 {
     TxStatus   = status;
     BlockIndex = blockIndex;
     BlockHash  = blockHash;
 }
Esempio n. 12
0
 public UpdateTxStatusRequest(long txId, TxStatus status)
     : base(txId)
 {
     this.TxStatus = status;
 }
Esempio n. 13
0
 public static Transaction BuildTransaction(TxParams param, HttpProvider provider, TxStatus status)
 {
     return(new Transaction()
     {
         ID = param.ID,
         Version = param.Version,
         Nonce = param.Nonce,
         Amount = param.Amount,
         GasPrice = param.GasPrice,
         GasLimit = param.GasLimit,
         Signature = param.Signature,
         Receipt = param.Receipt,
         SenderPubKey = param.SenderPubKey,
         ToAddr = param.ToAddr,
         Code = param.Code,
         Data = param.Data,
         Provider = provider,
         Status = status,
     });
 }
Esempio n. 14
0
 public override void Parse(IPacketParser parser)
 {
     base.Parse(parser);
     Status = (TxStatus)parser.Read("TX Status");
 }