|
From: <rus...@us...> - 2008-11-07 04:21:15
|
Revision: 360
http://gearbox.svn.sourceforge.net/gearbox/?rev=360&view=rev
Author: russo2503v
Date: 2008-11-07 04:21:07 +0000 (Fri, 07 Nov 2008)
Log Message:
-----------
added subsystem type
Modified Paths:
--------------
gearbox/trunk/src/gbxutilacfr/status.h
gearbox/trunk/src/gbxutilacfr/trivialstatus.cpp
gearbox/trunk/src/gbxutilacfr/trivialstatus.h
Modified: gearbox/trunk/src/gbxutilacfr/status.h
===================================================================
--- gearbox/trunk/src/gbxutilacfr/status.h 2008-11-07 01:35:28 UTC (rev 359)
+++ gearbox/trunk/src/gbxutilacfr/status.h 2008-11-07 04:21:07 UTC (rev 360)
@@ -78,6 +78,14 @@
//! Returns human-readable string with subsystem status information.
std::string toString( const SubsystemStatus& status );
+//! Subsystem type which describes common behavior models of a subsystem.
+enum SubsystemType {
+ //! Standard model: subsystem's life cycle equal to the life cycle of the component.
+ SubsystemStandard,
+ //! Early exit model: subsystem will intentionally shutdown early.
+ SubsystemEarlyExit
+};
+
/*!
@brief Local interface to component status.
@@ -96,9 +104,8 @@
The default initial status of a subsystem is @c Idle with health @c OK.
After registering a subsystem, a subsystem can report its state and health.
-Each of the calls is sufficient to let
-the Status engine know that the subsystem is alive. The special call
-'heartbeat' lets Status know that the subsystem is alive without
+Each of the calls is sufficient to let the Status engine know that the subsystem is alive.
+The special call heartbeat() lets Status know that the subsystem is alive without
modifying its status.
The 'maxHeartbeatIntervalSec' parameter tells the Status engine how often it
@@ -173,12 +180,16 @@
An Exception is also raised when trying to add a subsystem with an existing name.
- It is also possible to specify the maximum expected interval between heartbeats. See setMaxHeartbeatInterval()
+ It is possible to specify the maximum expected interval between heartbeats. See setMaxHeartbeatInterval()
for details.
+
+ It is also possible to describe the expected behavior of the subsystem by specifying SubsystemType. See
+ setSubsystemType() for details.
The initial status of the new subsystem is the same as produced by the empty constructor of SubsystemStatus.
*/
- virtual void addSubsystem( const std::string& subsystem, double maxHeartbeatIntervalSec=-1.0 )=0;
+ virtual void addSubsystem( const std::string& subsystem,
+ double maxHeartbeatIntervalSec=-1.0, SubsystemType type=SubsystemStandard )=0;
//! Removes a subsystem from the status descriptor.
//! Throws Exception if the subsystem does not exist.
@@ -194,12 +205,15 @@
//! Returns state of the component infrastructure.
virtual SubsystemState infrastructureState()=0;
- //! Modifies maximum expected interval between heartbeats (in seconds).
+ //! Sets the maximum expected interval between heartbeats (in seconds).
//! When time since the last heartbeat exceeds the specified value, the subsystem is considered stalled.
//! Negative interval means infinite interval.
//! Throws Exception if the subsystem does not exist.
virtual void setMaxHeartbeatInterval( const std::string& subsystem, double intervalSec )=0;
+ //! Sets the subsystem type which describes the expected behavior of the subsystem.
+ virtual void setSubsystemType( const std::string& subsystem, SubsystemType type )=0;
+
//
// BOTH STATE AND HEALTH CHANGES
//
@@ -258,11 +272,11 @@
// INFRASTRUCTURE STATE CHANGES
//
//! Sets state of component infrastructure to Initialising.
- virtual void compInitialising()=0;
+ virtual void infrastructureInitialising()=0;
//! Sets state of component infrastructure to Working.
- virtual void compWorking()=0;
+ virtual void infrastructureWorking()=0;
//! Sets state of component infrastructure to Finalising.
- virtual void compFinalising()=0;
+ virtual void infrastructureFinalising()=0;
//
// Utility
Modified: gearbox/trunk/src/gbxutilacfr/trivialstatus.cpp
===================================================================
--- gearbox/trunk/src/gbxutilacfr/trivialstatus.cpp 2008-11-07 01:35:28 UTC (rev 359)
+++ gearbox/trunk/src/gbxutilacfr/trivialstatus.cpp 2008-11-07 04:21:07 UTC (rev 360)
@@ -30,7 +30,7 @@
}
void
-TrivialStatus::addSubsystem( const std::string& subsystem, double maxHeartbeatIntervalSec )
+TrivialStatus::addSubsystem( const std::string& subsystem, double maxHeartbeatIntervalSec, SubsystemType type )
{
tracer_.warning( "TrivialStatus: this implementation of Status does not store status of the subsystems" );
}
@@ -66,6 +66,12 @@
}
void
+TrivialStatus::setSubsystemType( const std::string& subsystem, SubsystemType type )
+{
+ // does nothing
+}
+
+void
TrivialStatus::setSubsystemStatus( const std::string& subsystem, gbxutilacfr::SubsystemState state,
gbxutilacfr::SubsystemHealth health, const std::string& msg )
{
@@ -184,19 +190,19 @@
}
void
-TrivialStatus::compInitialising()
+TrivialStatus::infrastructureInitialising()
{
tracer_.info( "Component infrastructure changed state to Initialising." );
}
void
-TrivialStatus::compWorking()
+TrivialStatus::infrastructureWorking()
{
tracer_.info( "Component infrastructure changed state to Working." );
}
void
-TrivialStatus::compFinalising()
+TrivialStatus::infrastructureFinalising()
{
tracer_.info( "Component infrastructure changed state to Finalising." );
}
Modified: gearbox/trunk/src/gbxutilacfr/trivialstatus.h
===================================================================
--- gearbox/trunk/src/gbxutilacfr/trivialstatus.h 2008-11-07 01:35:28 UTC (rev 359)
+++ gearbox/trunk/src/gbxutilacfr/trivialstatus.h 2008-11-07 04:21:07 UTC (rev 360)
@@ -31,7 +31,8 @@
TrivialStatus( Tracer& tracer,
bool stateChange=true, bool ok=false, bool warn=true, bool fault=true, bool heartbeat=false );
- virtual void addSubsystem( const std::string& subsystem, double maxHeartbeatIntervalSec=-1.0 );
+ virtual void addSubsystem( const std::string& subsystem,
+ double maxHeartbeatIntervalSec=-1.0, SubsystemType type=SubsystemStandard );
virtual void removeSubsystem( const std::string& subsystem );
//! Does not keep track of subsystems, returns empty vector.
virtual std::vector<std::string> subsystems();
@@ -40,6 +41,7 @@
//! Does not keep track of infrastructure state, throws Exception on any query
virtual SubsystemState infrastructureState();
virtual void setMaxHeartbeatInterval( const std::string& subsystem, double interval );
+ virtual void setSubsystemType( const std::string& subsystem, SubsystemType type );
virtual void setSubsystemStatus( const std::string& subsystem, SubsystemState state, SubsystemHealth health, const std::string& msg="" );
@@ -53,9 +55,9 @@
virtual void heartbeat( const std::string& subsystem );
virtual void message( const std::string& subsystem, const std::string& msg );
- virtual void compInitialising();
- virtual void compWorking();
- virtual void compFinalising();
+ virtual void infrastructureInitialising();
+ virtual void infrastructureWorking();
+ virtual void infrastructureFinalising();
virtual void process();
private:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|