OpenSDN source code
|
#include <sandesh_state_machine.h>
Classes | |
struct | EventContainer |
Public Member Functions | |
SandeshStateMachine (const char *prefix, SandeshConnection *connection) | |
~SandeshStateMachine () | |
void | Initialize () |
void | SetAdminState (bool down) |
void | SetDeferDequeue (bool defer) |
template<class Ev > | |
void | OnIdle (const Ev &event) |
template<class Ev > | |
void | ReleaseSandesh (const Ev &event) |
template<class Ev > | |
void | DeleteTcpSession (const Ev &event) |
template<class Ev > | |
void | ProcessMessage (const Ev &event) |
void | StartIdleHoldTimer () |
void | CancelIdleHoldTimer () |
bool | IdleHoldTimerRunning () |
void | IdleHoldTimerFired () |
void | OnSessionEvent (TcpSession *session, TcpSession::Event event) |
void | PassiveOpen (SandeshSession *session) |
void | SandeshUVESend (SandeshUVE *usnh) |
bool | OnSandeshMessage (SandeshSession *session, const std::string &msg) |
void | ResourceUpdate (bool rsc) |
const std::string & | StateName () const |
const std::string & | LastStateName () const |
SandeshConnection * | connection () |
void | DeleteSession (SandeshSession *session) |
void | set_session (SandeshSession *session) |
void | clear_session () |
SandeshSession * | session () |
void | set_state (ssm::SsmState state) |
ssm::SsmState | get_state () const |
bool | get_resource () const |
void | set_resource (bool r) |
int | idle_hold_time () const |
void | reset_idle_hold_time () |
void | set_idle_hold_time (int idle_hold_time) |
void | set_last_event (const std::string &event) |
const std::string | last_event () const |
void | reset_last_info () |
void | Shutdown (void) |
void | unconsumed_event (const sc::event_base &event) |
const char * | prefix () |
void | SetGeneratorKey (const std::string &generator) |
const std::string & | generator_key () const |
void | SetQueueWaterMarkInfo (Sandesh::QueueWaterMarkInfo &wm) |
void | ResetQueueWaterMarkInfo () |
bool | GetQueueCount (uint64_t &queue_count) const |
bool | GetMessageDropLevel (std::string &drop_level) const |
bool | GetStatistics (SandeshStateMachineStats &sm_stats, SandeshGeneratorBasicStats &basic_msg_stats) |
bool | GetBasicStatistics (SandeshStateMachineStats *sm_stats, SandeshGeneratorBasicStats *basic_msg_stats) |
bool | GetStatistics (SandeshStateMachineStats &sm_stats, SandeshGeneratorStats &detail_msg_stats) |
bool | GetDetailStatistics (SandeshStateMachineStats *sm_stats, SandeshGeneratorStats *detail_msg_stats) |
size_t | GetMaxQueueCount () const |
Static Public Attributes | |
static const int | kIdleHoldTime = 5000 |
static const int | kQueueSize = 200 * 1024 * 1024 |
Private Types | |
typedef WorkQueue< EventContainer > | EventQueue |
Private Member Functions | |
void | TimerErrorHandler (std::string name, std::string error) |
bool | IdleHoldTimerExpired () |
template<typename Ev > | |
void | Enqueue (const Ev &event) |
bool | DequeueEvent (EventContainer ec) |
bool | LogEvent (const sc::event_base *event) |
void | UpdateRxMsgStats (const std::string &msg_name, size_t msg_size) |
void | UpdateRxMsgFailStats (const std::string &msg_name, size_t msg_size, SandeshRxDropReason::type dreason) |
void | UpdateEventDequeue (const sc::event_base &event) |
void | UpdateEventDequeueFail (const sc::event_base &event) |
void | UpdateEventEnqueue (const sc::event_base &event) |
void | UpdateEventEnqueueFail (const sc::event_base &event) |
void | UpdateEventStats (const sc::event_base &event, bool enqueue, bool fail) |
void | GetEventStatistics (SandeshStateMachineStats *sm_stats) |
void | GetDetailMessageStatistics (SandeshGeneratorStats *detail_msg_stats) |
void | GetBasicMessageStatistics (SandeshGeneratorBasicStats *basic_msg_stats) |
void | SetSandeshMessageDropLevel (size_t queue_count, SandeshLevel::type level, boost::function< void(void)> cb) |
void | SetDeferSessionReader (bool defer_reader) |
bool | IsValid () const |
DISALLOW_COPY_AND_ASSIGN (SandeshStateMachine) | |
Private Attributes | |
const char * | prefix_ |
tbb::mutex | smutex_ |
EventQueue | work_queue_ |
SandeshConnection * | connection_ |
SandeshSession * | session_ |
Timer * | idle_hold_timer_ |
int | idle_hold_time_ |
bool | deleted_ |
tbb::atomic< ssm::SsmState > | state_ |
bool | resource_ |
ssm::SsmState | last_state_ |
uint64_t | state_since_ |
std::string | last_event_ |
uint64_t | last_event_at_ |
std::string | generator_key_ |
SandeshEventStatistics | event_stats_ |
SandeshMessageStatistics | message_stats_ |
SandeshMessageBuilder * | builder_ |
SandeshLevel::type | message_drop_level_ |
Friends | |
class | SandeshServerStateMachineTest |
class | SandeshClientStateMachineTest |
class | WorkQueue< EventContainer > |
bool | GetEvSandeshMessageRecvSize (EventContainer *ec, size_t *msg_size) |
Definition at line 57 of file sandesh_state_machine.h.
|
private |
Definition at line 204 of file sandesh_state_machine.h.
SandeshStateMachine::SandeshStateMachine | ( | const char * | prefix, |
SandeshConnection * | connection | ||
) |
Definition at line 381 of file sandesh_state_machine.cc.
SandeshStateMachine::~SandeshStateMachine | ( | ) |
void SandeshStateMachine::CancelIdleHoldTimer | ( | ) |
void SandeshStateMachine::clear_session | ( | ) |
|
inline |
Definition at line 102 of file sandesh_state_machine.h.
void SandeshStateMachine::DeleteSession | ( | SandeshSession * | session | ) |
void SandeshStateMachine::DeleteTcpSession | ( | const Ev & | event | ) |
|
private |
|
private |
|
private |
|
inline |
Definition at line 147 of file sandesh_state_machine.h.
|
inline |
Definition at line 116 of file sandesh_state_machine.h.
|
inline |
Definition at line 114 of file sandesh_state_machine.h.
|
private |
bool SandeshStateMachine::GetBasicStatistics | ( | SandeshStateMachineStats * | sm_stats, |
SandeshGeneratorBasicStats * | basic_msg_stats | ||
) |
|
private |
bool SandeshStateMachine::GetDetailStatistics | ( | SandeshStateMachineStats * | sm_stats, |
SandeshGeneratorStats * | detail_msg_stats | ||
) |
|
private |
|
inline |
bool SandeshStateMachine::GetMessageDropLevel | ( | std::string & | drop_level | ) | const |
bool SandeshStateMachine::GetQueueCount | ( | uint64_t & | queue_count | ) | const |
bool SandeshStateMachine::GetStatistics | ( | SandeshStateMachineStats & | sm_stats, |
SandeshGeneratorBasicStats & | basic_msg_stats | ||
) |
bool SandeshStateMachine::GetStatistics | ( | SandeshStateMachineStats & | sm_stats, |
SandeshGeneratorStats & | detail_msg_stats | ||
) |
|
inline |
Definition at line 119 of file sandesh_state_machine.h.
|
private |
void SandeshStateMachine::IdleHoldTimerFired | ( | ) |
bool SandeshStateMachine::IdleHoldTimerRunning | ( | ) |
void SandeshStateMachine::Initialize | ( | ) |
|
private |
Definition at line 587 of file sandesh_state_machine.cc.
|
inline |
Definition at line 130 of file sandesh_state_machine.h.
const string & SandeshStateMachine::LastStateName | ( | ) | const |
Definition at line 750 of file sandesh_state_machine.cc.
|
private |
Definition at line 754 of file sandesh_state_machine.cc.
void SandeshStateMachine::OnIdle | ( | const Ev & | event | ) |
bool SandeshStateMachine::OnSandeshMessage | ( | SandeshSession * | session, |
const std::string & | msg | ||
) |
void SandeshStateMachine::OnSessionEvent | ( | TcpSession * | session, |
TcpSession::Event | event | ||
) |
void SandeshStateMachine::PassiveOpen | ( | SandeshSession * | session | ) |
|
inline |
Definition at line 142 of file sandesh_state_machine.h.
void SandeshStateMachine::ProcessMessage | ( | const Ev & | event | ) |
void SandeshStateMachine::ReleaseSandesh | ( | const Ev & | event | ) |
|
inline |
Definition at line 120 of file sandesh_state_machine.h.
|
inline |
Definition at line 134 of file sandesh_state_machine.h.
void SandeshStateMachine::ResetQueueWaterMarkInfo | ( | ) |
void SandeshStateMachine::ResourceUpdate | ( | bool | rsc | ) |
void SandeshStateMachine::SandeshUVESend | ( | SandeshUVE * | usnh | ) |
SandeshSession * SandeshStateMachine::session | ( | ) |
Definition at line 476 of file sandesh_state_machine.cc.
|
inline |
|
inline |
|
inline |
Definition at line 117 of file sandesh_state_machine.h.
void SandeshStateMachine::set_session | ( | SandeshSession * | session | ) |
|
inline |
void SandeshStateMachine::SetAdminState | ( | bool | down | ) |
void SandeshStateMachine::SetDeferDequeue | ( | bool | defer | ) |
|
private |
|
inline |
Definition at line 144 of file sandesh_state_machine.h.
void SandeshStateMachine::SetQueueWaterMarkInfo | ( | Sandesh::QueueWaterMarkInfo & | wm | ) |
|
private |
void SandeshStateMachine::Shutdown | ( | void | ) |
void SandeshStateMachine::StartIdleHoldTimer | ( | ) |
const string & SandeshStateMachine::StateName | ( | ) | const |
Definition at line 746 of file sandesh_state_machine.cc.
|
private |
Definition at line 527 of file sandesh_state_machine.cc.
void SandeshStateMachine::unconsumed_event | ( | const sc::event_base & | event | ) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
friend |
Definition at line 914 of file sandesh_state_machine.cc.
|
friend |
Definition at line 166 of file sandesh_state_machine.h.
|
friend |
Definition at line 165 of file sandesh_state_machine.h.
|
friend |
Definition at line 175 of file sandesh_state_machine.h.
|
private |
Definition at line 221 of file sandesh_state_machine.h.
|
private |
Definition at line 206 of file sandesh_state_machine.h.
|
private |
Definition at line 210 of file sandesh_state_machine.h.
|
private |
Definition at line 219 of file sandesh_state_machine.h.
|
private |
Definition at line 218 of file sandesh_state_machine.h.
|
private |
Definition at line 209 of file sandesh_state_machine.h.
|
private |
Definition at line 208 of file sandesh_state_machine.h.
|
static |
Definition at line 60 of file sandesh_state_machine.h.
|
static |
Definition at line 61 of file sandesh_state_machine.h.
|
private |
Definition at line 215 of file sandesh_state_machine.h.
|
private |
Definition at line 216 of file sandesh_state_machine.h.
|
private |
Definition at line 213 of file sandesh_state_machine.h.
|
private |
Definition at line 222 of file sandesh_state_machine.h.
|
private |
Definition at line 220 of file sandesh_state_machine.h.
|
private |
Definition at line 202 of file sandesh_state_machine.h.
|
private |
Definition at line 212 of file sandesh_state_machine.h.
|
private |
Definition at line 207 of file sandesh_state_machine.h.
|
mutableprivate |
Definition at line 203 of file sandesh_state_machine.h.
|
private |
Definition at line 211 of file sandesh_state_machine.h.
|
private |
Definition at line 214 of file sandesh_state_machine.h.
|
private |
Definition at line 205 of file sandesh_state_machine.h.