Class SimpleDataSource<T>
- Namespace
- Nexus.Extensibility
- Assembly
- Nexus.Extensibility.dll
A simple implementation of a data source.
public abstract class SimpleDataSource<T> : IDataSource<T>, IDataSource
Type Parameters
T
- Inheritance
-
SimpleDataSource<T>
- Implements
-
IDataSource<T>
- Inherited Members
Properties
Context
Gets the data source context. This property is not accessible from within class constructors as it will bet set later.
protected DataSourceContext<T> Context { get; }
Property Value
Logger
Gets the data logger. This property is not accessible from within class constructors as it will bet set later.
protected ILogger Logger { get; }
Property Value
Methods
EnrichCatalogAsync(ResourceCatalog, CancellationToken)
Enriches the provided ResourceCatalog.
public abstract Task<ResourceCatalog> EnrichCatalogAsync(ResourceCatalog catalog, CancellationToken cancellationToken)
Parameters
catalogResourceCatalogThe catalog to enrich.
cancellationTokenCancellationTokenA token to cancel the current operation.
Returns
- Task<ResourceCatalog>
The catalog request task.
GetAvailabilityAsync(string, DateTime, DateTime, CancellationToken)
Gets the availability of the ResourceCatalog. Implementations must be thread-safe because Nexus may call this method concurrently on the same data source instance.
public virtual Task<double> GetAvailabilityAsync(string catalogId, DateTime begin, DateTime end, CancellationToken cancellationToken)
Parameters
catalogIdstringThe catalog identifier.
beginDateTimeThe begin of the availability period.
endDateTimeThe end of the availability period.
cancellationTokenCancellationTokenA token to cancel the current operation.
Returns
GetCatalogRegistrationsAsync(string, CancellationToken)
Gets the catalog registrations that are located under path.
public abstract Task<CatalogRegistration[]> GetCatalogRegistrationsAsync(string path, CancellationToken cancellationToken)
Parameters
pathstringThe parent path for which to return catalog registrations.
cancellationTokenCancellationTokenA token to cancel the current operation.
Returns
- Task<CatalogRegistration[]>
The catalog identifiers task.
GetTimeRangeAsync(string, CancellationToken)
Gets the time range of the ResourceCatalog.
public virtual Task<CatalogTimeRange> GetTimeRangeAsync(string catalogId, CancellationToken cancellationToken)
Parameters
catalogIdstringThe catalog identifier.
cancellationTokenCancellationTokenA token to cancel the current operation.
Returns
- Task<CatalogTimeRange>
The time range task.
ReadAsync(DateTime, DateTime, ReadRequest[], ReadDataHandler, IProgress<double>, CancellationToken)
Performs a number of read requests. Implementations must be thread-safe because Nexus may call this method concurrently on the same data source instance.
public abstract Task ReadAsync(DateTime begin, DateTime end, ReadRequest[] requests, ReadDataHandler readData, IProgress<double> progress, CancellationToken cancellationToken)
Parameters
beginDateTimeThe beginning of the period to read.
endDateTimeThe end of the period to read.
requestsReadRequest[]The array of read requests.
readDataReadDataHandlerA delegate to asynchronously read data from Nexus.
progressIProgress<double>An object to report the read progress between 0.0 and 1.0.
cancellationTokenCancellationTokenA token to cancel the current operation.
Returns
- Task
The task.
SetContextAsync(DataSourceContext<T>, ILogger, CancellationToken)
Invoked by Nexus right after construction to provide the context.
public Task SetContextAsync(DataSourceContext<T> context, ILogger logger, CancellationToken cancellationToken)
Parameters
contextDataSourceContext<T>The context.
loggerILoggerThe logger.
cancellationTokenCancellationTokenA token to cancel the current operation.
Returns
- Task
The task.