AP&C API Reference
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Properties | List of all members
Apac.Data.ThreadedMeasurementStore Class Referenceabstract

The base implementation of a buffered, threaded measurement store. This class deals with all of the queueing and thread management for a store that will be called from another thread that must not be delayed while the store does its work. More...

Inheritance diagram for Apac.Data.ThreadedMeasurementStore:
Apac.Supervisable Apac.Data.IDataStore Apac.Data.IMeasurementStore Apac.ISupervisable Apac.Data.IMeasurementQuery Apac.Data.IDataStore Apac.Data.DatabaseStore Apac.Data.XmlFileStore Apac.Data.FirebirdStore

Public Member Functions

 ThreadedMeasurementStore ()
 Default constructor. More...
 
override object InitializeLifetimeService ()
 Obtains a lifetime service object to control the lifetime policy for this instance. More...
 
void RecordAlerts (Alerts alerts)
 Should records the alerts. More...
 
void RecordAlerts (Alerts alerts, StoreAccessCompleteHandler callout)
 Should records the alerts, will call back on callout . More...
 
void RetrieveAlerts (bool activeOnly, StoreAccessCompleteHandler callout)
 Should retrieve the alerts. More...
 
void RecordMeasurements (Measurements measurements)
 Enqueues the given averages for the raw data thread to record. More...
 
void RecordMeasurements (Measurements measurements, StoreAccessCompleteHandler callout)
 Enqueues the given averages for the raw data thread to record. More...
 
void RecordFiveMinAverages (WeightedMeasurementAvgs averages)
 Enqueues the given averages for the 5-minute thread to record. More...
 
void RecordFiveMinAverages (WeightedMeasurementAvgs averages, StoreAccessCompleteHandler callout)
 Enqueues the given averages for the 5-minute thread to record. More...
 
void RecordHourlyAverages (WeightedMeasurementAvgs averages)
 Enqueues the given averages for the hourly thread to record. More...
 
void RecordHourlyAverages (WeightedMeasurementAvgs averages, StoreAccessCompleteHandler callout)
 Enqueues the given averages for the hourly thread to record. More...
 
void RecordDailyAverages (WeightedMeasurementAvgs averages)
 Enqueues the given averages for the daily thread to record. More...
 
void RecordDailyAverages (WeightedMeasurementAvgs averages, StoreAccessCompleteHandler callout)
 Enqueues the given averages for the daily thread to record. More...
 
void RecordMonthlyAverages (WeightedMeasurementAvgs averages)
 Enqueues the given averages for the monthly thread to record. More...
 
void RecordMonthlyAverages (WeightedMeasurementAvgs averages, StoreAccessCompleteHandler callout)
 Enqueues the given averages for the monthly thread to record. More...
 
TimeTrackingList< MeasurementsFetchMeasurements (MeasurementQueryCriteria criteria)
 Retrieves measurements according to the given criteria. More...
 
TimeTrackingList< Monitoring.WeightedMeasurementAvgsFetchFiveMinuteAverages (MeasurementQueryCriteria criteria)
 Retrieves five minute averages according to the given criteria. More...
 
TimeTrackingList< Monitoring.WeightedMeasurementAvgsFetchHourlyAverages (MeasurementQueryCriteria criteria)
 Retrieves hourly averages according to the given criteria. More...
 
TimeTrackingList< Monitoring.WeightedMeasurementAvgsFetchDailyAverages (MeasurementQueryCriteria criteria)
 Retrieves daily averages according to the given criteria. More...
 
TimeTrackingList< Monitoring.WeightedMeasurementAvgsFetchMonthlyAverages (MeasurementQueryCriteria criteria)
 Retrieves monthly averages according to the given criteria. More...
 
void Initialize (Apac.Configuration.DataStoreConfig config)
 Starts the inheritance call chain for initializing the data store. More...
 
void Open ()
 Prompts the store to prepare for recording and fetching data. More...
 
void Close ()
 Prompts the store to clean up its resources used for recording and fetching data. More...
 
void Dispose ()
 
- Public Member Functions inherited from Apac.Supervisable
void Initialize (Apac.Configuration.SupervisableConfig config, Supervisors.ISupervisor supervisor)
 Initializes the controller from configuration. More...
 
