Skip to the content.

RingBufferPlus API:IRingBuffer

Build License NuGet Downloads

Back to List Api

IRingBuffer<T>

Namespace: RingBufferPlus

Represents the commands to RingBufferPlus.

public interface IRingBuffer<T>

Type Parameters

T
Type of buffer.

Methods

AccquireTimeout(TimeSpan)

Timeout to accquire buffer. Default value is 30 seconds.

IRingBuffer<T> AccquireTimeout(TimeSpan value)

Parameters

value TimeSpan
The timeout for acquiring a value from the buffer.

Returns

IRingBuffer<T>.

BufferHealth(Func<T, Boolean>, Nullable<TimeSpan>)

Check buffer health with each acquisition or after timeout

IRingBuffer<T> BufferHealth(Func<T, Boolean> value, Nullable<TimeSpan> timeout)

Parameters

value Func<T, Boolean>
The handler to health.

timeout Nullable<TimeSpan>
The timeout for checking buffer integrity when there is no acquisition. Default value is 30 seconds

Returns

IRingBuffer<T>.

Build()

Validate and generate RingBufferPlus to service mode.

IRingBufferService<T> Build()

Returns

IRingBufferService<T>.

BuildWarmup(ref Boolean, Nullable<TimeSpan>)

Validate and generate RingBufferPlus and warmup with full capacity ready or reaching timeout (default 30 seconds).

IRingBufferService<T> BuildWarmup(ref Boolean fullcapacity, Nullable<TimeSpan> timeout)

Parameters

fullcapacity Boolean&
True if Warmup has full capacity, otherwise false.

timeout Nullable<TimeSpan>
The Timeout to Warmup has full capacity. Default value is 30 seconds.

Returns

IRingBufferService<T>.

Capacity(Int32)

Default capacity of ring buffer.

IRingBuffer<T> Capacity(int value)

Parameters

value Int32
Initial capacity.

Returns

IRingBuffer<T>.

Factory(Func<CancellationToken, T>, Nullable<TimeSpan>, Nullable<TimeSpan>)

Factory to create an instance in ring buffer.
Executes asynchronously.

IRingBuffer<T> Factory(Func<CancellationToken, T> value, Nullable<TimeSpan> timeout, Nullable<TimeSpan> idleRetryError)

Parameters

value Func<CancellationToken, T>
The handler to factory.

timeout Nullable<TimeSpan>
The timeout for build. Default value is 10 seconds.

idleRetryError Nullable<TimeSpan>
The delay time for retrying when a build fails. Default value is 5 seconds.

Returns

IRingBuffer<T>.

Logger(ILogger)

The Logger
Default value is ILoggerFactory.Create (if any) with category euqal name of ring buffer

IRingBuffer<T> Logger(ILogger value)

Parameters

value ILogger
.

Returns

IRingBuffer<T>.

OnError(Action<ILogger, RingBufferException>)

Extension point to log a error.
Executes asynchronously.

IRingBuffer<T> OnError(Action<ILogger, RingBufferException> errorhandler)

Parameters

errorhandler Action<ILogger, RingBufferException>
he handler to log error.

Returns

IRingBuffer<T>.

ScaleUnit(ScaleMode, Nullable<Int32>, Nullable<TimeSpan>)

Swith to scale definitions commands with scale mode and sampling unit/base timer for return buffer-free resource (Median colledted samples).
basetimer/numbersamples must be greater or equal than 100ms.

IRingBufferScaleCapacity<T> ScaleUnit(ScaleMode unit, Nullable<Int32> numbersamples, Nullable<TimeSpan> basetimer)

Parameters

unit ScaleMode
Scale unit type.
When is Manual the ‘numbersamples’ and ‘basetimer’ parameters will be ignored
When is Slave the ‘numbersamples’ and ‘basetimer’ parameters will be ignored

numbersamples Nullable<Int32>
Number of samples collected.Default value is basetimer/10. Default basetimer is 60.

basetimer Nullable<TimeSpan>
The TimeSpan interval to colleted samples.Default value is 60 seconds.

Returns

IRingBufferScaleCapacity<T>


Back to List Api