Renamed component: cibsync -> replication

This commit is contained in:
Gunnar Beutner 2012-09-14 10:52:57 +02:00
parent 5dc7802e89
commit 7e0fa1ce13
10 changed files with 53 additions and 53 deletions

View File

@ -3,8 +3,8 @@
SUBDIRS = \
checker \
cibsync \
compat \
convenience \
delegation \
demo
demo \
replication

View File

@ -1,28 +1,28 @@
## Process this file with automake to produce Makefile.in
pkglib_LTLIBRARIES = \
cibsync.la
replication.la
cibsync_la_SOURCES = \
cibsynccomponent.cpp \
cibsynccomponent.h \
i2-cibsync.h
replication_la_SOURCES = \
replicationcomponent.cpp \
replicationcomponent.h \
i2-replication.h
cibsync_la_CPPFLAGS = \
replication_la_CPPFLAGS = \
$(BOOST_CPPFLAGS) \
-I${top_srcdir}/lib/base \
-I${top_srcdir}/lib/config \
-I${top_srcdir}/lib/remoting \
-I${top_srcdir}/lib/icinga
cibsync_la_LDFLAGS = \
replication_la_LDFLAGS = \
$(BOOST_LDFLAGS) \
-module \
-no-undefined \
@RELEASE_INFO@ \
@VERSION_INFO@
cibsync_la_LIBADD = \
replication_la_LIBADD = \
$(BOOST_SIGNALS_LIB) \
$(BOOST_THREAD_LIB) \
${top_builddir}/lib/base/libbase.la \

View File

@ -17,19 +17,19 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
#ifndef I2CIBSYNC_H
#define I2CIBSYNC_H
#ifndef I2REPLICATION_H
#define I2REPLICATION_H
/**
* @defgroup cibsync CIB synchronisation component
* @defgroup replication Replication component
*
* Collects update messages to synchronize the local CIB.
* Replicates Icinga 2 objects to remote instances.
*/
#include <i2-base.h>
#include <i2-remoting.h>
#include <i2-icinga.h>
#include "cibsynccomponent.h"
#include "replicationcomponent.h"
#endif /* I2CIBSYNC_H */
#endif /* I2REPLICATION_H */

View File

@ -11,16 +11,16 @@
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="cibsynccomponent.h">
<ClInclude Include="replicationcomponent.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="i2-cibsync.h">
<ClInclude Include="i2-replication.h">
<Filter>Headerdateien</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="cibsynccomponent.cpp">
<ClCompile Include="replicationcomponent.cpp">
<Filter>Quelldateien</Filter>
</ClCompile>
</ItemGroup>
</Project>
</Project>

View File

