BufferedMarketDataDrive
IMarketDataDrive that writes what it is given in the background.
Hereda de: BaseLogReceiver
Implementa: IMarketDataDrive, IAsyncPersistable, IDisposable
Constructores
public BufferedMarketDataDrive(IMarketDataDrive underlying, IStorageRegistry storageRegistry)
bufferedMarketDataDrive = BufferedMarketDataDrive(underlying, storageRegistry)
Initializes a new instance of the BufferedMarketDataDrive.
- underlying
- The drive the data is actually written to.
- storageRegistry
- Registry the per-instrument storages are taken from.
public BufferedMarketDataDrive(IMarketDataDrive underlying, IStorageRegistry storageRegistry, int queueCapacity, long maxBufferedMessages)
bufferedMarketDataDrive = BufferedMarketDataDrive(underlying, storageRegistry, queueCapacity, maxBufferedMessages)
Initializes a new instance of the BufferedMarketDataDrive.
- underlying
- The drive the data is actually written to.
- storageRegistry
- Registry the per-instrument storages are taken from.
- queueCapacity
- How many messages may wait to be written before new ones are dropped.
- maxBufferedMessages
- How many may wait in the batches, which is where they wait when a write keeps failing.
Propiedades
public long BufferedMessages { get; }
value = bufferedMarketDataDrive.BufferedMessages
How many messages have been taken from the queue and are waiting in the batches to be written.
public long DroppedMessages { get; }
value = bufferedMarketDataDrive.DroppedMessages
How many messages had to be thrown away because the drive could not take them: the queue was full, or what is buffered for the next write already is. Data counted here is gone.
public long FailedFlushes { get; }
value = bufferedMarketDataDrive.FailedFlushes
How many writes the underlying storage refused. The data of a refused write is kept.
public TimeSpan FlushInterval { get; set; }
value = bufferedMarketDataDrive.FlushInterval
bufferedMarketDataDrive.FlushInterval = value
How long what has been given to the drive may wait before it is written.
public StorageFormats Format { get; set; }
value = bufferedMarketDataDrive.Format
bufferedMarketDataDrive.Format = value
Format the buffered data is written in.
public int MaxBatchSize { get; set; }
value = bufferedMarketDataDrive.MaxBatchSize
bufferedMarketDataDrive.MaxBatchSize = value
How many messages are taken from the queue before a write is forced.
public IMarketDataDrive Underlying { get; }
value = bufferedMarketDataDrive.Underlying
The drive the data is actually written to.
Métodos
protected override void DisposeManaged()
bufferedMarketDataDrive.DisposeManaged()
Disposes the managed resources. Override this method to add custom clean up of managed resources.
public void Enqueue(Message message)
bufferedMarketDataDrive.Enqueue(message)
Hands a message over to be written. The call does not wait for the write.
- message
- What to write. Anything that names neither an instrument nor a data type is not market data and is ignored.
public override Task LoadAsync(SettingsStorage storage, CancellationToken cancellationToken)
result = bufferedMarketDataDrive.LoadAsync(storage, cancellationToken)
Asynchronously loads the state of the object from the specified SettingsStorage.
- storage
- The SettingsStorage instance from which to load the data.
- cancellationToken
- A token to monitor for cancellation requests.
Devuelve: A task that represents the asynchronous load operation.
public override Task SaveAsync(SettingsStorage storage, CancellationToken cancellationToken)
result = bufferedMarketDataDrive.SaveAsync(storage, cancellationToken)
Asynchronously saves the state of the object to the specified SettingsStorage.
- storage
- The SettingsStorage instance to which to save the data.
- cancellationToken
- A token to monitor for cancellation requests.
Devuelve: A task that represents the asynchronous save operation.
public ValueTask StartAsync(CancellationToken cancellationToken)
result = bufferedMarketDataDrive.StartAsync(cancellationToken)
Starts writing in the background.
- cancellationToken
- CancellationToken
Devuelve: ValueTask
public ValueTask StopAsync(CancellationToken cancellationToken)
result = bufferedMarketDataDrive.StopAsync(cancellationToken)
Stops writing in the background and writes down what is still waiting.
- cancellationToken
- CancellationToken
Devuelve: ValueTask
Campos
public const long DefaultMaxBufferedMessages
value = BufferedMarketDataDrive.DefaultMaxBufferedMessages
How many messages may wait in the batches, which is where they wait while writes keep failing.
public const int DefaultQueueCapacity
value = BufferedMarketDataDrive.DefaultQueueCapacity
How many messages may wait in the queue before new ones are dropped.