void ResolveReferences ()
 Resolves any references this component might hold to other supervisable components. More...
 
void CheckReferencesStates ()
 Checks the states of referenced components to be sure they are satisfactory for this component's operation. More...
 
void Starting ()
 Signals that the component will be starting on its own thread. This implementation uses this opportunity to CheckReferencesStates, change state to Starting, and signal subclasses with OnStarting. More...
 
void Start ()
 Starts the component. More...
 
void Stop ()
 Stops the component. More...
 
- Public Member Functions inherited from Apac.ISupervisable
void Initialize (Apac.Configuration.SupervisableConfig config, Supervisors.ISupervisor exec)
 Initializes the component with the given SupervisableConfig (or derivative) and ISupervisor. More...
 
- Public Member Functions inherited from Apac.Data.IDataStore
void Initialize (Configuration.DataStoreConfig config)
 
- Public Member Functions inherited from Apac.Data.IMeasurementStore
void RecordAlerts (Monitoring.Alerts alerts)
 Should records the alerts. More...
 
void RecordAlerts (Monitoring.Alerts alerts, StoreAccessCompleteHandler callout)
 Should records the alerts, will call back on callout . More...
 
void RecordMeasurements (Monitoring.Measurements measurements)
 Should record raw measurements in the given bucket. More...
 
void RecordFiveMinAverages (Monitoring.WeightedMeasurementAvgs averages)
 Should record the given averages to the given 5-minute store. More...
 
void RecordHourlyAverages (Monitoring.WeightedMeasurementAvgs averages)
 Should record the given averages to the given 5-minute store. More...
 
void RecordDailyAverages (Monitoring.WeightedMeasurementAvgs averages)
 Should record the given averages to the given daily store. More...
 
void RecordMonthlyAverages (Monitoring.WeightedMeasurementAvgs averages)
 Should record the given averages to the given monthy store. More...
 
void RecordMeasurements (Monitoring.Measurements measurements, StoreAccessCompleteHandler callout)
 Should record raw measurements in the given bucket and call out to the delegate when complete. More...
 
void RecordFiveMinAverages (Monitoring.WeightedMeasurementAvgs averages, StoreAccessCompleteHandler callout)
 Should record the given averages to the given 5-minute store and call out to the delegate when complete. More...
 
void RecordHourlyAverages (Monitoring.WeightedMeasurementAvgs averages, StoreAccessCompleteHandler callout)
 Should record the given averages to the given 5-minute store and call out to the delegate when complete. More...
 
void RecordDailyAverages (Monitoring.WeightedMeasurementAvgs averages, StoreAccessCompleteHandler callout)
 Should record the given averages to the given daily store and call out to the delegate when complete. More...
 
void RecordMonthlyAverages (Monitoring.WeightedMeasurementAvgs averages, StoreAccessCompleteHandler callout)
 Should record the given averages to the given monthy store and call out to the delegate when complete. More...
 

Protected Member Functions

override void OnInitialize (Apac.Configuration.SupervisableConfig config)
 Prompts the supervisable component to initialize itself. More...
 
override void OnResolveReferences ()
 Called when the supervisable component needs to resolve its runtime references to other components. More...
 
override void OnCheckReferencesStates ()
 Called when the supervisable component needs to check the state of its runtime reference components. More...
 
override void OnStart ()
 Prompts the supervisable component to start functioning. More...
 
override void OnStop ()
 Prompts the supervisable component to stop functioning. More...
 
abstract TimeTrackingList< MeasurementsOnFetchMeasurements (MeasurementQueryCriteria criteria)
 
abstract TimeTrackingList< WeightedMeasurementAvgsOnFetchFiveMinuteAverages (MeasurementQueryCriteria criteria)
 
abstract TimeTrackingList< WeightedMeasurementAvgsOnFetchHourlyAverages (MeasurementQueryCriteria criteria)
 
abstract TimeTrackingList< WeightedMeasurementAvgsOnFetchDailyAverages (MeasurementQueryCriteria criteria)
 
abstract TimeTrackingList< WeightedMeasurementAvgsOnFetchMonthlyAverages (MeasurementQueryCriteria criteria)
 
