Table of Contents

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
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

DataSourceContext<T>

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

ILogger

Methods

EnrichCatalogAsync(ResourceCatalog, CancellationToken)

Enriches the provided ResourceCatalog.

public abstract Task<ResourceCatalog> EnrichCatalogAsync(ResourceCatalog catalog, CancellationToken cancellationToken)

Parameters

catalog ResourceCatalog

The catalog to enrich.

cancellationToken CancellationToken

A 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

catalogId string

The catalog identifier.

begin DateTime

The begin of the availability period.

end DateTime

The end of the availability period.

cancellationToken CancellationToken

A token to cancel the current operation.

Returns

Task<double>

The availability task.

GetCatalogRegistrationsAsync(string, CancellationToken)

Gets the catalog registrations that are located under path.

public abstract Task<CatalogRegistration[]> GetCatalogRegistrationsAsync(string path, CancellationToken cancellationToken)

Parameters

path string

The parent path for which to return catalog registrations.

cancellationToken CancellationToken

A 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

catalogId string

The catalog identifier.

cancellationToken CancellationToken

A 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

begin DateTime

The beginning of the period to read.

end DateTime

The end of the period to read.

requests ReadRequest[]

The array of read requests.

readData ReadDataHandler

A delegate to asynchronously read data from Nexus.

progress IProgress<double>

An object to report the read progress between 0.0 and 1.0.

cancellationToken CancellationToken

A 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

context DataSourceContext<T>

The context.

logger ILogger

The logger.

cancellationToken CancellationToken

A token to cancel the current operation.

Returns

Task

The task.