/// <summary> /// Creates a prestage writer. /// </summary> /// <param name="settings">The settings to use for this prebuffer writer</param> /// <param name="onRollover">delegate to call when a file is done with this stage.</param> public PrebufferWriter(PrebufferWriterSettings settings, Action <PrebufferRolloverArgs <TKey, TValue> > onRollover) : base(MessageClass.Framework) { if (settings is null) { throw new ArgumentNullException("settings"); } if (onRollover is null) { throw new ArgumentNullException("onRollover"); } m_settings = settings.CloneReadonly(); m_settings.Validate(); m_performanceLog = Log.RegisterEvent(MessageLevel.Info, MessageFlags.PerformanceIssue, "Queue is full", 0, MessageRate.PerSecond(1), 1); m_currentlyRollingOverFullQueue = false; m_latestTransactionId.Value = 0; m_syncRoot = new object(); m_activeQueue = new SortedPointBuffer <TKey, TValue>(m_settings.MaximumPointCount, true); m_processingQueue = new SortedPointBuffer <TKey, TValue>(m_settings.MaximumPointCount, true); m_activeQueue.IsReadingMode = false; m_processingQueue.IsReadingMode = false; m_onRollover = onRollover; m_waitForEmptyActiveQueue = new SafeManualResetEvent(false); m_rolloverTask = new ScheduledTask(ThreadingMode.DedicatedForeground, ThreadPriority.AboveNormal); m_rolloverTask.Running += m_rolloverTask_Running; m_rolloverTask.UnhandledException += OnProcessException; }
/// <summary> /// The default write processor settings /// </summary> public WriteProcessorSettings() { m_isEnabled = false; m_prebufferWriter = new PrebufferWriterSettings(); m_firstStageWriter = new FirstStageWriterSettings(); m_stagingRollovers = new ImmutableList <CombineFilesSettings>(x => { if (x == null) { throw new ArgumentNullException("value", "cannot be null"); } return(x); }); }