Exemplo n.º 1
0
 /// <summary>
 ///     Removes the given entry from this cache.
 /// </summary>
 /// <param name="logTable"></param>
 /// <param name="index"></param>
 /// <returns>true if the entry was removed, false otherwise</returns>
 public bool Remove(ILogTable logTable, LogEntryIndex index)
 {
     lock (_syncRoot)
     {
         return(_logEntries.Remove(logTable, index));
     }
 }
 public LogEntriesController(ILogTable logTable, IOptions <AppSettings> appSettings, IBloblogReader bloblogReader, ILogger <LogEntriesController> logger)
 {
     _logTable      = logTable;
     _appSettings   = appSettings.Value;
     _bloblogReader = bloblogReader;
     _logger        = logger;
 }
Exemplo n.º 3
0
 /// <summary>
 ///     Tries to retrieve an entry from this cache.
 /// </summary>
 /// <param name="logTable"></param>
 /// <param name="index"></param>
 /// <param name="logEntry"></param>
 /// <returns></returns>
 public bool TryGetValue(ILogTable logTable, LogEntryIndex index, out LogEntry logEntry)
 {
     lock (_syncRoot)
     {
         return(_logEntries.TryGetValue(logTable, index, out logEntry));
     }
 }
Exemplo n.º 4
0
 public UserSerivice(IOptions <AppSettings> appSettings, IGroupContext groupContext, IDepartmentContext departmentContext, IWebhookService webhookService, ILogTable logTable, IAadCollector aadCollector)
 {
     _appSettings       = appSettings.Value;
     _departmentContext = departmentContext;
     _groupContext      = groupContext;
     _webhookService    = webhookService;
     _logTable          = logTable;
     _aadCollector      = aadCollector;
 }
        public LogTableListenerCollection(ILogTable logTable)
        {
            if (logTable == null)
                throw new ArgumentNullException("logTable");

            _logTable = logTable;
            _notifiers = new Dictionary<ILogTableListener, LogFileListenerNotifier>();
            _syncRoot = new object();
        }
Exemplo n.º 6
0
        public void SetUp()
        {
            _cache = new LogDataCache();

            _table1 = new Mock <ILogTable>().Object;
            _table2 = new Mock <ILogTable>().Object;
            _file1  = new Mock <ILogFile>().Object;
            _file2  = new Mock <ILogFile>().Object;
        }
Exemplo n.º 7
0
        public void SetUp()
        {
            _cache = new LogDataCache();

            _table1 = new Mock<ILogTable>().Object;
            _table2 = new Mock<ILogTable>().Object;
            _file1 = new Mock<ILogFile>().Object;
            _file2 = new Mock<ILogFile>().Object;
        }
        public LogFileListenerNotifier(ILogTable logTable, ILogTableListener listener, TimeSpan maximumWaitTime,
		                               int maximumLineCount)
        {
            if (logTable == null)
                throw new ArgumentNullException("logTable");

            _logTable = logTable;
            _listener = listener;
            _maximumWaitTime = maximumWaitTime;
            _maximumLineCount = maximumLineCount;
        }
        public LogTableListenerCollection(ILogTable logTable)
        {
            if (logTable == null)
            {
                throw new ArgumentNullException(nameof(logTable));
            }

            _logTable  = logTable;
            _notifiers = new Dictionary <ILogTableListener, LogTableListenerNotifier>();
            _syncRoot  = new object();
        }
Exemplo n.º 10
0
        /// <summary>
        ///     Removes all entries associated with the given table.
        /// </summary>
        /// <param name="logTable"></param>
        /// <returns></returns>
        public int Remove(ILogTable logTable)
        {
            if (logTable == null)
            {
                return(0);
            }

            lock (_syncRoot)
            {
                return(_logEntries.Remove(logTable));
            }
        }
Exemplo n.º 11
0
        private void OnLogTableChanged(ILogTable oldValue, ILogTable newValue)
        {
            if (oldValue != null)
            {
                oldValue.RemoveListener(this);
            }

            if (newValue != null)
            {
                newValue.AddListener(this, TimeSpan.FromMilliseconds(100), 10000);
            }
        }
Exemplo n.º 12
0
        /// <summary>
        ///     Adds the given entry to this cache.
        ///     If an entry already exists, then it will be replaced.
        /// </summary>
        /// <param name="logTable"></param>
        /// <param name="index"></param>
        /// <param name="logEntry"></param>
        public void Add(ILogTable logTable, LogEntryIndex index, LogEntry logEntry)
        {
            if (logTable == null)
            {
                throw new ArgumentNullException(nameof(logTable));
            }

            lock (_syncRoot)
            {
                _logEntries.Add(logTable, index, logEntry);
                CollectIfNecessary();
            }
        }
Exemplo n.º 13
0
 public void OnLogTableModified(ILogTable logTable, LogTableModification modification)
 {
     if (modification.Schema != null)
     {
         Dispatcher.BeginInvoke(new Action(() => OnSchemaChanged(modification.Schema)));
     }
     else if (modification.IsInvalidate)
     {
         Dispatcher.BeginInvoke(new Action(() => OnInvalidated(modification.Section)));
     }
     else
     {
         Dispatcher.BeginInvoke(new Action(() => OnAdded(modification.Section)));
     }
 }
Exemplo n.º 14
0
        public bool Contains(ILogTable logTable, LogEntryIndex index)
        {
            if (logTable == null)
            {
                return(false);
            }
            if (index == LogEntryIndex.Invalid)
            {
                return(false);
            }

            lock (_syncRoot)
            {
                return(_logEntries.Contains(logTable, index));
            }
        }
Exemplo n.º 15
0
        public LogTableListenerNotifier(ILogTable logTable,
                                        ILogTableListener listener,
                                        TimeSpan maximumTime,
                                        int maximumCount)
        {
            if (logTable == null)
            {
                throw new ArgumentNullException(nameof(logTable));
            }

            _logTable     = logTable;
            _listener     = listener;
            _maximumTime  = maximumTime;
            _maximumCount = maximumCount;

            Reset();

            _listener.OnLogTableModified(logTable, LogTableModification.Reset);
        }
Exemplo n.º 16
0
        /// <summary>
        ///     Adds the given range of entries to this cache.
        /// </summary>
        /// <param name="logTable"></param>
        /// <param name="startIndex"></param>
        /// <param name="logEntries"></param>
        public void AddRange(ILogTable logTable, LogEntryIndex startIndex, IEnumerable <LogEntry> logEntries)
        {
            if (logTable == null)
            {
                throw new ArgumentNullException(nameof(logTable));
            }

            lock (_syncRoot)
            {
                LogEntryIndex index = startIndex;
                foreach (var logEntry in logEntries)
                {
                    _logEntries.Add(logTable, index, logEntry);
                    ++index;
                }

                // We DO NOT want to collect inside the loop.
                // Not doing so breaks the promise of not consuming more memory
                // than configured, however that is a very weak promise from the start
                // and thus we do not bother at trying to *strictly* keep it. Instead we
                // see it as a guideline not not exceed it too often or by too much (tm).
                CollectIfNecessary();
            }
        }
Exemplo n.º 17
0
 public BloblogReader(IOptions <AppSettings> appSettings, ILogTable logTable)
 {
     _appSettings = appSettings.Value;
     _logTable    = logTable;
 }
 protected DefaultLogStore(ILogTable logTable)
 {
     this.logTable = logTable;
 }