Show / Hide Table of Contents

Class BaseUploadQueue<T>

Generic base class for upload queues

Inheritance
object
BaseUploadQueue<T>
EventUploadQueue
TimeSeriesUploadQueue
Implements
IUploadQueue<T>
IUploadQueue
IDisposable
IAsyncDisposable
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Cognite.Extractor.Utils
Assembly: ExtractorUtils.dll
Syntax
public abstract class BaseUploadQueue<T> : IUploadQueue<T>, IUploadQueue, IDisposable, IAsyncDisposable
Type Parameters
Name Description
T

Constructors

| Edit this page View Source

BaseUploadQueue(CogniteDestination, TimeSpan, int, ILogger, Func<QueueUploadResult<T>, Task>?)

Constructor

Declaration
protected BaseUploadQueue(CogniteDestination destination, TimeSpan interval, int maxSize, ILogger logger, Func<QueueUploadResult<T>, Task>? callback)
Parameters
Type Name Description
CogniteDestination destination

Cognite destination used for uploads

TimeSpan interval

Maximum interval between uploads. Set to zero or Timeout.InfiniteTimeSpan to disable periodic uploads

int maxSize

Maximum size of the upload queue, once it reaches this size an upload will always be triggered

ILogger logger

Logger to use

Func<QueueUploadResult<T>, Task> callback

Callback on finished upload, whether it failed or not

Properties

| Edit this page View Source

Callback

Callback on upload

Declaration
protected Func<QueueUploadResult<T>, Task>? Callback { get; }
Property Value
Type Description
Func<QueueUploadResult<T>, Task>
| Edit this page View Source

DestLogger

Logger to use

Declaration
protected ILogger DestLogger { get; }
Property Value
Type Description
ILogger
| Edit this page View Source

Destination

CogniteDestination to use

Declaration
protected CogniteDestination Destination { get; }
Property Value
Type Description
CogniteDestination

Methods

| Edit this page View Source

Dequeue()

Empty the queue and return the contents

Declaration
public virtual IEnumerable<T> Dequeue()
Returns
Type Description
IEnumerable<T>

Contents of the queue

| Edit this page View Source

Dispose()

Dispose of the queue, uploading all remaining entries. Use DisposeAsync instead if possible.

Declaration
public void Dispose()
| Edit this page View Source

Dispose(bool)

Dispose of the queue, uploading all remaining entries.

Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
bool disposing
| Edit this page View Source

DisposeAsync()

Dispose of the queue, uploading all remaining entries. Preferred over synchronous dispose.

Declaration
public ValueTask DisposeAsync()
Returns
Type Description
ValueTask
| Edit this page View Source

DisposeAsyncCore()

Internal method to dispose asynchronously.

Declaration
protected ValueTask DisposeAsyncCore()
Returns
Type Description
ValueTask
| Edit this page View Source

Enqueue(IEnumerable<T>)

Enqueue a list of items in the internal queue.

Declaration
public virtual void Enqueue(IEnumerable<T> items)
Parameters
Type Name Description
IEnumerable<T> items

Items to enqueue

| Edit this page View Source

Enqueue(T)

Enqueue a single item in the internal queue.

Declaration
public virtual void Enqueue(T item)
Parameters
Type Name Description
T item

Item to enqueue

| Edit this page View Source

Start(CancellationToken)

Start automatically uploading queue entries

Declaration
public Task Start(CancellationToken token)
Parameters
Type Name Description
CancellationToken token
Returns
Type Description
Task
| Edit this page View Source

Trigger(CancellationToken)

Trigger queue upload and return the result instead of calling the callback. Can be used as alternative for callback entirely.

Declaration
public Task<QueueUploadResult<T>> Trigger(CancellationToken token)
Parameters
Type Name Description
CancellationToken token
Returns
Type Description
Task<QueueUploadResult<T>>

A QueueUploadResult<T> containing an error or the uploaded entries

| Edit this page View Source

UploadEntries(IEnumerable<T>, CancellationToken)

Method called to upload entries

Declaration
protected abstract Task<QueueUploadResult<T>> UploadEntries(IEnumerable<T> items, CancellationToken token)
Parameters
Type Name Description
IEnumerable<T> items

Items to upload

CancellationToken token
Returns
Type Description
Task<QueueUploadResult<T>>

A QueueUploadResult<T> containing an error or the uploaded entries

Implements

IUploadQueue<T>
IUploadQueue
IDisposable
IAsyncDisposable

Extension Methods

DataModelUtils.GetOrCreateResourcesAsync<T, T2>(T2, IEnumerable<InstanceIdentifier>, Func<IEnumerable<InstanceIdentifier>, IEnumerable<SourcedNodeWrite<T>>>, Func<IEnumerable<SourcedNodeWrite<T>>, SanitationMode, (IEnumerable<SourcedNodeWrite<T>>, IEnumerable<CogniteError<SourcedNodeWrite<T>>>)>, int, int, RetryMode, SanitationMode, CancellationToken)
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX