Loading...
Searching...
No Matches
SmartDataDistributionBase Class Reference

Smart class to manage IDataDistributionCallback and IDataDistributionMastershipCallback. More...

#include <SmartDataDistributionManager.h>

Inheritance diagram for SmartDataDistributionBase:
IDataDistributionCallback IDataDistributionMastershipCallback SmartDataDistribution< T >

Public Member Functions

 SmartDataDistributionBase ()
 Initialize a new SmartDataDistributionBase.
 
 ~SmartDataDistributionBase ()
 Destructor of SmartDataDistributionBase.
 
OPERATION_RESULT Initialize (const char *conf_file, const char *hostAddress=0, const char *channelTrailer=0)
 Initialize SmartDataDistributionBase system.
 
OPERATION_RESULT Initialize (const char *arrayParams[], int len, const char *hostAddress=0, const char *channelTrailer=0)
 Initialize IDataDistribution instance.
 
OPERATION_RESULT RequestMastershipManager (const char *hostAddress=NULL, const char *arrayParams[]=NULL, int len=0)
 Allocate and initialize the mastership manager.
 
BOOL Start (unsigned long timeout)
 Start the common manager.
 
BOOL Stop (unsigned long timeout)
 Stop the common manager.
 
std::string GetProtocol ()
 Returns the protocol in use from IDataDistribution instance.
 
std::string GetProtocolLib ()
 Returns the protocol library in use from IDataDistribution instance.
 
std::string GetMastershipLib ()
 Returns the mastership library in use from IDataDistribution instance.
 

Protected Member Functions

virtual const char * OnConfiguration (const char *channelName, const char *key, const char *value)
 Function invoked during configuration validation.
 
virtual void OnLogging (DDM_LOG_LEVEL level, const char *source, const char *function, const char *logStr)
 Function invoked when a log is emitted from subsystem.
 
virtual void OnCompletelyDisconnected (const char *channelName, const char *reason)
 Callback invoked on a complete disconnection.
 
virtual void OnClusterStateChange (DDM_CLUSTEREVENT change, int64_t serverid)
 Callback invoked to report cluster state change.
 
virtual void OnStateChange (DDM_INSTANCE_STATE newState, DDM_INSTANCE_STATE oldState)
 Callback invoked to report a state change.
 
virtual void OnStateReady (void *pState, int64_t len)
 Callback invoked when a state transfer is completed.
 
virtual void OnRequestedState (void **pState, size_t *len)
 Callback invoked when a state transfer is requested.
 
virtual void OnMultiplePrimary (int64_t myId, int64_t otherId)
 Callback invoked when multiple primary server are detected.
 
virtual void FirstStateChange (DDM_INSTANCE_STATE newState)
 Callback invoked to report a first state change.
 
virtual void ChangingState (DDM_INSTANCE_STATE actualState, DDM_INSTANCE_STATE futureState)
 Callback invoked to report a starting instance state change.
 
virtual void ChangedState (DDM_INSTANCE_STATE actualState)
 Callback invoked to report a finished instance state change.
 
- Protected Member Functions inherited from IDataDistributionCallback
- Protected Member Functions inherited from IDataDistributionMastershipCallback

Protected Attributes

IDataDistributionm_pIDataDistribution
 
IDataDistributionMastershipCommonm_pIDataDistributionMastershipCommon
 
OPERATION_RESULT m_pInitializeHRESULT
 

Detailed Description

Smart class to manage IDataDistributionCallback and IDataDistributionMastershipCallback.

The main class to manage Data Distribution

Constructor & Destructor Documentation

◆ SmartDataDistributionBase()

SmartDataDistributionBase::SmartDataDistributionBase ( )

Initialize a new SmartDataDistributionBase.

◆ ~SmartDataDistributionBase()

SmartDataDistributionBase::~SmartDataDistributionBase ( )

Destructor of SmartDataDistributionBase.

Member Function Documentation

◆ ChangedState()

virtual void SmartDataDistributionBase::ChangedState ( DDM_INSTANCE_STATE actualState)
protectedvirtual

Callback invoked to report a finished instance state change.

Callback invoked when subsystem needs to report a state change.

actualState reports the actual DDM_INSTANCE_STATE state

Implements IDataDistributionMastershipCallback.

◆ ChangingState()

virtual void SmartDataDistributionBase::ChangingState ( DDM_INSTANCE_STATE actualState,
DDM_INSTANCE_STATE futureState )
protectedvirtual

Callback invoked to report a starting instance state change.

Callback invoked when subsystem needs to report a state change.

futureState reports the future DDM_INSTANCE_STATE state actualState reports the actual DDM_INSTANCE_STATE state

Implements IDataDistributionMastershipCallback.

◆ FirstStateChange()

virtual void SmartDataDistributionBase::FirstStateChange ( DDM_INSTANCE_STATE newState)
protectedvirtual

Callback invoked to report a first state change.

Callback invoked when subsystem needs to to report a first state change

newState DDM_INSTANCE_STATE state

Implements IDataDistributionMastershipCallback.

◆ GetMastershipLib()

std::string SmartDataDistributionBase::GetMastershipLib ( )

Returns the mastership library in use from IDataDistribution instance.

Returns
the mastership library name

◆ GetProtocol()

std::string SmartDataDistributionBase::GetProtocol ( )

Returns the protocol in use from IDataDistribution instance.

Returns
the protocol name

◆ GetProtocolLib()

std::string SmartDataDistributionBase::GetProtocolLib ( )

Returns the protocol library in use from IDataDistribution instance.

Returns
the protocol library name

◆ Initialize() [1/2]

OPERATION_RESULT SmartDataDistributionBase::Initialize ( const char * arrayParams[],
int len,
const char * hostAddress = 0,
const char * channelTrailer = 0 )

Initialize IDataDistribution instance.

arrayParams an array of string in the form key=value len length of arrayParams hostAddress optional host address or host name channelTrailer the optional trailer to be appended to channel name when each channel is created

Returns
the OPERATION_RESULT of the operation

◆ Initialize() [2/2]

OPERATION_RESULT SmartDataDistributionBase::Initialize ( const char * conf_file,
const char * hostAddress = 0,
const char * channelTrailer = 0 )

Initialize SmartDataDistributionBase system.

conf_file the external ASCII configuration file with lines written as key=value hostAddress optional host address or host name channelTrailer the optional trailer to be appended to channel name when each channel is created

Returns
the OPERATION_RESULT of the operation

◆ OnClusterStateChange()

virtual void SmartDataDistributionBase::OnClusterStateChange ( DDM_CLUSTEREVENT change,
int64_t serverid )
protectedvirtual

Callback invoked to report cluster state change.

Callback invoked when subsystem needs to report a cluster state change.

change reports the DDM_CLUSTEREVENT event serverid the server id reporting the change

Implements IDataDistributionMastershipCallback.

◆ OnCompletelyDisconnected()

virtual void SmartDataDistributionBase::OnCompletelyDisconnected ( const char * channelName,
const char * reason )
protectedvirtual

Callback invoked on a complete disconnection.

Callback invoked when subsystem detects a complete disconnection from central server or other peers. channelName reports the disconnected channel reason is the reason of disconnection.

Implements IDataDistributionCallback.

◆ OnConfiguration()

virtual const char * SmartDataDistributionBase::OnConfiguration ( const char * channelName,
const char * key,
const char * value )
protectedvirtual

Function invoked during configuration validation.

The callback is usable to override configuration parameters in some special conditions. channelName reports the channel involved (null for global parameters), key is the parameter key to be checked and value is the actual value.

Returns
value if no change is needed, otherwise any new string value according to the expected parameter type

Implements IDataDistributionCallback.

◆ OnLogging()

virtual void SmartDataDistributionBase::OnLogging ( DDM_LOG_LEVEL level,
const char * source,
const char * function,
const char * logStr )
protectedvirtual

Function invoked when a log is emitted from subsystem.

The callback is usable to receive log information. level is the DDM_LOG_LEVEL of the log reported source is the module source name of the log function is the function, within the module, reporting the log logStr is the reported log string

See also
IDataDistributionLog::Log

Implements IDataDistributionCallback.

◆ OnMultiplePrimary()

virtual void SmartDataDistributionBase::OnMultiplePrimary ( int64_t myId,
int64_t otherId )
protectedvirtual

Callback invoked when multiple primary server are detected.

Callback invoked when subsystem needs to report there are multiple primary server are detected

myId my primary identifier otherId other primary identifier

Implements IDataDistributionMastershipCallback.

◆ OnRequestedState()

virtual void SmartDataDistributionBase::OnRequestedState ( void ** pState,
size_t * len )
protectedvirtual

Callback invoked when a state transfer is requested.

Callback invoked when subsystem needs to request a state transfer. Fill pState and len with state information

pState pointer to the buffer of the state len the length of the buffer

Implements IDataDistributionMastershipCallback.

◆ OnStateChange()

virtual void SmartDataDistributionBase::OnStateChange ( DDM_INSTANCE_STATE newState,
DDM_INSTANCE_STATE oldState )
protectedvirtual

Callback invoked to report a state change.

Callback invoked when subsystem needs to report a state change.

newState reports the new DDM_INSTANCE_STATE state oldState reports the new DDM_INSTANCE_STATE state

Implements IDataDistributionMastershipCallback.

◆ OnStateReady()

virtual void SmartDataDistributionBase::OnStateReady ( void * pState,
int64_t len )
protectedvirtual

Callback invoked when a state transfer is completed.

Callback invoked when subsystem needs to report a completed state transfer

pState pointer to the buffer of the state len the length of the buffer

Implements IDataDistributionMastershipCallback.

◆ RequestMastershipManager()

OPERATION_RESULT SmartDataDistributionBase::RequestMastershipManager ( const char * hostAddress = NULL,
const char * arrayParams[] = NULL,
int len = 0 )

Allocate and initialize the mastership manager.

hostAddress optional host address or host name arrayParams an array of string in the form key=value len length of arrayParams

Returns
the OPERATION_RESULT of the operation

◆ Start()

BOOL SmartDataDistributionBase::Start ( unsigned long timeout)

Start the common manager.

timeout the operation timeout in milliseconds

Returns
the OPERATION_RESULT of the operation

◆ Stop()

BOOL SmartDataDistributionBase::Stop ( unsigned long timeout)

Stop the common manager.

timeout the operation timeout in milliseconds

Returns
the OPERATION_RESULT of the operation

Member Data Documentation

◆ m_pIDataDistribution

IDataDistribution* SmartDataDistributionBase::m_pIDataDistribution
protected

◆ m_pIDataDistributionMastershipCommon

IDataDistributionMastershipCommon* SmartDataDistributionBase::m_pIDataDistributionMastershipCommon
protected

◆ m_pInitializeHRESULT

OPERATION_RESULT SmartDataDistributionBase::m_pInitializeHRESULT
protected

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