Table of Contents

Class RoutineLibraryBase<V>

Namespace
Cognite.Simulator.Utils
Assembly
Cognite.Simulator.Utils.dll

Represents a local routine revision library. It fetches all routine revisions from CDF and stores them in memory.

public abstract class RoutineLibraryBase<V> : IRoutineProvider<V> where V : SimulatorRoutineRevision

Type Parameters

V

Routine revision object type.

Inheritance
RoutineLibraryBase<V>
Implements
Derived
Inherited Members

Constructors

RoutineLibraryBase(RoutineLibraryConfig, IList<SimulatorConfig>, CogniteDestination, ILogger)

Creates a new instance of the library using the provided parameters

public RoutineLibraryBase(RoutineLibraryConfig config, IList<SimulatorConfig> simulators, CogniteDestination cdf, ILogger logger)

Parameters

config RoutineLibraryConfig

Library configuration

simulators IList<SimulatorConfig>

Dictionary of simulators

cdf CogniteDestination

CDF destination object

logger ILogger

Logger

Properties

CdfSimulatorResources

protected SimulatorsResource CdfSimulatorResources { get; }

Property Value

SimulatorsResource

LibState

In memory extraction state for the library. Keeps track of the time range of routine revisions that have been fetched.

protected BaseExtractionState LibState { get; }

Property Value

BaseExtractionState

PaginationLimit

Limit for pagination when fetching routine revisions from CDF.

public int? PaginationLimit { get; set; }

Property Value

int?

RoutineRevisions

Dictionary of simulation routines. The key is the routine revision id

public ConcurrentDictionary<string, V> RoutineRevisions { get; }

Property Value

ConcurrentDictionary<string, V>

Methods

GetRoutineRevision(string)

Looks for the routine revision in the memory with the given external id

public Task<V> GetRoutineRevision(string routineRevisionExternalId)

Parameters

routineRevisionExternalId string

Returns

Task<V>

GetRunTasks(CancellationToken)

Creates a list of the tasks performed by this library. These include fetching the list of remote entities and saving state.

public IEnumerable<Task> GetRunTasks(CancellationToken token)

Parameters

token CancellationToken

Cancellation token

Returns

IEnumerable<Task>

List of tasks

Init(CancellationToken)

Initializes the routine library. Finds entities in CDF and caches them in memory.

public Task Init(CancellationToken token)

Parameters

token CancellationToken

Cancellation token

Returns

Task

LocalConfigurationFromRoutine(SimulatorRoutineRevision)

Convert a routine revision to a configuration object of type V Generally not advised on overriding this method.

protected virtual V LocalConfigurationFromRoutine(SimulatorRoutineRevision routineRevision)

Parameters

routineRevision SimulatorRoutineRevision

Returns

V

VerifyInMemoryCache(V, CancellationToken)

Verifies that the routine revision exists in CDF. In case it does not, should remove from memory.

Configuration objectCancellation tokentrue in case the configuration exists in CDF, false otherwise
public Task<bool> VerifyInMemoryCache(V config, CancellationToken token)

Parameters

config V
token CancellationToken

Returns

Task<bool>