abstract void OnWriteMeasurements (Measurements measurements)
 
abstract void OnWriteFiveMinuteAvgs (WeightedMeasurementAvgs averages)
 
abstract void OnWriteHourlyAvgs (WeightedMeasurementAvgs averages)
 
abstract void OnWriteDailyAvgs (WeightedMeasurementAvgs averages)
 
abstract void OnWriteMonthlyAvgs (WeightedMeasurementAvgs averages)
 
abstract void OnWriteAlerts (Alerts alerts)
 
abstract Alerts OnRetrieveAlerts (bool activeOnly)
 
abstract void OnInitializeDataStore (Configuration.DataStoreConfig config)
 
abstract void OnOpen ()
 
abstract void OnClose ()
 
abstract void OnPruneRawMeasurements (DateTime cutoffDay)
 
virtual void Dispose (bool disposing)
 
- Protected Member Functions inherited from Apac.Supervisable
abstract void OnInitialize (Apac.Configuration.SupervisableConfig config)
 Called when the supervisable component is intitialized. More...
 
virtual void OnStarting ()
 Called when the supervisable component is about to start. This differs from handling OnStart in that this method is called on the supervisor's thread, whereas Start is called on a new thread. Subclasses may override this to do work that is considered initialization work that should be done before all component threads are started. More...
 
virtual void OnStateChanging (SupervisableState currentState, SupervisableState newState)
 Call chain for state changing notification. More...
 
virtual void OnStateChanged (SupervisableState previousState, SupervisableState newState)
 Call chain for state changed notification. More...
 
virtual void OnException (Exception ex)
 Call chain for exception notification. More...
 
void SetState (SupervisableState newState)
 Changes the state of the controller to the new state. More...
 
virtual void OnStateChangeStarting ()
 
virtual void OnStateChangeRunning ()
 
virtual void OnStateChangeStopping ()
 
virtual void OnStateChangeStopped ()
 
virtual void OnStateChangeInitializing ()
 
virtual void OnStateChangeInitialized ()
 
virtual void OnStateChangeErrored ()
 
virtual void OnStateChangeImpaired ()
 
void HandleException (string message, Exception e)
 Deals with the details of handling exceptions captured by the controller. More...
 
void ResetException ()
 Allows subclasses to reset the last exception to an empty state. More...
 
void HandleImpairment (string message, Exception e)
 Deals with the details of handling non-critical problems captured by the controller. More...
 

Protected Attributes

volatile Configuration.DataStoreConfig _config = null
 

Properties

AlertCache AlertCache [get]
 Gets the alert cache. More...
 
string? Location [get]
 In this store implementation this property indicates the directory for the data file(s). The name of the data files is determined internally. This path also indicates where the mappings file can be located. More...
 
- Properties inherited from Apac.Supervisable
string Name [get]
 Gets the name of the controller, as specified by configuration. Note that if the name is not specified, then an index will be used. More...
 
string Description [get]
 Gets the description of the controller, as specified by configuration. More...
 
bool Prioritized [get]
 Indicates if the supervisable component should be executed on a higher thread priority. More...
 
DateTime LastHeartbeat [get]
 The time of the last heartbeat. More...
 
Supervisors.ISupervisor ExecutiveSupervisor [get]
 Walks the tree to find the top level supervisor. More...
 
bool IsRunning [get]
 Gets a value indicating whether this instance is running. More...
 
SupervisableState CurrentState [get]
 Gets the current overall state of the controller. More...
 
SupervisableState PreviousState [get]
 Gets the previous overall state of the controller. More...
 
Exception LastException [get]
 Gets the last exception encountered within the controller. More...
 
DateTime StartTime [get]
 Gets the time this supervisable component was started. More...
 
DateTime StopTime [get]
 Gets the time this supervisable component was stopped. More...
 
TimeSpan UpTime [get]
 Gets the amount of time this supervisable component has been running, or did run before it was stopped (if IsRunning is false). More...
 
Supervisors.ISupervisor Supervisor [get]
 Gets the supervisor. More...
 
SupervisableConfig Config [get]
 The configuration object used by the supervisable component. More...
 
