当前位置: 首页>>代码示例>>C++>>正文


C++ endpoint::Ptr类代码示例

本文整理汇总了C++中endpoint::Ptr的典型用法代码示例。如果您正苦于以下问题:C++ Ptr类的具体用法?C++ Ptr怎么用?C++ Ptr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Ptr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SyncClient

void ApiListener::SyncClient(const JsonRpcConnection::Ptr& aclient, const Endpoint::Ptr& endpoint)
{
	try {
		{
			ObjectLock olock(endpoint);

			endpoint->SetSyncing(true);
		}

		Log(LogInformation, "ApiListener")
		    << "Sending updates for endpoint '" << endpoint->GetName() << "'.";

		/* sync zone file config */
		SendConfigUpdate(aclient);
		/* sync runtime config */
		SendRuntimeConfigObjects(aclient);

		Log(LogInformation, "ApiListener")
		    << "Finished sending updates for endpoint '" << endpoint->GetName() << "'.";

		ReplayLog(aclient);
	} catch (const std::exception& ex) {
		Log(LogCritical, "ApiListener")
		    << "Error while syncing endpoint '" << endpoint->GetName() << "': " << DiagnosticInformation(ex);
	}
}
开发者ID:Thomas-Gelf,项目名称:icinga2,代码行数:26,代码来源:apilistener.cpp

示例2: Dictionary

	BOOST_FOREACH(const Endpoint::Ptr& endpoint, ConfigType::GetObjectsByType<Endpoint>()) {
		if (!endpoint->GetConnected())
			continue;

		double ts = endpoint->GetRemoteLogPosition();

		if (ts == 0)
			continue;

		Dictionary::Ptr lparams = new Dictionary();
		lparams->Set("log_position", ts);

		Dictionary::Ptr lmessage = new Dictionary();
		lmessage->Set("jsonrpc", "2.0");
		lmessage->Set("method", "log::SetLogPosition");
		lmessage->Set("params", lparams);

		double maxTs = 0;

		BOOST_FOREACH(const JsonRpcConnection::Ptr& client, endpoint->GetClients()) {
			if (client->GetTimestamp() > maxTs)
				maxTs = client->GetTimestamp();
		}

		BOOST_FOREACH(const JsonRpcConnection::Ptr& client, endpoint->GetClients()) {
			if (client->GetTimestamp() != maxTs)
				client->Disconnect();
			else
				client->SendMessage(lmessage);
		}

		Log(LogNotice, "ApiListener")
		    << "Setting log position for identity '" << endpoint->GetName() << "': "
		    << Utility::FormatDateTime("%Y/%m/%d %H:%M:%S", ts);
	}
开发者ID:ajoaugustine,项目名称:icinga2-cipher_list,代码行数:35,代码来源:apilistener.cpp

示例3: OnAllConfigLoaded

void Zone::OnAllConfigLoaded()
{
	ObjectImpl<Zone>::OnAllConfigLoaded();

	m_Parent = Zone::GetByName(GetParentRaw());

	if (m_Parent && m_Parent->IsGlobal())
		BOOST_THROW_EXCEPTION(ScriptError("Zone '" + GetName() + "' can not have a global zone as parent.", GetDebugInfo()));

	Zone::Ptr zone = m_Parent;
	int levels = 0;

	Array::Ptr endpoints = GetEndpointsRaw();

	if (endpoints) {
		ObjectLock olock(endpoints);
		for (const String& endpoint : endpoints) {
			Endpoint::Ptr ep = Endpoint::GetByName(endpoint);

			if (ep)
				ep->SetCachedZone(this);
		}
	}

	while (zone) {
		m_AllParents.push_back(zone);

		zone = Zone::GetByName(zone->GetParentRaw());
		levels++;

		if (levels > 32)
			BOOST_THROW_EXCEPTION(ScriptError("Infinite recursion detected while resolving zone graph. Check your zone hierarchy.", GetDebugInfo()));
	}
}
开发者ID:bebehei,项目名称:icinga2,代码行数:34,代码来源:zone.cpp

示例4: IdentityAccessor

Value EndpointsTable::IdentityAccessor(const Value& row)
{
	Endpoint::Ptr endpoint = static_cast<Endpoint::Ptr>(row);

	if (!endpoint)
		return Empty;

	return endpoint->GetName();
}
开发者ID:andrewmeyer,项目名称:icinga2,代码行数:9,代码来源:endpointstable.cpp

示例5: IsMaster

bool ApiListener::IsMaster(void) const
{
	Endpoint::Ptr master = GetMaster();

	if (!master)
		return false;

	return master->GetName() == GetIdentity();
}
开发者ID:jsabari,项目名称:icinga2,代码行数:9,代码来源:apilistener.cpp

示例6: GetLocalZone

Zone::Ptr Zone::GetLocalZone()
{
	Endpoint::Ptr local = Endpoint::GetLocalEndpoint();

	if (!local)
		return nullptr;

	return local->GetZone();
}
开发者ID:bebehei,项目名称:icinga2,代码行数:9,代码来源:zone.cpp

