Class TimeSeriesUploadQueue
Upload queue for timeseries datapoints
Inherited Members
Namespace: Cognite.Extractor.Utils
Assembly: ExtractorUtils.dll
Syntax
public class TimeSeriesUploadQueue : BaseUploadQueue<(Identity id, Datapoint dp)>, IUploadQueue<(Identity id, Datapoint dp)>, IUploadQueue, IDisposable, IAsyncDisposable
Constructors
| Edit this page View SourceTimeSeriesUploadQueue(CogniteDestination, TimeSpan, int, ILogger<CogniteDestination>, Func<QueueUploadResult<(Identity id, Datapoint dp)>, Task>?, string?, bool, long?)
Upload queue for timeseries datapoints
Declaration
public TimeSeriesUploadQueue(CogniteDestination destination, TimeSpan interval, int maxSize, ILogger<CogniteDestination> logger, Func<QueueUploadResult<(Identity id, Datapoint dp)>, Task>? callback, string? bufferPath, bool createMissingTimeseries = false, long? dataSetId = null)
Parameters
| Type | Name | Description |
|---|---|---|
| CogniteDestination | destination | CogniteDestination to use for uploading |
| TimeSpan | interval | Interval between each automated push, leave at zero to disable timed pushing |
| int | maxSize | Max size of queue before pushing, set to zero to disable max size |
| ILogger<CogniteDestination> | logger | Logger to use |
| Func<QueueUploadResult<(Identity id, Datapoint dp)>, Task> | callback | Callback after pushing |
| string | bufferPath | Path to local buffer file for binary buffering of datapoints |
| bool | createMissingTimeseries | Create missing timeseries when insert fails, only works if datapoints are inserted by external id. |
| long? | dataSetId | DataSetId to use if creating missing timeseries. |
Methods
| Edit this page View SourceAddStateStorage(IDictionary<Identity, BaseExtractionState>, IExtractionStateStore, string)
Add state storage to the queue. States are stored at after each upload.
Declaration
public void AddStateStorage(IDictionary<Identity, BaseExtractionState> states, IExtractionStateStore stateStore, string collection)
Parameters
| Type | Name | Description |
|---|---|---|
| IDictionary<Identity, BaseExtractionState> | states | Map from timeseries identity to extraction state. Missing states are ignored. Required. |
| IExtractionStateStore | stateStore | Store to store states in. Optional. |
| string | collection | Collection in state store to use for extraction states |
Enqueue(Identity, Datapoint)
Enqueue a datapoint by CogniteSdk Identity
Declaration
public void Enqueue(Identity id, Datapoint dp)
Parameters
| Type | Name | Description |
|---|---|---|
| Identity | id | Timeseries identity |
| Datapoint | dp | Datapoint to enqueue |
Enqueue(long, Datapoint)
Enqueue a datapoint by internalId
Declaration
public void Enqueue(long id, Datapoint dp)
Parameters
| Type | Name | Description |
|---|---|---|
| long | id | Timeseries internalId |
| Datapoint | dp | Datapoint to enqueue |
Enqueue(string, Datapoint)
Enqueue a datapoint by externalId
Declaration
public void Enqueue(string id, Datapoint dp)
Parameters
| Type | Name | Description |
|---|---|---|
| string | id | Timeseries externalId |
| Datapoint | dp | Datapoint to enqueue |
UploadEntries(IEnumerable<(Identity id, Datapoint dp)>, CancellationToken)
Upload datapoints to CDF.
Declaration
[SuppressMessage("Reliability", "CA2007: Do not directly await a Task", Justification = "Awaiter configured by the caller")]
protected override Task<QueueUploadResult<(Identity id, Datapoint dp)>> UploadEntries(IEnumerable<(Identity id, Datapoint dp)> dps, CancellationToken token)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<(Identity id, Datapoint dp)> | dps | Datapoints to upload |
| CancellationToken | token |
Returns
| Type | Description |
|---|---|
| Task<QueueUploadResult<(Identity id, Datapoint dp)>> | Uploaded points or an error |