log4net.ILog Log [get]
 Lazy-initialized logger for subclass usage. More...
 
- Properties inherited from Apac.ISupervisable
string Name [get]
 The name of the component, for unique identification purposes. More...
 
string Description [get]
 The description of the component, for human consumption. More...
 
bool Prioritized [get]
 Indicates if the component should be high priority. More...
 
Supervisors.ISupervisor ExecutiveSupervisor [get]
 Walks the tree to find the top level supervisor. More...
 
bool IsRunning [get]
 Indicates that the component is running. More...
 
DateTime LastHeartbeat [get]
 
DateTime StartTime [get]
 Gets the time this supervisable component was started. More...
 
DateTime StopTime [get]
 Gets the time this supervisable component was stopped. More...
 
TimeSpan UpTime [get]
 Gets the amount of time this supervisable component has been running, or did run before it was stopped (if IsRunning is false). More...
 
SupervisableState CurrentState [get]
 Gets the current SupervisableState of this component. More...
 
SupervisableState PreviousState [get]
 Gets the previous SupervisableState of this component. More...
 
Exception LastException [get]
 Gets the last exception to have occurred and been trapped by this component. More...
 
- Properties inherited from Apac.Data.IDataStore
string Location [get]
 
- Properties inherited from Apac.Data.IMeasurementStore
Monitoring.AlertCache AlertCache [get]
 Gets the alert cache. More...
 

Additional Inherited Members

- Events inherited from Apac.Supervisable
SupervisableStateChangingHandler SupervisableStateChanging
 Notifies listeners that the state is about to change. More...
 
SupervisableStateChangedHandler SupervisableStateChanged
 Notifies listeners that the state has changed. More...
 
SupervisableErroredHandler SupervisableErrored
 Notifies listeners that an error occured within the controller. More...
 
SupervisableHeartbeatHandler SupervisableHeartbeat
 Notifies listeners that the component is still active. More...
 
- Events inherited from Apac.ISupervisable
SupervisableStateChangingHandler SupervisableStateChanging
 Notifies listeners that the state is about to change. More...
 
SupervisableStateChangedHandler SupervisableStateChanged
 Notifies listeners that the state has changed. More...
 
SupervisableErroredHandler SupervisableErrored
 Notifies listeners that an error occured within the controller. More...
 
SupervisableHeartbeatHandler SupervisableHeartbeat
 Notifies listeners that the component is still active. More...
 

Detailed Description

The base implementation of a buffered, threaded measurement store. This class deals with all of the queueing and thread management for a store that will be called from another thread that must not be delayed while the store does its work.

This implementation also keeps statistics about call durations.

Constructor & Destructor Documentation

◆ ThreadedMeasurementStore()

Apac.Data.ThreadedMeasurementStore.ThreadedMeasurementStore ( )
inline

Default constructor.

Member Function Documentation

◆ Close()

void Apac.Data.ThreadedMeasurementStore.Close ( )
inline

Prompts the store to clean up its resources used for recording and fetching data.

Implements Apac.Data.IDataStore.

◆ FetchDailyAverages()

TimeTrackingList<Monitoring.WeightedMeasurementAvgs> Apac.Data.ThreadedMeasurementStore.FetchDailyAverages ( MeasurementQueryCriteria  criteria)
inline

Retrieves daily averages according to the given criteria.

Parameters
criteriaThe query criteria used to determine which averages to return.
Returns
A list of average lists by element id.

Note that this method will run on the thread of the caller.

Implements Apac.Data.IMeasurementQuery.

◆ FetchFiveMinuteAverages()

TimeTrackingList<Monitoring.WeightedMeasurementAvgs> Apac.Data.ThreadedMeasurementStore.FetchFiveMinuteAverages ( MeasurementQueryCriteria  criteria)
inline

Retrieves five minute averages according to the given criteria.

Parameters
criteriaThe query criteria used to determine which averages to return.
Returns
A list of average lists by element id.

Note that this method will run on the thread of the caller.

Implements Apac.Data.IMeasurementQuery.

◆ FetchHourlyAverages()

TimeTrackingList<Monitoring.WeightedMeasurementAvgs> Apac.Data.ThreadedMeasurementStore.FetchHourlyAverages ( MeasurementQueryCriteria  criteria)
inline