示例7: GetLocalZone

Zone::Ptr Zone::GetLocalZone(void)
{
	Endpoint::Ptr local = Endpoint::GetLocalEndpoint();

	if (!local)
		return Zone::Ptr();

	return local->GetZone();
}
开发者ID:LMNetworks,项目名称:icinga2,代码行数:9,代码来源:zone.cpp

示例8: EndpointIsConnected

int EndpointDbObject::EndpointIsConnected(const Endpoint::Ptr& endpoint)
{
    unsigned int is_connected = endpoint->IsConnected() ? 1 : 0;

    /* if identity is equal to node, fake is_connected */
    if (endpoint->GetName() == IcingaApplication::GetInstance()->GetNodeName())
        is_connected = 1;

    return is_connected;
}
开发者ID:hudayou,项目名称:icinga2,代码行数:10,代码来源:endpointdbobject.cpp

示例9: CalculateZoneLag

double ApiListener::CalculateZoneLag(const Endpoint::Ptr& endpoint)
{
	double remoteLogPosition = endpoint->GetRemoteLogPosition();
	double eplag = Utility::GetTime() - remoteLogPosition;

	if ((endpoint->GetSyncing() || !endpoint->GetConnected()) && remoteLogPosition != 0)
		return eplag;

	return 0;
}
开发者ID:spjmurray,项目名称:icinga2,代码行数:10,代码来源:apilistener.cpp

示例10: GetConfigFields

Dictionary::Ptr EndpointDbObject::GetConfigFields(void) const
{
    Dictionary::Ptr fields = new Dictionary();
    Endpoint::Ptr endpoint = static_pointer_cast<Endpoint>(GetObject());

    fields->Set("identity", endpoint->GetName());
    fields->Set("node", IcingaApplication::GetInstance()->GetNodeName());

    return fields;
}
开发者ID:hudayou,项目名称:icinga2,代码行数:10,代码来源:endpointdbobject.cpp

示例11: GetStatusFields

Dictionary::Ptr EndpointDbObject::GetStatusFields(void) const
{
	Dictionary::Ptr fields = make_shared<Dictionary>();
	Endpoint::Ptr endpoint = static_pointer_cast<Endpoint>(GetObject());

	Log(LogDebug, "EndpointDbObject", "update status for endpoint '" + endpoint->GetName() + "'");

	fields->Set("identity", endpoint->GetName());
	fields->Set("node", IcingaApplication::GetInstance()->GetNodeName());
	fields->Set("is_connected", EndpointIsConnected(endpoint));

	return fields;
}
开发者ID:3v,项目名称:icinga2,代码行数:13,代码来源:endpointdbobject.cpp

示例12: ZoneAccessor

Value EndpointsTable::ZoneAccessor(const Value& row)
{
	Endpoint::Ptr endpoint = static_cast<Endpoint::Ptr>(row);

	if (!endpoint)
		return Empty;

	Zone::Ptr zone = endpoint->GetZone();

	if (!zone)
		return Empty;

	return zone->GetName();
}
开发者ID:zijam,项目名称:icinga2,代码行数:14,代码来源:endpointstable.cpp

示例13: GetMetric

int ClusterLink::GetMetric(void) const
{
	int metric = 0;

	Endpoint::Ptr fromEp = Endpoint::GetByName(From);
	if (fromEp)
		metric += fromEp->GetMetric();

	Endpoint::Ptr toEp = Endpoint::GetByName(To);
	if (toEp)
		metric += toEp->GetMetric();

	return metric;
}
开发者ID:nv1r,项目名称:icinga2,代码行数:14,代码来源:clusterlink.cpp

示例14: IsConnectedAccessor

Value EndpointsTable::IsConnectedAccessor(const Value& row)
{
	Endpoint::Ptr endpoint = static_cast<Endpoint::Ptr>(row);

	if (!endpoint)
		return Empty;

	unsigned int is_connected = endpoint->IsConnected() ? 1 : 0;

	/* if identity is equal to node, fake is_connected */
	if (endpoint->GetName() == IcingaApplication::GetInstance()->GetNodeName())
		is_connected = 1;

	return is_connected;
}
开发者ID:andrewmeyer,项目名称:icinga2,代码行数:15,代码来源:endpointstable.cpp

示例15: SetLogPositionHandler

Value SetLogPositionHandler(const MessageOrigin& origin, const Dictionary::Ptr& params)
{
	if (!params)
		return Empty;

	double log_position = params->Get("log_position");
	Endpoint::Ptr endpoint = origin.FromClient->GetEndpoint();

	if (!endpoint)
		return Empty;

	if (log_position > endpoint->GetLocalLogPosition())
		endpoint->SetLocalLogPosition(log_position);

	return Empty;
}
开发者ID:Freeaqingme,项目名称:icinga2,代码行数:16,代码来源:apiclient.cpp


注:本文中的endpoint::Ptr类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。