public RecordWriteResult TryWrite(IBuffer buffer, Action <IHerculesEventBuilder> build, out int recordSize) { var result = baseWriter.TryWrite(buffer, build, out recordSize); switch (result) { case RecordWriteResult.Success: statistics.ReportStoredRecord(recordSize); break; case RecordWriteResult.RecordTooLarge: statistics.ReportSizeLimitViolation(); break; case RecordWriteResult.OutOfMemory: statistics.ReportOverflow(); break; case RecordWriteResult.Exception: statistics.ReportRecordBuildFailure(); break; } return(result); }
private void SetupResult(RecordWriteResult result, int recordSize) => baseWriter .TryWrite(null, null, out _) .ReturnsForAnyArgs( info => { info[2] = recordSize; return(result); });
public RecordWriteResult TryWrite(IBuffer buffer, Action <IHerculesEventBuilder> build, out int recordSize) { var storedSizeBefore = statistics.EstimateStoredSize(); var result = baseWriter.TryWrite(buffer, build, out recordSize); var storedSizeAfter = statistics.EstimateStoredSize(); if (storedSizeAfter >= constantSignalThreshold || storedSizeAfter > 0 && result == RecordWriteResult.OutOfMemory || storedSizeBefore < transitionSignalThreshold && storedSizeAfter >= transitionSignalThreshold) { signal.Set(); } return(result); }