19#if !defined(DATADISTRIBUTIONMANAGER_H__INCLUDED_)
20#define DATADISTRIBUTIONMANAGER_H__INCLUDED_
188 virtual void Log(
const DDM_LOG_LEVEL level,
const char *sourceName,
const char *function,
const char *format, ...) = 0;
199 virtual void Log(
const DDM_LOG_LEVEL level,
const char *sourceName,
const char *function,
const char *format, va_list args) = 0;
222 virtual const char *
OnConfiguration(
const char *channelName,
const char *key,
const char *value) = 0;
298 ChannelName = channelName;
300 IsDataAvailable = FALSE;
308 SubSystemReason = NULL;
328 Timestamp = timestamp;
332 BufferLength = bufferLength;
333 IsDataAvailable = TRUE;
350 Condition = condition;
351 NativeCode = nativeCode;
352 SubSystemReason = subSystemReason;
916 virtual void SetParameter(
const char *paramName,
const char *paramValue) = 0;
1070 virtual BOOL
Start(
unsigned long timeout) = 0;
1078 virtual BOOL
Stop(
unsigned long timeout) = 0;
DDM_CHANNEL_DIRECTION
DDM_CHANNEL_DIRECTION type.
Definition DataDistributionManagerEnums.h:70
DDM_GENERAL_PARAMETER
DDM_GENERAL_PARAMETER type.
Definition DataDistributionManagerEnums.h:50
DDM_SEEKKIND
DDM_SEEKKIND type.
Definition DataDistributionManagerEnums.h:163
DDM_LOG_LEVEL
DDM_LOG_LEVEL type.
Definition DataDistributionManagerEnums.h:87
DDM_INSTANCE_STATE
DDM_INSTANCE_STATE type.
Definition DataDistributionManagerEnums.h:112
DDM_CLUSTEREVENT
DDM_CLUSTEREVENT type.
Definition DataDistributionManagerEnums.h:133
DDM_SEEKCONTEXT
DDM_SEEKCONTEXT type.
Definition DataDistributionManagerEnums.h:149
DataDistributionManager library.
#define DDM_NO_TIMESTAMP
Definition to avoid timestamp on write.
Definition DataDistributionManagerTypes.h:76
long OPERATION_RESULT
OPERATION_RESULT type.
Definition DataDistributionManagerTypes.h:102
void * GENERIC_HANDLE
Generic handle definition, used for thread, lock, mutex.
Definition DataDistributionManagerTypes.h:94
#define CHANNEL_HANDLE_PARAMETER
Channel handle parameter definition.
Definition DataDistributionManagerTypes.h:89
#define CHANNEL_HANDLE
Channel handle definition.
Definition DataDistributionManagerTypes.h:84
#define DDM_NO_ERROR_CONDITION
Definition DataDistributionManagerTypes.h:112
const char *(FUNCALL * dataDistributionConfigurationCb)(const void *opaque, const char *channelName, const char *key, const char *value)
C-style callback invoked for each key-value in the configuration.
Definition DataDistributionManager.h:58
void(FUNCALL * dataDistributionOnClusterStateChange)(void *opaque, DDM_CLUSTEREVENT change, int64_t serverid)
C-style callback invoked to report cluster state change.
Definition DataDistributionManager.h:450
struct DDM_EXPORT UnderlyingEventData * pUnderlyingEventData
void(FUNCALL * dataDistributionCompletelyDisconnectedCb)(const void *opaque, const char *channelName, const char *reason)
C-style callback invoked on a complete disconnection .
Definition DataDistributionManager.h:85
struct DDM_EXPORT UnderlyingEventData UnderlyingEventData
Class to reports information from transport subsystem.
void(FUNCALL * dataDistributionOnRequestedState)(void *opaque, void **pState, size_t *len)
C-style callback invoked when a state transfer is requested.
Definition DataDistributionManager.h:489
void(FUNCALL * dataDistributionOnMultiplePrimary)(void *opaque, int64_t myId, int64_t otherId)
C-style callback invoked when multiple primary server are detected.
Definition DataDistributionManager.h:502
std::map< int64_t, ClusterHealthElement * > ClusterHealth
Association map between server id and ClusterHealthElement.
Definition DataDistributionManager.h:882
void(FUNCALL * dataDistributionFirstStateChange)(void *opaque, DDM_INSTANCE_STATE newState)
C-style callback invoked to report a first state change.
Definition DataDistributionManager.h:514
void(FUNCALL * dataDistributionOnStateChange)(void *opaque, DDM_INSTANCE_STATE newState, DDM_INSTANCE_STATE oldState)
C-style callback invoked to report a state change.
Definition DataDistributionManager.h:463
std::map< int64_t, ClusterHealthElement * >::const_iterator ClusterHealthIterator
Iterator of ClusterHealth.
Definition DataDistributionManager.h:887
void(FUNCALL * dataDistributionChangingState)(void *opaque, DDM_INSTANCE_STATE actualState, DDM_INSTANCE_STATE futureState)
C-style callback invoked to report a starting instance state change.
Definition DataDistributionManager.h:527
void(FUNCALL * dataDistributionLoggingCb)(const void *opaque, const DDM_LOG_LEVEL level, const char *source, const char *function, const char *logStr)
C-style callback invoked when a log is emitted from subsystem.
Definition DataDistributionManager.h:73
void(FUNCALL * dataDistributionChangedState)(void *opaque, DDM_INSTANCE_STATE actualState)
C-style callback invoked to report a finished instance state change.
Definition DataDistributionManager.h:539
void(FUNCALL * dataDistributionOnStateReady)(void *opaque, void *pState, int64_t len)
C-style callback invoked when a state transfer is completed.
Definition DataDistributionManager.h:476
void(FUNCALL * dataDistributionUnderlyingEvent)(const void *opaque, const CHANNEL_HANDLE_PARAMETER, const UnderlyingEventData *uEvent)
C-style callback invoked to report UnderlyingEventData.
Definition DataDistributionManager.h:367
Class to convert C style callback into C++ callback.
Definition DataDistributionManager.h:253
static IDataDistributionCallback * create(void *opaque, dataDistributionConfigurationCb confCb, dataDistributionLoggingCb logCb, dataDistributionCompletelyDisconnectedCb cbCb)
Creates a new IDataDistributionCallback instance.
Class to convert C style dataDistributionUnderlyingEvent callback into IDataDistributionChannelCallba...
Definition DataDistributionManager.h:425
static IDataDistributionChannelCallback * create(void *opaque, dataDistributionUnderlyingEvent uEventCb)
Creates a new IDataDistributionChannelCallback instance.
Class to convert C style callbacks into IDataDistributionMastershipCallback C++ callback.
Definition DataDistributionManager.h:637
static IDataDistributionMastershipCallback * create(void *opaque, dataDistributionOnClusterStateChange c1, dataDistributionOnStateChange c2, dataDistributionOnStateReady c3, dataDistributionOnRequestedState c4, dataDistributionOnMultiplePrimary c5, dataDistributionFirstStateChange c6, dataDistributionChangingState c7, dataDistributionChangedState c8)
Creates a new IDataDistributionMastershipCallback instance.
Main entry point to activate an instance of IDataDistribution.
Definition DataDistributionManager.h:1117
static IDataDistribution * create()
Creates a new IDataDistribution instance.
The C++ callback interface to be externally implemented.
Definition DataDistributionManager.h:212
virtual void OnLogging(DDM_LOG_LEVEL level, const char *source, const char *function, const char *logStr)=0
Callback invoked when a log is emitted from subsystem.
virtual const char * OnConfiguration(const char *channelName, const char *key, const char *value)=0
Invoked during configuration validation.
virtual void OnCompletelyDisconnected(const char *channelName, const char *reason)=0
Callback invoked on a complete disconnection.
Base interface to be implemented from channel manager.
Definition DataDistributionManager.h:664
virtual OPERATION_RESULT Lock(CHANNEL_HANDLE_PARAMETER, unsigned long timeout)=0
Locks the channel.
virtual const char * GetParameter(CHANNEL_HANDLE_PARAMETER, const char *paramName)=0
Reads a parameter at run-time.
virtual OPERATION_RESULT DeleteChannel(CHANNEL_HANDLE_PARAMETER)=0
Deletes the channel.
virtual OPERATION_RESULT StopChannel(CHANNEL_HANDLE_PARAMETER, unsigned long timeout)=0
Stops the channel.
virtual OPERATION_RESULT SeekChannel(CHANNEL_HANDLE_PARAMETER, int64_t position, DDM_SEEKCONTEXT context=DDM_SEEKCONTEXT::OFFSET, DDM_SEEKKIND kind=DDM_SEEKKIND::ABSOLUTE)=0
Seeks the channel.
virtual OPERATION_RESULT WriteOnChannel(CHANNEL_HANDLE_PARAMETER, const char *key, size_t keyLen, void *buffer, size_t bufferLen, const BOOL waitAll=FALSE, const int64_t timestamp=DDM_NO_TIMESTAMP)=0
Writes data on the channel.
virtual OPERATION_RESULT ReadFromChannel(CHANNEL_HANDLE_PARAMETER, int64_t offset, size_t *bufferLen, void **buffer)=0
Reads data from the channel.
virtual OPERATION_RESULT ChangeChannelDirection(CHANNEL_HANDLE_PARAMETER, DDM_CHANNEL_DIRECTION direction)=0
Change the DDM_CHANNEL_DIRECTION of the channel.
virtual CHANNEL_HANDLE CreateChannel(const char *channelName, IDataDistributionChannelCallback *dataCb, DDM_CHANNEL_DIRECTION direction=DDM_CHANNEL_DIRECTION::ALL, const char *arrayParams[]=NULL, int len=0)=0
Creates a new channel.
virtual const char * GetParameter(CHANNEL_HANDLE_PARAMETER, DDM_GENERAL_PARAMETER paramId)=0
Reads a parameter at run-time.
virtual OPERATION_RESULT StartChannel(CHANNEL_HANDLE_PARAMETER, unsigned long timeout)=0
Starts the channel.
virtual void SetParameter(CHANNEL_HANDLE_PARAMETER, DDM_GENERAL_PARAMETER paramId, const char *paramValue)=0
Sets a parameter at run-time.
virtual void SetParameter(CHANNEL_HANDLE_PARAMETER, const char *paramName, const char *paramValue)=0
Sets a parameter at run-time.
virtual OPERATION_RESULT Unlock(CHANNEL_HANDLE_PARAMETER)=0
Unlock the channel.
The C++ callback interface to be externally implemented.
Definition DataDistributionManager.h:405
virtual void OnUnderlyingEvent(const CHANNEL_HANDLE_PARAMETER, const UnderlyingEventData *uEvent)=0
Callback invoked to report UnderlyingEventData.
The basic interface for all channel.
Definition DataDistributionManager.h:377
virtual const char * GetChannelName()=0
Returns the channel name.
virtual GENERIC_HANDLE GetOpaqueHandle()=0
Returns an opaque version of the channel handle.
Interface to reports logging.
Definition DataDistributionManager.h:177
virtual void Log(const DDM_LOG_LEVEL level, const char *sourceName, const char *function, const char *format, va_list args)=0
Reports log information.
virtual void Log(const DDM_LOG_LEVEL level, const char *sourceName, const char *function, const char *format,...)=0
Reports log information.
The C++ callback interface to be externally implemented.
Definition DataDistributionManager.h:550
virtual void OnStateChange(DDM_INSTANCE_STATE newState, DDM_INSTANCE_STATE oldState)=0
Callback invoked to report a state change.
virtual void OnClusterStateChange(DDM_CLUSTEREVENT change, int64_t serverid)=0
Callback invoked to report cluster state change.
virtual void ChangedState(DDM_INSTANCE_STATE actualState)=0
Callback invoked to report a finished instance state change.
virtual void OnStateReady(void *pState, int64_t len)=0
Callback invoked when a state transfer is completed.
virtual void FirstStateChange(DDM_INSTANCE_STATE newState)=0
Callback invoked to report a first state change.
virtual void OnMultiplePrimary(int64_t myId, int64_t otherId)=0
Callback invoked when multiple primary server are detected.
virtual void ChangingState(DDM_INSTANCE_STATE actualState, DDM_INSTANCE_STATE futureState)=0
Callback invoked to report a starting instance state change.
virtual void OnRequestedState(void **pState, size_t *len)=0
Callback invoked when a state transfer is requested.
Interface to be implemented from mastership subsystem.
Definition DataDistributionManager.h:895
virtual int64_t * GetClusterIndexes(size_t *length)=0
Returns an array of all known indexes of the servers within the cluster.
virtual int64_t GetMessageDelay()=0
Returns the message delay within the cluster.
virtual BOOL RequestIAmNextPrimary()=0
Request to be the next primary server.
virtual ClusterHealth GetClusterHealth()=0
Returns the health of the cluster.
virtual void ChangeMyState(DDM_INSTANCE_STATE state)=0
Change DDM_INSTANCE_STATE of this instance.
virtual OPERATION_RESULT Start(unsigned long timeout)=0
Start the mastership subsystem.
virtual int64_t GetPrimaryServerId()=0
Returns the server id of the primary instance.
virtual int64_t GetLocalServerId()=0
Returns the server id of the local instance.
virtual void ChangeState(int64_t instanceId, DDM_INSTANCE_STATE state)=0
Change DDM_INSTANCE_STATE of instanceId.
virtual OPERATION_RESULT Stop(unsigned long timeout)=0
Stop the mastership subsystem.
virtual BOOL GetIamNextPrimary()=0
Verify if this server will be elected as next primary.
virtual DDM_INSTANCE_STATE GetStateOf(int64_t serverId)=0
Returns the DDM_INSTANCE_STATE of a specific server.
virtual int64_t GetUpTime()=0
Returns the current uptime.
virtual OPERATION_RESULT Initialize(IDataDistributionSubsystem *transportManager, IDataDistributionMastershipCallback *cbs, const char *hostAddress=NULL, const char *arrayParams[]=NULL, int len=0)=0
Initialize the subsystem.
virtual void SetParameter(const char *paramName, const char *paramValue)=0
Sets a parameter at run-time.
virtual const char * GetParameter(const char *paramName)=0
Reads a parameter at run-time.
virtual DDM_INSTANCE_STATE GetMyState()=0
Returns DDM_INSTANCE_STATE of this instance.
Interface to be implemented from subsystem.
Definition DataDistributionManager.h:846
virtual OPERATION_RESULT Initialize(IDataDistributionCallback *cb, const char *arrayParams[], int len, const char *hostAddress=NULL, const char *channelTrailer=NULL)=0
Initialize the subsystem.
virtual IDataDistributionCallback * GetCallbacks()=0
Returns IDataDistributionCallback passed during IDataDistributionSubsystem::Initialize.
virtual OPERATION_RESULT Initialize(IDataDistributionCallback *cb, const char *conf_file, const char *hostAddress=NULL, const char *channelTrailer=NULL)=0
Initialize the subsystem.
Interface to be implemented from transport subsystem.
Definition DataDistributionManager.h:809
virtual int GetServerLostTimeout()=0
Returns the server lost timeout.
virtual OPERATION_RESULT Start(unsigned long timeout)=0
Start the transport subsystem.
virtual OPERATION_RESULT Stop(unsigned long timeout)=0
Start the transport subsystem.
virtual size_t GetMaxMessageSize()=0
Returns the max message size managed from the subsystem.
Interface to be implemented from common manager.
Definition DataDistributionManager.h:1027
virtual std::string GetProtocol()=0
Returns the protocol in use from IDataDistribution instance.
virtual std::string GetProtocolLib()=0
Returns the protocol library in use from IDataDistribution instance.
virtual OPERATION_RESULT Initialize(IDataDistributionCallback *iddcb, const char *conf_file=NULL, const char *hostAddress=NULL, const char *channelTrailer=NULL)=0
Initialize IDataDistribution instance.
virtual BOOL Start(unsigned long timeout)=0
Start the common manager.
virtual BOOL Stop(unsigned long timeout)=0
Stop the common manager.
virtual std::string GetMastershipLib()=0
Returns the mastership library in use from IDataDistribution instance.
virtual OPERATION_RESULT Initialize(IDataDistributionCallback *iddcb, const char *arrayParams[], int len, const char *hostAddress=NULL, const char *channelTrailer=NULL)=0
Initialize IDataDistribution instance.
virtual IDataDistributionMastershipCommon * GetMastershipManager()=0
Returns the allocated mastership subsystem.
virtual OPERATION_RESULT RequestMastershipManager(IDataDistributionMastershipCallback *cbs, const char *szMyAddress=NULL, const char *arrayParams[]=NULL, int len=0)=0
Allocate and initialize the mastership manager.
virtual IDataDistributionSubsystem * GetSubsystemManager()=0
Returns the allocated communication subsystem.
Interface to manage time information.
Definition DataDistributionManager.h:111
virtual int64_t ElapsedMilliseconds()=0
Reports the elapsed time in milliseconds.
virtual int64_t ElapsedMicroseconds()=0
Reports the elapsed time in microseconds.
virtual int64_t ElapsedNanoseconds()=0
Reports the elapsed time in nanoseconds.
virtual void ResetTime()=0
Reset the timer.
virtual void AddNanoseconds(unsigned int time)=0
Adds nanoseconds time to actual value.
Class to allocate an ITimeMeasureWrapper.
Definition DataDistributionManager.h:161
static ITimeMeasureWrapper * create()
Creates a new ITimeMeasureWrapper instance.
Contains information needed from the cluster management.
Definition DataDistributionManager.h:93
DDM_INSTANCE_STATE Status
Definition DataDistributionManager.h:95
int64_t ServerId
Definition DataDistributionManager.h:94
int64_t Uptime
Definition DataDistributionManager.h:96
int64_t LastContactTime
Definition DataDistributionManager.h:97
Class to reports information from transport subsystem.
Definition DataDistributionManager.h:274
const char * ChannelName
Definition DataDistributionManager.h:275
const char * Key
Definition DataDistributionManager.h:279
UnderlyingEventData(const char *channelName, const char *key, size_t keyLen, const void *buffer, size_t bufferLength, int64_t timestamp=-1, int64_t offset=-1)
Initialize a new UnderlyingEventData to reports data.
Definition DataDistributionManager.h:325
int64_t Offset
Definition DataDistributionManager.h:277
const char * SubSystemReason
Definition DataDistributionManager.h:285
int NativeCode
Definition DataDistributionManager.h:284
int64_t Timestamp
Definition DataDistributionManager.h:278
UnderlyingEventData(const char *channelName)
Initialize a new UnderlyingEventData.
Definition DataDistributionManager.h:296
const void * Buffer
Definition DataDistributionManager.h:281
OPERATION_RESULT Condition
Definition DataDistributionManager.h:283
UnderlyingEventData(const char *channelName, OPERATION_RESULT condition, int nativeCode, const char *subSystemReason)
Initialize a new UnderlyingEventData to reports errors or conditions.
Definition DataDistributionManager.h:348
size_t KeyLen
Definition DataDistributionManager.h:280
BOOL IsDataAvailable
Definition DataDistributionManager.h:276
size_t BufferLength
Definition DataDistributionManager.h:282