Class MountedSession
Service provider interface for external sources of session data to be mounted in SQL Race, which can then provide conversions, re-sampling, filters, functions etc.
Intended to be sub-classed to provide an implementation. Implementations must be thread-safe, and do appropriate paging to avoid using too much memory.
Designed to accept live updates and lazy-loaded data. Implementations can do this by treating the MountedSession as mediator for a pipeline receiving data.
Inheritance
Namespace: MESL.SqlRace.Domain.MountedSessions
Assembly: MESL.SqlRace.Domain.dll
Syntax
public abstract class MountedSession : Object, IMountedEventsPageSource, IMountedDataPageSource
Constructors
MountedSession(String, DateTimeOffset, Int64, String, Nullable<UInt32>)
Initialises a new instance of the MountedSession class.
Declaration
protected MountedSession(string identifier, DateTimeOffset timestamp, long epoch, string type, Nullable<uint> ownerId)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | Initial session identifier. |
System.DateTimeOffset | timestamp | Timestamp of the session. |
System.Int64 | epoch | Base time (nanos since unix epoch). |
System.String | type | Session type (for information only). |
System.Nullable<System.UInt32> | ownerId | Owner id, if available. |
Properties
AvailableConfiguration
Gets the configuration available to be bound to the session, by unique identifier.
Declaration
public virtual IImmutableDictionary<string, IMountedConfiguration> AvailableConfiguration { get; }
Property Value
Type | Description |
---|---|
System.Collections.Immutable.IImmutableDictionary<System.String, IMountedConfiguration> |
See Also
BoundConfiguration
Gets the binding of configuration onto the session, expressed as the configuration identifiers and offsets to be applied to avoid channel id conflicts. The order is significant, with the first-listed configuration identifiers taking priority over later identifiers in the event that there are differences between the configuration definitions.
Declaration
public virtual IImmutableList<KeyValuePair<string, uint>> BoundConfiguration { get; }
Property Value
Type | Description |
---|---|
System.Collections.Immutable.IImmutableList<System.Collections.Generic.KeyValuePair<System.String, System.UInt32>> |
Capabilities
Gets the capabilities exposed by an implementation of MountedSession.
Declaration
public virtual MountedSessionCapabilities Capabilities { get; }
Property Value
Type | Description |
---|---|
MountedSessionCapabilities |
Configuration
Configuration of the mounted session
Declaration
public virtual ConfigurationView Configuration { get; protected set; }
Property Value
Type | Description |
---|---|
MAT.OCS.Configuration.ConfigurationView |
Constants
Gets constant values for use with the session.
Declaration
public virtual IImmutableList<Constant> Constants { get; }
Property Value
Type | Description |
---|---|
System.Collections.Immutable.IImmutableList<Constant> |
Details
Gets the session details (arbitrary human-readable key-value pairs).
Declaration
public virtual IImmutableDictionary<string, object> Details { get; }
Property Value
Type | Description |
---|---|
System.Collections.Immutable.IImmutableDictionary<System.String, System.Object> |
Epoch
Base time against which all event and data timestamps are relative (as a nanosecond offset).
Declaration
public long Epoch { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
Identifier
Gets the identifier. Roughly equivalent to a file-system filename.
Declaration
public virtual string Identifier { get; }
Property Value
Type | Description |
---|---|
System.String |
Laps
Gets the current laps, ordered by timestamp.
Declaration
public virtual IImmutableList<MountedLap> Laps { get; }
Property Value
Type | Description |
---|---|
System.Collections.Immutable.IImmutableList<MountedLap> |
See Also
OwnerId
Gets the owner id used for team or consortium based access to the session
Declaration
public Nullable<uint> OwnerId { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.UInt32> |
State
Gets the state of the session. This may change after mounting unless it is Closed.
Declaration
public virtual MountedSessionState State { get; }
Property Value
Type | Description |
---|---|
MountedSessionState |
TimeRange
Gets the time range (inclusive start and end time), relative to the Epoch.
null
if there is no data in the session (Empty).
Declaration
public virtual Nullable<TimeRange> TimeRange { get; }
Property Value
Type | Description |
---|---|
System.Nullable<TimeRange> |
Timestamp
Gets the session timestamp. This is for information only and may not correspond to the local time on a hardware logger. Roughly equivalent to a file-system timestamp.
Declaration
public DateTimeOffset Timestamp { get; }
Property Value
Type | Description |
---|---|
System.DateTimeOffset |
Type
Gets the session type. For information only.
Declaration
public string Type { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
AddConfiguration(IMountedConfiguration)
Adds the specified IMountedConfiguration to AvailableConfiguration and fires ConfigurationAvailable.
Declaration
protected virtual bool AddConfiguration(IMountedConfiguration config)
Parameters
Type | Name | Description |
---|---|---|
IMountedConfiguration | config | Configuration to add. |
Returns
Type | Description |
---|---|
System.Boolean |
|
AddExclusiveLap(MountedLap)
Adds the lap which must be the only lap in the session. Will be removed if any other lap is added.
Declaration
protected virtual void AddExclusiveLap(MountedLap exclusiveLap)
Parameters
Type | Name | Description |
---|---|---|
MountedLap | exclusiveLap | The exclusive lap. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | exclusiveLap |
AddLap(MountedLap)
Declaration
protected virtual void AddLap(MountedLap lap)
Parameters
Type | Name | Description |
---|---|---|
MountedLap | lap | Lap to add. |
BindConfiguration(IEnumerable<KeyValuePair<String, UInt32>>)
Binds the specified IMountedConfiguration into BoundConfiguration and fires ConfigurationBound. The offsets must avoid creating overlaps between channels.
Declaration
protected virtual void BindConfiguration(IEnumerable<KeyValuePair<string, uint>> configChannelOffsets)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.UInt32>> | configChannelOffsets | Configuration identifiers and channel id offsets. |
ExtendTimeRange(TimeRange)
Updates the TimeRange to cover the specified timeRange
and fires StartTimeChanged / EndTimeChanged if appropriate.
Declaration
protected virtual void ExtendTimeRange(TimeRange timeRange)
Parameters
Type | Name | Description |
---|---|---|
TimeRange | timeRange | Time range to be covered. |
GetDataTimeRange(UInt32)
Gets the time range (inclusive start and end time) for the specified channel.
Declaration
public virtual Nullable<TimeRange> GetDataTimeRange(uint channelId)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | channelId | Channel id. |
Returns
Type | Description |
---|---|
System.Nullable<TimeRange> | Time range, relative to the Epoch. |
RaiseConfigurationAvailable(MountedSessionEvents.ConfigurationAvailable)
Raises the ConfigurationAvailable event.
Declaration
protected virtual void RaiseConfigurationAvailable(MountedSessionEvents.ConfigurationAvailable e)
Parameters
Type | Name | Description |
---|---|---|
MountedSessionEvents.ConfigurationAvailable | e | Event args. |
RaiseConfigurationBound(MountedSessionEvents.ConfigurationBound)
Raises the ConfigurationBound event.
Declaration
protected virtual void RaiseConfigurationBound(MountedSessionEvents.ConfigurationBound e)
Parameters
Type | Name | Description |
---|---|---|
MountedSessionEvents.ConfigurationBound | e | Event args. |
RaiseDataAdded(MountedSessionEvents.DataAdded)
Raises the DataAdded event.
Declaration
protected virtual void RaiseDataAdded(MountedSessionEvents.DataAdded e)
Parameters
Type | Name | Description |
---|---|---|
MountedSessionEvents.DataAdded | e | Event args. |
RaiseDetailsChanged(MountedSessionEvents.SessionUpdated)
Raises the DetailsChanged event.
Declaration
protected virtual void RaiseDetailsChanged(MountedSessionEvents.SessionUpdated e)
Parameters
Type | Name | Description |
---|---|---|
MountedSessionEvents.SessionUpdated | e | Event args. |
RaiseEndTimeChanged(MountedSessionEvents.TimeRangeChanged)
Raises the EndTimeChanged event.
Declaration
protected virtual void RaiseEndTimeChanged(MountedSessionEvents.TimeRangeChanged e)
Parameters
Type | Name | Description |
---|---|---|
MountedSessionEvents.TimeRangeChanged | e | Event args. |
RaiseEventsAdded(MountedSessionEvents.EventsAdded)
Raises the EventsAdded event.
Declaration
protected virtual void RaiseEventsAdded(MountedSessionEvents.EventsAdded e)
Parameters
Type | Name | Description |
---|---|---|
MountedSessionEvents.EventsAdded | e | Event args. |
RaiseIdentifierChanged(MountedSessionEvents.SessionUpdated)
Raises the IdentifierChanged event.
Declaration
protected virtual void RaiseIdentifierChanged(MountedSessionEvents.SessionUpdated e)
Parameters
Type | Name | Description |
---|---|---|
MountedSessionEvents.SessionUpdated | e | Event args. |
RaiseLapAdded(MountedSessionEvents.LapAdded)
Raises the LapAdded event.
Declaration
protected virtual void RaiseLapAdded(MountedSessionEvents.LapAdded e)
Parameters
Type | Name | Description |
---|---|---|
MountedSessionEvents.LapAdded | e | Event args. |
RaiseStartTimeChanged(MountedSessionEvents.TimeRangeChanged)
Raises the StartTimeChanged event.
Declaration
protected virtual void RaiseStartTimeChanged(MountedSessionEvents.TimeRangeChanged e)
Parameters
Type | Name | Description |
---|---|---|
MountedSessionEvents.TimeRangeChanged | e | Event args. |
RaiseStateChanged(MountedSessionEvents.StateChanged)
Raises the StateChanged event.
Declaration
protected virtual void RaiseStateChanged(MountedSessionEvents.StateChanged e)
Parameters
Type | Name | Description |
---|---|---|
MountedSessionEvents.StateChanged | e | Event args. |
ReadPagedData(UInt32, ReadDirection, Nullable<Int64>, Nullable<Int64>)
Reads pages of data for the specified channelId
overlapping the specified time bounds.
Declaration
public virtual IEnumerable<IMountedDataPage> ReadPagedData(uint channelId, ReadDirection pagingDirection, Nullable<long> startTime, Nullable<long> endTime)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | channelId | Channel id. |
ReadDirection | pagingDirection | Time-order of pages. |
System.Nullable<System.Int64> | startTime | Optional inclusive start time, relative to the Epoch. |
System.Nullable<System.Int64> | endTime | Optional inclusive end time, relative to the Epoch. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IMountedDataPage> | Zero or more pages. |
ReadPagedEvents(ReadDirection, Nullable<Int64>, Nullable<Int64>)
Reads pages of events overlapping the specified time bounds.
Declaration
public virtual IEnumerable<IMountedEventsPage> ReadPagedEvents(ReadDirection pagingDirection, Nullable<long> startTime, Nullable<long> endTime)
Parameters
Type | Name | Description |
---|---|---|
ReadDirection | pagingDirection | Time-order of pages. |
System.Nullable<System.Int64> | startTime | Optional inclusive start time, relative to the Epoch. |
System.Nullable<System.Int64> | endTime | Optional inclusive end time, relative to the Epoch. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IMountedEventsPage> | Zero or more pages. |
UpdateDetails(IImmutableDictionary<String, Object>)
Updates the Details and fires DetailsChanged.
Declaration
protected virtual void UpdateDetails(IImmutableDictionary<string, object> details)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Immutable.IImmutableDictionary<System.String, System.Object> | details | Updated details. |
UpdateIdentifier(String)
Updates the Identifier and fires IdentifierChanged.
Declaration
protected virtual void UpdateIdentifier(string identifier)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | Updated identifier. |
UpdateState(MountedSessionState)
Updates the State and fires StateChanged if appropriate.
Declaration
protected virtual void UpdateState(MountedSessionState state)
Parameters
Type | Name | Description |
---|---|---|
MountedSessionState | state | Updated state. |
Events
ConfigurationAvailable
Raised when IMountedConfiguration is available to be bound to the session. SQL Race will respond to this event by mounting (and sharing, if possible) the configuration.
Declaration
public event EventHandler<MountedSessionEvents.ConfigurationAvailable> ConfigurationAvailable
Event Type
Type | Description |
---|---|
System.EventHandler<MountedSessionEvents.ConfigurationAvailable> |
ConfigurationBound
Raised when IMountedConfiguration is bound to the session. SQL Race will respond to this event by adding the configuration to the SQL Race session.
Declaration
public event EventHandler<MountedSessionEvents.ConfigurationBound> ConfigurationBound
Event Type
Type | Description |
---|---|
System.EventHandler<MountedSessionEvents.ConfigurationBound> |
DataAdded
Raised when data is added.
Declaration
public event EventHandler<MountedSessionEvents.DataAdded> DataAdded
Event Type
Type | Description |
---|---|
System.EventHandler<MountedSessionEvents.DataAdded> |
DetailsChanged
Raised when the Details change.
Declaration
public event EventHandler<MountedSessionEvents.SessionUpdated> DetailsChanged
Event Type
Type | Description |
---|---|
System.EventHandler<MountedSessionEvents.SessionUpdated> |
EndTimeChanged
Raised when the TimeRange end time changes.
Declaration
public event EventHandler<MountedSessionEvents.TimeRangeChanged> EndTimeChanged
Event Type
Type | Description |
---|---|
System.EventHandler<MountedSessionEvents.TimeRangeChanged> |
EventsAdded
Raised when events are added.
Declaration
public event EventHandler<MountedSessionEvents.EventsAdded> EventsAdded
Event Type
Type | Description |
---|---|
System.EventHandler<MountedSessionEvents.EventsAdded> |
IdentifierChanged
Raised when the Identifier changes.
Declaration
public event EventHandler<MountedSessionEvents.SessionUpdated> IdentifierChanged
Event Type
Type | Description |
---|---|
System.EventHandler<MountedSessionEvents.SessionUpdated> |
LapAdded
Raised when a Lap is added.
Declaration
public event EventHandler<MountedSessionEvents.LapAdded> LapAdded
Event Type
Type | Description |
---|---|
System.EventHandler<MountedSessionEvents.LapAdded> |
StartTimeChanged
Raised when the TimeRange start time changes.
Declaration
public event EventHandler<MountedSessionEvents.TimeRangeChanged> StartTimeChanged
Event Type
Type | Description |
---|---|
System.EventHandler<MountedSessionEvents.TimeRangeChanged> |
StateChanged
Raised when the State changes.
Declaration
public event EventHandler<MountedSessionEvents.StateChanged> StateChanged
Event Type
Type | Description |
---|---|
System.EventHandler<MountedSessionEvents.StateChanged> |