Esempio n. 1
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();
        }
Esempio n. 2
0
        private RemoteResult ProcessRestore(string script, int countElemnts, Action <InnerData> process,
                                            Func <MetaData, bool> isMine, bool isFirstAsk, ref object lastId, bool isDeleted)
        {
            bool isAllDataRead = true;
            var  keys          = ReadMetaDataUsingSelect(script, countElemnts, isFirstAsk, ref lastId, isMine, ref isAllDataRead);

            foreach (var key in keys)
            {
                var data = new InnerData(new Transaction(key.Hash, ""));

                data = ReadInner(key.Id, data, isDeleted);
                if (data.Transaction.IsError)
                {
                    Logger.Logger.Instance.Error(data.Transaction.ErrorDescription, "");
                    return(new InnerServerError(data.Transaction.ErrorDescription));
                }

                if (data.Data == null)
                {
                    Logger.Logger.Instance.Warn("Restore error with id = " + key.Id);
                    continue;
                }

                data.Key = _hashCalculater.SerializeKey(key.Id);
                data.Transaction.TableName = TableName;

                process(data);
            }

            if (!isAllDataRead)
            {
                return(new SuccessResult());
            }

            return(new FailNetResult(""));
        }