Beispiel #1
0
        private InnerData ReadInner(object key, InnerData ret, bool isDeleted = false)
        {
            var script = _userCommandCreator.Read();

            script = _metaDataCommandCreator.ReadWithDelete(script, isDeleted);
            script = _metaDataCommandCreator.SetKeytoCommand(script, key);

            var reader = _implModule.CreateReader(script);

            try
            {
                reader.Start();

                if (reader.IsFail)
                {
                    ret.Data = null;
                    ret.Transaction.SetError();
                    ret.Transaction.AddErrorDescription("Script error");
                    reader.Dispose();
                    return(ret);
                }

                if (reader.IsCanRead)
                {
                    reader.ReadNext();

                    TKey   tmp;
                    object value = _userCommandCreator.ReadObjectFromReader(reader, out tmp);
                    ret.Data = value == null ? null : _hashCalculater.SerializeValue(value);
                }
            }
            catch (Exception e)
            {
                Logger.Logger.Instance.Error(e, "");
                ret.Data = null;

                ret.Transaction.SetError();
                ret.Transaction.AddErrorDescription(e.Message);
            }

            reader.Dispose();
            return(ret);
        }
Beispiel #2
0
        public static InnerData CreateEvent(IHashCalculater calc, int id)
        {
            string hash = calc.CalculateHashFromKey(id);

            var ev = new InnerData(new Transaction(hash, "")
            {
                OperationName = OperationName.Read
            })
            {
                Data = calc.SerializeValue(CreateStoredData(id))
            };

            return(ev);
        }
Beispiel #3
0
        private void CompleteTransaction(object key, object value, Transaction transaction,
                                         bool useGenericSerilize = true)
        {
            var serializeValue = useGenericSerilize
                ? _hashCalculater.SerializeValue(value)
                : _hashCalculater.SerializeOther(value);

            var serializeKey = _hashCalculater.SerializeKey(key);

            var process = new InnerData(transaction)
            {
                Data = serializeValue, Key = serializeKey
            };

            PerfCounters.ProxyCounters.Instance.CreateCount.Increment();
            process.Transaction.PerfTimer = PerfCounters.ProxyCounters.Instance.AverageTimer.StartNew();

            _processTransaction.ProcessData(process, _tableName);

            PerfCounters.ProxyCounters.Instance.IncomePerSec.OperationFinished();
        }