BufferedMarketDataDrive

StockSharp.Algo.Storages

IMarketDataDrive that writes what it is given in the background.

继承自: BaseLogReceiver

实现: IMarketDataDrive, IAsyncPersistable, IDisposable

构造函数

BufferedMarketDataDrive
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.
BufferedMarketDataDrive
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.

属性

BufferedMessages
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.

DroppedMessages
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.

FailedFlushes
public long FailedFlushes { get; }
value = bufferedMarketDataDrive.FailedFlushes

How many writes the underlying storage refused. The data of a refused write is kept.

FlushInterval
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.

Format
public StorageFormats Format { get; set; }
value = bufferedMarketDataDrive.Format
bufferedMarketDataDrive.Format = value

Format the buffered data is written in.

MaxBatchSize
public int MaxBatchSize { get; set; }
value = bufferedMarketDataDrive.MaxBatchSize
bufferedMarketDataDrive.MaxBatchSize = value

How many messages are taken from the queue before a write is forced.

Underlying
public IMarketDataDrive Underlying { get; }
value = bufferedMarketDataDrive.Underlying

The drive the data is actually written to.

方法

DisposeManaged
protected override void DisposeManaged()
bufferedMarketDataDrive.DisposeManaged()

Disposes the managed resources. Override this method to add custom clean up of managed resources.

Enqueue
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.
LoadAsync
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.

返回值: A task that represents the asynchronous load operation.

SaveAsync
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.

返回值: A task that represents the asynchronous save operation.

StartAsync
public ValueTask StartAsync(CancellationToken cancellationToken)
result = bufferedMarketDataDrive.StartAsync(cancellationToken)

Starts writing in the background.

cancellationToken
CancellationToken

返回值: ValueTask

StopAsync
public ValueTask StopAsync(CancellationToken cancellationToken)
result = bufferedMarketDataDrive.StopAsync(cancellationToken)

Stops writing in the background and writes down what is still waiting.

cancellationToken
CancellationToken

返回值: ValueTask

字段

DefaultMaxBufferedMessages
public const long DefaultMaxBufferedMessages
value = BufferedMarketDataDrive.DefaultMaxBufferedMessages

How many messages may wait in the batches, which is where they wait while writes keep failing.

DefaultQueueCapacity
public const int DefaultQueueCapacity
value = BufferedMarketDataDrive.DefaultQueueCapacity

How many messages may wait in the queue before new ones are dropped.