Retrieves hourly averages according to the given criteria.

Parameters
criteriaThe query criteria used to determine which averages to return.
Returns
A list of average lists by element id.

Note that this method will run on the thread of the caller.

Implements Apac.Data.IMeasurementQuery.

◆ FetchMeasurements()

TimeTrackingList<Measurements> Apac.Data.ThreadedMeasurementStore.FetchMeasurements ( MeasurementQueryCriteria  criteria)
inline

Retrieves measurements according to the given criteria.

Parameters
criteriaThe query criteria used to determine which measurements to return.
Returns
A list of measurement lists by element id.

Note that this method will run on the thread of the caller.

Implements Apac.Data.IMeasurementQuery.

◆ FetchMonthlyAverages()

TimeTrackingList<Monitoring.WeightedMeasurementAvgs> Apac.Data.ThreadedMeasurementStore.FetchMonthlyAverages ( MeasurementQueryCriteria  criteria)
inline

Retrieves monthly averages according to the given criteria.

Parameters
criteriaThe query criteria used to determine which averages to return.
Returns
A list of average lists by element id.

Note that this method will run on the thread of the caller.

Implements Apac.Data.IMeasurementQuery.

◆ Initialize()

void Apac.Data.ThreadedMeasurementStore.Initialize ( Apac.Configuration.DataStoreConfig  config)
inline

Starts the inheritance call chain for initializing the data store.

Parameters
config

◆ InitializeLifetimeService()

override object Apac.Data.ThreadedMeasurementStore.InitializeLifetimeService ( )
inline

Obtains a lifetime service object to control the lifetime policy for this instance.

Returns
An object of type T:System.Runtime.Remoting.Lifetime.ILease used to control the lifetime policy for this instance. This is the current lifetime service object for this instance if one exists; otherwise, a new lifetime service object initialized to the value of the P:System.Runtime.Remoting.Lifetime.LifetimeServices.LeaseManagerPollTime property.
Exceptions
T:System.Security.SecurityExceptionThe immediate caller does not have infrastructure permission.

<PermissionSet> <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="RemotingConfiguration, Infrastructure"> </PermissionSet>

◆ OnCheckReferencesStates()

override void Apac.Data.ThreadedMeasurementStore.OnCheckReferencesStates ( )
inlineprotectedvirtual

Called when the supervisable component needs to check the state of its runtime reference components.

Implements Apac.Supervisable.

◆ OnInitialize()

override void Apac.Data.ThreadedMeasurementStore.OnInitialize ( Apac.Configuration.SupervisableConfig  config)
inlineprotected

Prompts the supervisable component to initialize itself.

Parameters
configThe configuration setting from which initialization will be driven.

◆ OnResolveReferences()

override void Apac.Data.ThreadedMeasurementStore.OnResolveReferences ( )
inlineprotectedvirtual

Called when the supervisable component needs to resolve its runtime references to other components.

Implements Apac.Supervisable.

◆ OnStart()

override void Apac.Data.ThreadedMeasurementStore.OnStart ( )
inlineprotectedvirtual

Prompts the supervisable component to start functioning.

Implements Apac.Supervisable.

◆ OnStop()

override void Apac.Data.ThreadedMeasurementStore.OnStop ( )
inlineprotectedvirtual

Prompts the supervisable component to stop functioning.

Implements Apac.Supervisable.

◆ Open()

void Apac.Data.ThreadedMeasurementStore.Open ( )
inline

Prompts the store to prepare for recording and fetching data.

Implements Apac.Data.IDataStore.

◆ RecordAlerts() [1/2]

void Apac.Data.ThreadedMeasurementStore.RecordAlerts ( Alerts  alerts)
inline

Should records the alerts.

Parameters
alertsThe alerts.

◆ RecordAlerts() [2/2]

void Apac.Data.ThreadedMeasurementStore.RecordAlerts ( Alerts  alerts,
StoreAccessCompleteHandler  callout 
)
inline

Should records the alerts, will call back on callout .

Parameters
alertsThe alerts.
calloutThe method that will be called whent the store access has completed.

◆ RecordDailyAverages() [1/2]

