Exemple #1
0
        public override void Save(IList <RowData> rowsData)
        {
            using (var context = new ClickHouseContext(_connectionString, _extendedActions))
            {
                if (_maxPeriodRowData == DateTime.MinValue)
                {
                    _maxPeriodRowData = context.GetRowsDataMaxPeriod(_system);
                }

                List <RowData> newEntities = new List <RowData>();
                foreach (var itemRow in rowsData)
                {
                    if (itemRow == null)
                    {
                        continue;
                    }
                    if (_maxPeriodRowData != DateTime.MinValue && itemRow.Period <= _maxPeriodRowData)
                    {
                        if (context.RowDataExistOnDatabase(_system, itemRow))
                        {
                            continue;
                        }
                    }

                    newEntities.Add(itemRow);
                }
                context.SaveRowsData(_system, newEntities);
            }
        }
Exemple #2
0
        public override void SaveLogPosition(FileInfo logFileInfo, EventLogPosition position)
        {
            using (var context = new ClickHouseContext(_connectionString, _extendedActions))
            {
                context.SaveLogPosition(_system, logFileInfo, position);
                if (_currentStepToClearLogFiles == 0 || _currentStepToClearLogFiles >= _stepsToClearLogFiles)
                {
                    context.RemoveArchiveLogFileRecords(_system);
                    _currentStepToClearLogFiles = 0;
                }
                _currentStepToClearLogFiles += 1;
            }

            _lastEventLogFilePosition = position;
        }
Exemple #3
0
        public override EventLogPosition GetLastPosition()
        {
            if (_lastEventLogFilePosition != null)
            {
                return(_lastEventLogFilePosition);
            }

            EventLogPosition position;

            using (var context = new ClickHouseContext(_connectionString, _extendedActions))
                position = context.GetLogFilePosition(_system);

            _lastEventLogFilePosition = position;
            return(position);
        }