Show / Hide Table of Contents

Class SharedResourceScheduler<T>

Abstraction for handling some kind of recursive exploration. Simply a small extension to OperationScheduler<T> that uses an instance of a IResourceCounter for shared capacity.

Inheritance
object
OperationScheduler<T>
SharedResourceScheduler<T>
Implements
IDisposable
Inherited Members
OperationScheduler<T>.TokenSource
OperationScheduler<T>.GetChunk(IEnumerable<T>)
OperationScheduler<T>.ConsumeChunk(IChunk<T>, CancellationToken)
OperationScheduler<T>.HandleTaskResult(IChunk<T>, CancellationToken)
OperationScheduler<T>.AbortChunk(IChunk<T>, CancellationToken)
OperationScheduler<T>.OnIteration(int, int, int, int)
OperationScheduler<T>.GetNextChunk(IEnumerable<T>, int, out IEnumerable<T>)
OperationScheduler<T>.GetNextChunks(IEnumerable<T>, int, out IEnumerable<T>)
OperationScheduler<T>.RunAsync()
OperationScheduler<T>.Dispose(bool)
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Cognite.Extractor.Common
Assembly: Cognite.Common.dll
Syntax
public abstract class SharedResourceScheduler<T> : OperationScheduler<T>, IDisposable
Type Parameters
Name Description
T

Type of item to explore

Constructors

| Edit this page View Source

SharedResourceScheduler(IEnumerable<T>, TaskThrottler, int, IResourceCounter, CancellationToken)

Constructor

Declaration
public SharedResourceScheduler(IEnumerable<T> initialItems, TaskThrottler throttler, int chunkSize, IResourceCounter resource, CancellationToken token)
Parameters
Type Name Description
IEnumerable<T> initialItems

List of initial items, must be non-empty

TaskThrottler throttler

TaskThrottler to use. Can be shared with other schedulers

int chunkSize

Maximum number of items per chunk

IResourceCounter resource

Shared resource to limit parallel requests based on

CancellationToken token

Cancellation token

Methods

| Edit this page View Source

FreeCapacity(int)

Free freed capacity from the shared resource manager.

Declaration
protected override void FreeCapacity(int freed)
Parameters
Type Name Description
int freed

Amount of capacity to free

Overrides
OperationScheduler<T>.FreeCapacity(int)
| Edit this page View Source

GetCapacity(int, bool)

Get requested capacity from the shared resource manager. Returns a number between 1 and requested, blocks if there are zero resources available unless shouldBlock is false, then returns immediately.

Declaration
protected override Task<int> GetCapacity(int requested, bool shouldBlock)
Parameters
Type Name Description
int requested

Amount of capacity to request

bool shouldBlock

True if this should block

Returns
Type Description
Task<int>

The number of resources allocated

Overrides
OperationScheduler<T>.GetCapacity(int, bool)

Implements

IDisposable

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