@ -13,7 +13,7 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{704DDD8E-9E6D-4C22-80BD-6DE10F3A5E1C}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>cibsync</RootNamespace>
<RootNamespace>replication</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@ -78,13 +78,13 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="cibsynccomponent.h" />
<ClInclude Include="i2-cibsync.h" />
<ClInclude Include="replicationcomponent.h" />
<ClInclude Include="i2-replication.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="cibsynccomponent.cpp" />
<ClCompile Include="replicationcomponent.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -17,42 +17,42 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
#include "i2-cibsync.h"
#include "i2-replication.h"
using namespace icinga;
/**
* Starts the component.
*/
void CIBSyncComponent::Start(void)
void ReplicationComponent::Start(void)
{
m_Endpoint = Endpoint::MakeEndpoint("cibsync", true);
m_Endpoint = Endpoint::MakeEndpoint("replication", true);
DynamicObject::OnRegistered.connect(boost::bind(&CIBSyncComponent::LocalObjectRegisteredHandler, this, _1));
DynamicObject::OnUnregistered.connect(boost::bind(&CIBSyncComponent::LocalObjectUnregisteredHandler, this, _1));
DynamicObject::OnTransactionClosing.connect(boost::bind(&CIBSyncComponent::TransactionClosingHandler, this, _1));
DynamicObject::OnRegistered.connect(boost::bind(&ReplicationComponent::LocalObjectRegisteredHandler, this, _1));
DynamicObject::OnUnregistered.connect(boost::bind(&ReplicationComponent::LocalObjectUnregisteredHandler, this, _1));
DynamicObject::OnTransactionClosing.connect(boost::bind(&ReplicationComponent::TransactionClosingHandler, this, _1));
Endpoint::OnConnected.connect(boost::bind(&CIBSyncComponent::EndpointConnectedHandler, this, _1));
Endpoint::OnConnected.connect(boost::bind(&ReplicationComponent::EndpointConnectedHandler, this, _1));
m_Endpoint->RegisterTopicHandler("config::ObjectUpdate",
boost::bind(&CIBSyncComponent::RemoteObjectUpdateHandler, this, _2, _3));
boost::bind(&ReplicationComponent::RemoteObjectUpdateHandler, this, _2, _3));
m_Endpoint->RegisterTopicHandler("config::ObjectRemoved",
boost::bind(&CIBSyncComponent::RemoteObjectRemovedHandler, this, _3));
boost::bind(&ReplicationComponent::RemoteObjectRemovedHandler, this, _3));
/* service status */
m_Endpoint->RegisterTopicHandler("checker::ServiceStateChange",
boost::bind(&CIBSyncComponent::ServiceStateChangeRequestHandler, _2, _3));
boost::bind(&ReplicationComponent::ServiceStateChangeRequestHandler, _2, _3));
}
/**
* Stops the component.
*/
void CIBSyncComponent::Stop(void)
void ReplicationComponent::Stop(void)
{
m_Endpoint->Unregister();
}
void CIBSyncComponent::ServiceStateChangeRequestHandler(const Endpoint::Ptr& sender, const RequestMessage& request)
void ReplicationComponent::ServiceStateChangeRequestHandler(const Endpoint::Ptr& sender, const RequestMessage& request)
{
ServiceStateChangeMessage params;
if (!request.GetParams(&params))
@ -75,7 +75,7 @@ void CIBSyncComponent::ServiceStateChangeRequestHandler(const Endpoint::Ptr& sen
CIB::UpdateTaskStatistics(now, 1);
}
void CIBSyncComponent::EndpointConnectedHandler(const Endpoint::Ptr& endpoint)
void ReplicationComponent::EndpointConnectedHandler(const Endpoint::Ptr& endpoint)
{
/* no need to sync the config with local endpoints */
if (endpoint->IsLocalEndpoint())
@ -99,7 +99,7 @@ void CIBSyncComponent::EndpointConnectedHandler(const Endpoint::Ptr& endpoint)
}
}
RequestMessage CIBSyncComponent::MakeObjectMessage(const DynamicObject::Ptr& object, const String& method, double sinceTx, bool includeProperties)
RequestMessage ReplicationComponent::MakeObjectMessage(const DynamicObject::Ptr& object, const String& method, double sinceTx, bool includeProperties)
{
RequestMessage msg;
msg.SetMethod(method);
@ -116,12 +116,12 @@ RequestMessage CIBSyncComponent::MakeObjectMessage(const DynamicObject::Ptr& obj
return msg;
}
bool CIBSyncComponent::ShouldReplicateObject(const DynamicObject::Ptr& object)
bool ReplicationComponent::ShouldReplicateObject(const DynamicObject::Ptr& object)
{
return (!object->IsLocal());
}
void CIBSyncComponent::LocalObjectRegisteredHandler(const DynamicObject::Ptr& object)
void ReplicationComponent::LocalObjectRegisteredHandler(const DynamicObject::Ptr& object)
{
if (!ShouldReplicateObject(object))
return;
@ -130,7 +130,7 @@ void CIBSyncComponent::LocalObjectRegisteredHandler(const DynamicObject::Ptr& ob
MakeObjectMessage(object, "config::ObjectUpdate", 0, true));
}
void CIBSyncComponent::LocalObjectUnregisteredHandler(const DynamicObject::Ptr& object)
void ReplicationComponent::LocalObjectUnregisteredHandler(const DynamicObject::Ptr& object)
{
if (!ShouldReplicateObject(object))
return;
@ -139,14 +139,14 @@ void CIBSyncComponent::LocalObjectUnregisteredHandler(const DynamicObject::Ptr&
MakeObjectMessage(object, "config::ObjectRemoved", 0, false));
}
void CIBSyncComponent::TransactionClosingHandler(const set<DynamicObject::Ptr>& modifiedObjects)
void ReplicationComponent::TransactionClosingHandler(const set<DynamicObject::Ptr>& modifiedObjects)
{
if (modifiedObjects.empty())
return;
stringstream msgbuf;
msgbuf << "Sending " << modifiedObjects.size() << " replication updates.";
Logger::Write(LogDebug, "cibsync", msgbuf.str());
Logger::Write(LogDebug, "replication", msgbuf.str());
BOOST_FOREACH(const DynamicObject::Ptr& object, modifiedObjects) {
if (!ShouldReplicateObject(object))
@ -157,7 +157,7 @@ void CIBSyncComponent::TransactionClosingHandler(const set<DynamicObject::Ptr>&
}
}
void CIBSyncComponent::RemoteObjectUpdateHandler(const Endpoint::Ptr& sender, const RequestMessage& request)
void ReplicationComponent::RemoteObjectUpdateHandler(const Endpoint::Ptr& sender, const RequestMessage& request)
{
MessagePart params;
if (!request.GetParams(&params))
@ -206,7 +206,7 @@ void CIBSyncComponent::RemoteObjectUpdateHandler(const Endpoint::Ptr& sender, co
}
}
void CIBSyncComponent::RemoteObjectRemovedHandler(const RequestMessage& request)
void ReplicationComponent::RemoteObjectRemovedHandler(const RequestMessage& request)
{
MessagePart params;
if (!request.GetParams(&params))
@ -230,4 +230,4 @@ void CIBSyncComponent::RemoteObjectRemovedHandler(const RequestMessage& request)
}
}
EXPORT_COMPONENT(cibsync, CIBSyncComponent);
EXPORT_COMPONENT(replication, ReplicationComponent);

View File

@ -24,9 +24,9 @@ namespace icinga
{
/**
* @ingroup cibsync
* @ingroup replication
*/
class CIBSyncComponent : public IComponent
class ReplicationComponent : public IComponent
{
public:
virtual void Start(void);

View File

@ -69,11 +69,11 @@ AC_CONFIG_FILES([
Makefile
components/Makefile
components/checker/Makefile
components/cibsync/Makefile
components/compat/Makefile
components/convenience/Makefile
components/delegation/Makefile
components/demo/Makefile
components/replication/Makefile
docs/Doxyfile
icinga-app/Makefile
lib/Makefile

View File

@ -30,12 +30,12 @@ icinga_LDADD = \
${top_builddir}/lib/remoting/libremoting.la \
${top_builddir}/lib/icinga/libicinga.la \
-dlopen ${top_builddir}/components/checker/checker.la \
-dlopen ${top_builddir}/components/cibsync/cibsync.la \
-dlopen ${top_builddir}/components/replication/replication.la \
-dlopen ${top_builddir}/components/compat/compat.la \
-dlopen ${top_builddir}/components/convenience/convenience.la \
-dlopen ${top_builddir}/components/delegation/delegation.la \
-dlopen ${top_builddir}/components/demo/demo.la
icinga_DEPENDENCIES = \
${top_builddir}/components/cibsync/cibsync.la \
${top_builddir}/components/replication/replication.la \
${top_builddir}/components/convenience/convenience.la

View File

@ -31,7 +31,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "delegation", "components\de
{C1FC77E1-04A4-481B-A78B-2F7AF489C2F8} = {C1FC77E1-04A4-481B-A78B-2F7AF489C2F8}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cibsync", "components\cibsync\cibsync.vcxproj", "{704DDD8E-9E6D-4C22-80BD-6DE10F3A5E1C}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "replication", "components\replication\replication.vcxproj", "{704DDD8E-9E6D-4C22-80BD-6DE10F3A5E1C}"
ProjectSection(ProjectDependencies) = postProject
{C1FC77E1-04A4-481B-A78B-2F7AF489C2F8} = {C1FC77E1-04A4-481B-A78B-2F7AF489C2F8}
EndProjectSection