void Apac.Data.ThreadedMeasurementStore.RecordDailyAverages ( WeightedMeasurementAvgs  averages)
inline

Enqueues the given averages for the daily thread to record.

Parameters
averagesThe averages to be written.

◆ RecordDailyAverages() [2/2]

void Apac.Data.ThreadedMeasurementStore.RecordDailyAverages ( WeightedMeasurementAvgs  averages,
StoreAccessCompleteHandler  callout 
)
inline

Enqueues the given averages for the daily thread to record.

Parameters
averagesThe averages to be written.
calloutThe delegate that gets invoked (asynchronously) when the recording is complete.

◆ RecordFiveMinAverages() [1/2]

void Apac.Data.ThreadedMeasurementStore.RecordFiveMinAverages ( WeightedMeasurementAvgs  averages)
inline

Enqueues the given averages for the 5-minute thread to record.

Parameters
averagesThe averages to be written.

◆ RecordFiveMinAverages() [2/2]

void Apac.Data.ThreadedMeasurementStore.RecordFiveMinAverages ( WeightedMeasurementAvgs  averages,
StoreAccessCompleteHandler  callout 
)
inline

Enqueues the given averages for the 5-minute thread to record.

Parameters
averagesThe averages to be written.
calloutThe delegate that gets invoked (asynchronously) when the recording is complete.

◆ RecordHourlyAverages() [1/2]

void Apac.Data.ThreadedMeasurementStore.RecordHourlyAverages ( WeightedMeasurementAvgs  averages)
inline

Enqueues the given averages for the hourly thread to record.

Parameters
averagesThe averages to be written.

◆ RecordHourlyAverages() [2/2]

void Apac.Data.ThreadedMeasurementStore.RecordHourlyAverages ( WeightedMeasurementAvgs  averages,
StoreAccessCompleteHandler  callout 
)
inline

Enqueues the given averages for the hourly thread to record.

Parameters
averagesThe averages to be written.
calloutThe delegate that gets invoked (asynchronously) when the recording is complete.

◆ RecordMeasurements() [1/2]

void Apac.Data.ThreadedMeasurementStore.RecordMeasurements ( Measurements  measurements)
inline

Enqueues the given averages for the raw data thread to record.

Parameters
measurementsThe measurements to be written.

◆ RecordMeasurements() [2/2]

void Apac.Data.ThreadedMeasurementStore.RecordMeasurements ( Measurements  measurements,
StoreAccessCompleteHandler  callout 
)
inline

Enqueues the given averages for the raw data thread to record.

Parameters
measurementsThe measurements to be written.
calloutThe delegate that gets invoked (asynchronously) when the recording is complete.

◆ RecordMonthlyAverages() [1/2]

void Apac.Data.ThreadedMeasurementStore.RecordMonthlyAverages ( WeightedMeasurementAvgs  averages)
inline

Enqueues the given averages for the monthly thread to record.

Parameters
averagesThe averages to be written.

◆ RecordMonthlyAverages() [2/2]

void Apac.Data.ThreadedMeasurementStore.RecordMonthlyAverages ( WeightedMeasurementAvgs  averages,
StoreAccessCompleteHandler  callout 
)
inline

Enqueues the given averages for the monthly thread to record.

Parameters
averagesThe averages to be written.
calloutThe delegate that gets invoked (asynchronously) when the recording is complete.

◆ RetrieveAlerts()

void Apac.Data.ThreadedMeasurementStore.RetrieveAlerts ( bool  activeOnly,
StoreAccessCompleteHandler  callout 
)
inline

Should retrieve the alerts.

Parameters
activeOnlyIndicates if only active alerts should be retrieved.
calloutThe method that will be called whent the store access has completed.

Implements Apac.Data.IMeasurementStore.

Property Documentation

◆ AlertCache

AlertCache Apac.Data.ThreadedMeasurementStore.AlertCache
get

Gets the alert cache.

The alert cache.

◆ Location

string? Apac.Data.ThreadedMeasurementStore.Location
get

In this store implementation this property indicates the directory for the data file(s). The name of the data files is determined internally. This path also indicates where the mappings file can be located.


The documentation for this class was generated from the following file: