Show / Hide Table of Contents

Class BlockingResourceCounter

Simple construct to count number of available instances of some shared resource.

Inheritance
object
BlockingResourceCounter
Implements
IResourceCounter
Inherited Members
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 class BlockingResourceCounter : IResourceCounter

Constructors

| Edit this page View Source

BlockingResourceCounter(int)

Resource counter constructor.

Declaration
public BlockingResourceCounter(int initial)
Parameters
Type Name Description
int initial

Number of resources initially available. Can safely be increased by calling Free

Properties

| Edit this page View Source

Capacity

Reference to the total capacity of the counter.

Declaration
public int Capacity { get; }
Property Value
Type Description
int
| Edit this page View Source

Count

Unsafe reference to the remaining resources. Do not use this for thread safe logic.

Declaration
public int Count { get; }
Property Value
Type Description
int

Methods

| Edit this page View Source

Free(int)

Declaration
public void Free(int count)
Parameters
Type Name Description
int count
| Edit this page View Source

SetCapacity(int)

Set the capacity of the counter, may set the current count to less than 0.

Declaration
public void SetCapacity(int newCapacity)
Parameters
Type Name Description
int newCapacity

New capacity

Exceptions
Type Condition
ArgumentException

If newCapacity is less than 0

| Edit this page View Source

Take(int, bool)

Declaration
public Task<int> Take(int count, bool shouldBlock)
Parameters
Type Name Description
int count
bool shouldBlock
Returns
Type Description
Task<int>

Implements

IResourceCounter

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