Class RoutineLibraryBase<V>
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, SimulatorCreate, CogniteDestination, ILogger)
Creates a new instance of the library using the provided parameters
public RoutineLibraryBase(RoutineLibraryConfig config, SimulatorCreate simulatorDefinition, CogniteDestination cdf, ILogger logger)
Parameters
config
RoutineLibraryConfigLibrary configuration
simulatorDefinition
SimulatorCreateSimulator definition
cdf
CogniteDestinationCDF destination object
logger
ILoggerLogger
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
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
CancellationTokenCancellation 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
CancellationTokenCancellation token
Returns
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
otherwisepublic Task<bool> VerifyInMemoryCache(V config, CancellationToken token)
Parameters
config
Vtoken
CancellationToken