Example #1
0
        public void LoadRedisFromFile()
        {
            var watch = Stopwatch.StartNew();

            int counter = 0;
            TransactionProto proto = null;
            using (var file = File.OpenRead(STR_Ctransactionsbin))
            {
                bool successful = true;
                do
                {
                    try
                    {
                        proto = Serializer.DeserializeWithLengthPrefix<TransactionProto>(file, PrefixStyle.Base128);

                    }
                    catch (EndOfStreamException ex)
                    {
                        successful = false;
                    }

                    int id = proto.TransactionID;
                    var node = new TransactionNode();
                    node.InitKey();
                    node.CloneTransactionProto(proto);
                    AddTransactionNode(id, node);
                    counter++;

                    LinkTransactionToDateNode(node, proto.EffectiveEntryDate, _EffectiveEntryDateNode, "EED");
                    LinkTransactionToDateNode(node, proto.ProcessingDate, _ProcessingDateNode, "PD");
                    LinkTransactionToDateNode(node, proto.SettlementDate, _SettlementDateNode, "SD");
                } while (successful && counter <= 10000);
                "Loaded {0} records in {1} miliseconds. \r\n\t{2} calls ops per second.\r\n\t{3} miliseconds per operation. \r\n\t{4} writes total. \r\n\t{5} writes per second\r\n\t{6} miliseconds per write."
                    .ToDebug<NetGraphDemo>(
                        counter,
                        watch.ElapsedMilliseconds,
                        (counter * 9) / watch.Elapsed.TotalSeconds,
                        watch.Elapsed.TotalMilliseconds / (counter * 9),
                        (counter * 9),
                        (counter * 9) / watch.Elapsed.TotalSeconds,
                        watch.Elapsed.TotalMilliseconds / (counter * 9)
                        );
            }

        }
Example #2
0
        private void AddTransactionNode(int origId, TransactionNode node)
        {
            if (!_transactionDict.ContainsKey(origId))
            {
                string key = node.Key;
                Client.AddNode(node.Key);

                var keyToUse = node.IsOffset? OFFSET_KEY: ORIGINATION_KEY;
                Client.AddToLookupSet(keyToUse, node.Key);

                keyToUse = node.Amount >= 0? CREDIT_KEY: DEBIT_KEY;
                Client.AddToLookupSet(keyToUse, node.Key);

                _transactionDict.Add(origId, node);
            }

        }
Example #3
0
 private void LinkTransactionToDateNode(TransactionNode transactionNode, DateTime linkDate, Dictionary<DateTime, DateNode> dict, string linkType)
 {
     if (!dict.ContainsKey(linkDate))
         AddDateNode(linkDate, dict);
     DateNode node = dict[linkDate];
     Client.AddAttribute(linkType, node.Key, transactionNode.Key);
 }