aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp
diff options
context:
space:
mode:
authorhor911 <hor911@yandex-team.ru>2022-02-10 16:50:44 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:44 +0300
commit9d76a2b677c8183292896b7d718af8cacbc6ba39 (patch)
tree74d39283ab3d7ee4ad00ec4b0930a0960357da0e /library/cpp
parentea46c401e7900b229add3e6074dbf89adc84ebfc (diff)
downloadydb-9d76a2b677c8183292896b7d718af8cacbc6ba39.tar.gz
Restoring authorship annotation for <hor911@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp')
-rw-r--r--library/cpp/actors/interconnect/interconnect.h50
-rw-r--r--library/cpp/actors/interconnect/interconnect_nameserver_base.h166
-rw-r--r--library/cpp/actors/interconnect/interconnect_nameserver_dynamic.cpp356
-rw-r--r--library/cpp/actors/interconnect/interconnect_nameserver_table.cpp18
-rw-r--r--library/cpp/actors/interconnect/ya.make2
5 files changed, 296 insertions, 296 deletions
diff --git a/library/cpp/actors/interconnect/interconnect.h b/library/cpp/actors/interconnect/interconnect.h
index 225a5243fd..6c3286b76a 100644
--- a/library/cpp/actors/interconnect/interconnect.h
+++ b/library/cpp/actors/interconnect/interconnect.h
@@ -125,28 +125,28 @@ namespace NActors {
TActorId GetNameserviceActorId();
- /**
- * Const table-lookup based name service
- */
-
+ /**
+ * Const table-lookup based name service
+ */
+
IActor* CreateNameserverTable(
const TIntrusivePtr<TTableNameserverSetup>& setup,
ui32 poolId = 0);
/**
- * Name service which can be paired with external discovery service.
- * Copies information from setup on the start (table may be empty).
- * Handles TEvNodesInfo to change list of known nodes.
- *
- * If PendingPeriod is not zero, wait for unknown nodeId
- */
-
- IActor* CreateDynamicNameserver(
- const TIntrusivePtr<TTableNameserverSetup>& setup,
- const TDuration& pendingPeriod = TDuration::Zero(),
- ui32 poolId = 0);
-
- /**
+ * Name service which can be paired with external discovery service.
+ * Copies information from setup on the start (table may be empty).
+ * Handles TEvNodesInfo to change list of known nodes.
+ *
+ * If PendingPeriod is not zero, wait for unknown nodeId
+ */
+
+ IActor* CreateDynamicNameserver(
+ const TIntrusivePtr<TTableNameserverSetup>& setup,
+ const TDuration& pendingPeriod = TDuration::Zero(),
+ ui32 poolId = 0);
+
+ /**
* Creates an actor that resolves host/port and replies with either:
*
* - TEvLocalNodeInfo on success
@@ -158,14 +158,14 @@ namespace NActors {
const TString& host, ui16 port, ui32 nodeId, const TString& defaultAddress,
const TActorId& replyTo, const TActorId& replyFrom, TInstant deadline);
- inline IActor* CreateResolveActor(
- ui32 nodeId, const TTableNameserverSetup::TNodeInfo& nodeInfo,
- const TActorId& replyTo, const TActorId& replyFrom, TInstant deadline)
- {
- return CreateResolveActor(nodeInfo.ResolveHost, nodeInfo.Port, nodeId, nodeInfo.Address,
- replyTo, replyFrom, deadline);
- }
-
+ inline IActor* CreateResolveActor(
+ ui32 nodeId, const TTableNameserverSetup::TNodeInfo& nodeInfo,
+ const TActorId& replyTo, const TActorId& replyFrom, TInstant deadline)
+ {
+ return CreateResolveActor(nodeInfo.ResolveHost, nodeInfo.Port, nodeId, nodeInfo.Address,
+ replyTo, replyFrom, deadline);
+ }
+
/**
* Creates an actor that resolves host/port and replies with either:
*
diff --git a/library/cpp/actors/interconnect/interconnect_nameserver_base.h b/library/cpp/actors/interconnect/interconnect_nameserver_base.h
index df614f6c2b..6d4f370443 100644
--- a/library/cpp/actors/interconnect/interconnect_nameserver_base.h
+++ b/library/cpp/actors/interconnect/interconnect_nameserver_base.h
@@ -1,83 +1,83 @@
-#include "interconnect.h"
-#include "interconnect_impl.h"
-#include "interconnect_address.h"
-#include "events_local.h"
-
-#include <library/cpp/actors/core/hfunc.h>
-#include <library/cpp/actors/memory_log/memlog.h>
-
-namespace NActors {
-
- template<typename TDerived>
- class TInterconnectNameserverBase : public TActor<TDerived> {
- protected:
- const TMap<ui32, TTableNameserverSetup::TNodeInfo>& NodeTable;
-
- TInterconnectNameserverBase(void (TDerived::*func)(TAutoPtr<IEventHandle>& ev, const TActorContext& ctx)
- , const TMap<ui32, TTableNameserverSetup::TNodeInfo>& nodeTable)
- : TActor<TDerived>(func)
- , NodeTable(nodeTable)
- {
- }
- public:
-
- void HandleMissedNodeId(TEvInterconnect::TEvResolveNode::TPtr& ev,
- const TActorContext& ctx,
- const TInstant&) {
- auto reply = new TEvLocalNodeInfo;
- reply->NodeId = ev->Get()->Record.GetNodeId();
- ctx.Send(ev->Sender, reply);
- }
-
- void Handle(TEvInterconnect::TEvResolveNode::TPtr& ev,
- const TActorContext& ctx) {
- const TEvInterconnect::TEvResolveNode* request = ev->Get();
- auto& record = request->Record;
- const ui32 nodeId = record.GetNodeId();
- const TInstant deadline = record.HasDeadline() ? TInstant::FromValue(record.GetDeadline()) : TInstant::Max();
- auto it = NodeTable.find(nodeId);
-
- if (it == NodeTable.end()) {
- static_cast<TDerived*>(this)->HandleMissedNodeId(ev, ctx, deadline);
- } else {
- IActor::RegisterWithSameMailbox(
- CreateResolveActor(nodeId, it->second, ev->Sender, this->SelfId(), deadline));
- }
- }
-
- void Handle(TEvResolveAddress::TPtr& ev,
- const TActorContext&) {
- const TEvResolveAddress* request = ev->Get();
-
- IActor::RegisterWithSameMailbox(
- CreateResolveActor(request->Address, request->Port, ev->Sender, this->SelfId(), TInstant::Max()));
- }
-
- void Handle(TEvInterconnect::TEvListNodes::TPtr& ev,
- const TActorContext& ctx) {
- THolder<TEvInterconnect::TEvNodesInfo>
- reply(new TEvInterconnect::TEvNodesInfo());
- reply->Nodes.reserve(NodeTable.size());
- for (const auto& pr : NodeTable) {
- reply->Nodes.emplace_back(pr.first,
- pr.second.Address, pr.second.Host, pr.second.ResolveHost,
- pr.second.Port, pr.second.Location);
- }
- ctx.Send(ev->Sender, reply.Release());
- }
-
- void Handle(TEvInterconnect::TEvGetNode::TPtr& ev,
- const TActorContext& ctx) {
- ui32 nodeId = ev->Get()->NodeId;
- THolder<TEvInterconnect::TEvNodeInfo>
- reply(new TEvInterconnect::TEvNodeInfo(nodeId));
- auto it = NodeTable.find(nodeId);
- if (it != NodeTable.end()) {
- reply->Node = MakeHolder<TEvInterconnect::TNodeInfo>(it->first, it->second.Address,
- it->second.Host, it->second.ResolveHost,
- it->second.Port, it->second.Location);
- }
- ctx.Send(ev->Sender, reply.Release());
- }
- };
-}
+#include "interconnect.h"
+#include "interconnect_impl.h"
+#include "interconnect_address.h"
+#include "events_local.h"
+
+#include <library/cpp/actors/core/hfunc.h>
+#include <library/cpp/actors/memory_log/memlog.h>
+
+namespace NActors {
+
+ template<typename TDerived>
+ class TInterconnectNameserverBase : public TActor<TDerived> {
+ protected:
+ const TMap<ui32, TTableNameserverSetup::TNodeInfo>& NodeTable;
+
+ TInterconnectNameserverBase(void (TDerived::*func)(TAutoPtr<IEventHandle>& ev, const TActorContext& ctx)
+ , const TMap<ui32, TTableNameserverSetup::TNodeInfo>& nodeTable)
+ : TActor<TDerived>(func)
+ , NodeTable(nodeTable)
+ {
+ }
+ public:
+
+ void HandleMissedNodeId(TEvInterconnect::TEvResolveNode::TPtr& ev,
+ const TActorContext& ctx,
+ const TInstant&) {
+ auto reply = new TEvLocalNodeInfo;
+ reply->NodeId = ev->Get()->Record.GetNodeId();
+ ctx.Send(ev->Sender, reply);
+ }
+
+ void Handle(TEvInterconnect::TEvResolveNode::TPtr& ev,
+ const TActorContext& ctx) {
+ const TEvInterconnect::TEvResolveNode* request = ev->Get();
+ auto& record = request->Record;
+ const ui32 nodeId = record.GetNodeId();
+ const TInstant deadline = record.HasDeadline() ? TInstant::FromValue(record.GetDeadline()) : TInstant::Max();
+ auto it = NodeTable.find(nodeId);
+
+ if (it == NodeTable.end()) {
+ static_cast<TDerived*>(this)->HandleMissedNodeId(ev, ctx, deadline);
+ } else {
+ IActor::RegisterWithSameMailbox(
+ CreateResolveActor(nodeId, it->second, ev->Sender, this->SelfId(), deadline));
+ }
+ }
+
+ void Handle(TEvResolveAddress::TPtr& ev,
+ const TActorContext&) {
+ const TEvResolveAddress* request = ev->Get();
+
+ IActor::RegisterWithSameMailbox(
+ CreateResolveActor(request->Address, request->Port, ev->Sender, this->SelfId(), TInstant::Max()));
+ }
+
+ void Handle(TEvInterconnect::TEvListNodes::TPtr& ev,
+ const TActorContext& ctx) {
+ THolder<TEvInterconnect::TEvNodesInfo>
+ reply(new TEvInterconnect::TEvNodesInfo());
+ reply->Nodes.reserve(NodeTable.size());
+ for (const auto& pr : NodeTable) {
+ reply->Nodes.emplace_back(pr.first,
+ pr.second.Address, pr.second.Host, pr.second.ResolveHost,
+ pr.second.Port, pr.second.Location);
+ }
+ ctx.Send(ev->Sender, reply.Release());
+ }
+
+ void Handle(TEvInterconnect::TEvGetNode::TPtr& ev,
+ const TActorContext& ctx) {
+ ui32 nodeId = ev->Get()->NodeId;
+ THolder<TEvInterconnect::TEvNodeInfo>
+ reply(new TEvInterconnect::TEvNodeInfo(nodeId));
+ auto it = NodeTable.find(nodeId);
+ if (it != NodeTable.end()) {
+ reply->Node = MakeHolder<TEvInterconnect::TNodeInfo>(it->first, it->second.Address,
+ it->second.Host, it->second.ResolveHost,
+ it->second.Port, it->second.Location);
+ }
+ ctx.Send(ev->Sender, reply.Release());
+ }
+ };
+}
diff --git a/library/cpp/actors/interconnect/interconnect_nameserver_dynamic.cpp b/library/cpp/actors/interconnect/interconnect_nameserver_dynamic.cpp
index 5e48401b14..0b09285123 100644
--- a/library/cpp/actors/interconnect/interconnect_nameserver_dynamic.cpp
+++ b/library/cpp/actors/interconnect/interconnect_nameserver_dynamic.cpp
@@ -1,178 +1,178 @@
-#include "interconnect.h"
-#include "interconnect_impl.h"
-#include "interconnect_address.h"
-#include "interconnect_nameserver_base.h"
-#include "events_local.h"
-#include "logging.h"
-
-#include <library/cpp/actors/core/hfunc.h>
-#include <library/cpp/actors/core/log.h>
-
-namespace NActors {
-
- class TInterconnectDynamicNameserver
- : public TInterconnectNameserverBase<TInterconnectDynamicNameserver>
- , public TInterconnectLoggingBase
- {
- struct TPendingRequest {
- TEvInterconnect::TEvResolveNode::TPtr Request;
- TInstant Deadline;
-
- TPendingRequest(TEvInterconnect::TEvResolveNode::TPtr request, const TInstant& deadline)
- : Request(request), Deadline(deadline)
- {
- }
- };
-
- TMap<ui32, TTableNameserverSetup::TNodeInfo> NodeTable;
- TVector<TPendingRequest> PendingRequests;
- TDuration PendingPeriod;
-
- void PrintInfo() {
- TString logMsg = TStringBuilder() << "Table size: " << NodeTable.size();
- for (const auto& [nodeId, node] : NodeTable) {
- TString str = TStringBuilder() << "\n > Node " << nodeId << " `" << node.Address << "`:" << node.Port << ", host: " << node.Host << ", resolveHost: " << node.ResolveHost;
- logMsg += str;
- }
- LOG_DEBUG_IC("ICN01", "%s", logMsg.c_str());
- }
-
- bool IsNodeUpdated(const ui32 nodeId, const TString& address, const ui32 port) {
- bool printInfo = false;
- auto it = NodeTable.find(nodeId);
- if (it == NodeTable.end()) {
- LOG_DEBUG_IC("ICN02", "New node %u `%s`: %u",
- nodeId, address.c_str(), port);
- printInfo = true;
- } else if (it->second.Address != address || it->second.Port != port) {
- LOG_DEBUG_IC("ICN03", "Updated node %u `%s`: %u (from `%s`: %u)",
- nodeId, address.c_str(), port, it->second.Address.c_str(), it->second.Port);
- printInfo = true;
- Send(TActivationContext::InterconnectProxy(nodeId), new TEvInterconnect::TEvDisconnect);
- }
- return printInfo;
- }
-
- void DiscardTimedOutRequests(const TActorContext& ctx, ui32 compactionCount = 0) {
-
- auto now = Now();
-
- for (auto& pending : PendingRequests) {
- if (pending.Deadline > now) {
- LOG_ERROR_IC("ICN06", "Unknown nodeId: %u", pending.Request->Get()->Record.GetNodeId());
- auto reply = new TEvLocalNodeInfo;
- reply->NodeId = pending.Request->Get()->Record.GetNodeId();
- ctx.Send(pending.Request->Sender, reply);
- pending.Request.Reset();
- compactionCount++;
- }
- }
-
- if (compactionCount) {
- TVector<TPendingRequest> requests;
- if (compactionCount < PendingRequests.size()) { // sanity check
- requests.reserve(PendingRequests.size() - compactionCount);
- }
- for (auto& pending : PendingRequests) {
- if (pending.Request) {
- requests.emplace_back(pending.Request, pending.Deadline);
- }
- }
- PendingRequests.swap(requests);
- }
- }
-
- void SchedulePeriodic() {
- Schedule(TDuration::MilliSeconds(200), new TEvents::TEvWakeup());
- }
-
- public:
- static constexpr EActivityType ActorActivityType() {
- return NAMESERVICE;
- }
-
- TInterconnectDynamicNameserver(const TIntrusivePtr<TTableNameserverSetup>& setup, const TDuration& pendingPeriod, ui32 /*resolvePoolId*/ )
- : TInterconnectNameserverBase<TInterconnectDynamicNameserver>(&TInterconnectDynamicNameserver::StateFunc, NodeTable)
- , NodeTable(setup->StaticNodeTable)
- , PendingPeriod(pendingPeriod)
- {
- Y_VERIFY(setup->IsEntriesUnique());
- }
-
- STFUNC(StateFunc) {
- try {
- switch (ev->GetTypeRewrite()) {
- HFunc(TEvInterconnect::TEvResolveNode, Handle);
- HFunc(TEvResolveAddress, Handle);
- HFunc(TEvInterconnect::TEvListNodes, Handle);
- HFunc(TEvInterconnect::TEvGetNode, Handle);
- HFunc(TEvInterconnect::TEvNodesInfo, HandleUpdate);
- CFunc(TEvents::TEvWakeup::EventType, HandlePeriodic);
- }
- } catch (...) {
- LOG_ERROR_IC("ICN09", "%s", CurrentExceptionMessage().c_str());
- }
- }
-
- void HandleMissedNodeId(TEvInterconnect::TEvResolveNode::TPtr& ev,
- const TActorContext& ctx,
- const TInstant& deadline) {
- if (PendingPeriod) {
- if (PendingRequests.size() == 0) {
- SchedulePeriodic();
- }
- PendingRequests.emplace_back(std::move(ev), Min(deadline, Now() + PendingPeriod));
- } else {
- LOG_ERROR_IC("ICN07", "Unknown nodeId: %u", ev->Get()->Record.GetNodeId());
- TInterconnectNameserverBase::HandleMissedNodeId(ev, ctx, deadline);
- }
- }
-
- void HandleUpdate(TEvInterconnect::TEvNodesInfo::TPtr& ev,
- const TActorContext& ctx) {
-
- auto request = ev->Get();
- LOG_DEBUG_IC("ICN04", "Update TEvNodesInfo with sz: %lu ", request->Nodes.size());
-
- bool printInfo = false;
- ui32 compactionCount = 0;
-
- for (const auto& node : request->Nodes) {
- printInfo |= IsNodeUpdated(node.NodeId, node.Address, node.Port);
-
- NodeTable[node.NodeId] = TTableNameserverSetup::TNodeInfo(
- node.Address, node.Host, node.ResolveHost, node.Port, node.Location);
-
- for (auto& pending : PendingRequests) {
- if (pending.Request->Get()->Record.GetNodeId() == node.NodeId) {
- LOG_DEBUG_IC("ICN05", "Pending nodeId: %u discovered", node.NodeId);
- RegisterWithSameMailbox(
- CreateResolveActor(node.NodeId, NodeTable[node.NodeId], pending.Request->Sender, SelfId(), pending.Deadline));
- pending.Request.Reset();
- compactionCount++;
- }
- }
- }
-
- if (printInfo) {
- PrintInfo();
- }
-
- DiscardTimedOutRequests(ctx, compactionCount);
- }
-
- void HandlePeriodic(const TActorContext& ctx) {
- DiscardTimedOutRequests(ctx, 0);
- if (PendingRequests.size()) {
- SchedulePeriodic();
- }
- }
- };
-
- IActor* CreateDynamicNameserver(const TIntrusivePtr<TTableNameserverSetup>& setup,
- const TDuration& pendingPeriod,
- ui32 poolId) {
- return new TInterconnectDynamicNameserver(setup, pendingPeriod, poolId);
- }
-
-}
+#include "interconnect.h"
+#include "interconnect_impl.h"
+#include "interconnect_address.h"
+#include "interconnect_nameserver_base.h"
+#include "events_local.h"
+#include "logging.h"
+
+#include <library/cpp/actors/core/hfunc.h>
+#include <library/cpp/actors/core/log.h>
+
+namespace NActors {
+
+ class TInterconnectDynamicNameserver
+ : public TInterconnectNameserverBase<TInterconnectDynamicNameserver>
+ , public TInterconnectLoggingBase
+ {
+ struct TPendingRequest {
+ TEvInterconnect::TEvResolveNode::TPtr Request;
+ TInstant Deadline;
+
+ TPendingRequest(TEvInterconnect::TEvResolveNode::TPtr request, const TInstant& deadline)
+ : Request(request), Deadline(deadline)
+ {
+ }
+ };
+
+ TMap<ui32, TTableNameserverSetup::TNodeInfo> NodeTable;
+ TVector<TPendingRequest> PendingRequests;
+ TDuration PendingPeriod;
+
+ void PrintInfo() {
+ TString logMsg = TStringBuilder() << "Table size: " << NodeTable.size();
+ for (const auto& [nodeId, node] : NodeTable) {
+ TString str = TStringBuilder() << "\n > Node " << nodeId << " `" << node.Address << "`:" << node.Port << ", host: " << node.Host << ", resolveHost: " << node.ResolveHost;
+ logMsg += str;
+ }
+ LOG_DEBUG_IC("ICN01", "%s", logMsg.c_str());
+ }
+
+ bool IsNodeUpdated(const ui32 nodeId, const TString& address, const ui32 port) {
+ bool printInfo = false;
+ auto it = NodeTable.find(nodeId);
+ if (it == NodeTable.end()) {
+ LOG_DEBUG_IC("ICN02", "New node %u `%s`: %u",
+ nodeId, address.c_str(), port);
+ printInfo = true;
+ } else if (it->second.Address != address || it->second.Port != port) {
+ LOG_DEBUG_IC("ICN03", "Updated node %u `%s`: %u (from `%s`: %u)",
+ nodeId, address.c_str(), port, it->second.Address.c_str(), it->second.Port);
+ printInfo = true;
+ Send(TActivationContext::InterconnectProxy(nodeId), new TEvInterconnect::TEvDisconnect);
+ }
+ return printInfo;
+ }
+
+ void DiscardTimedOutRequests(const TActorContext& ctx, ui32 compactionCount = 0) {
+
+ auto now = Now();
+
+ for (auto& pending : PendingRequests) {
+ if (pending.Deadline > now) {
+ LOG_ERROR_IC("ICN06", "Unknown nodeId: %u", pending.Request->Get()->Record.GetNodeId());
+ auto reply = new TEvLocalNodeInfo;
+ reply->NodeId = pending.Request->Get()->Record.GetNodeId();
+ ctx.Send(pending.Request->Sender, reply);
+ pending.Request.Reset();
+ compactionCount++;
+ }
+ }
+
+ if (compactionCount) {
+ TVector<TPendingRequest> requests;
+ if (compactionCount < PendingRequests.size()) { // sanity check
+ requests.reserve(PendingRequests.size() - compactionCount);
+ }
+ for (auto& pending : PendingRequests) {
+ if (pending.Request) {
+ requests.emplace_back(pending.Request, pending.Deadline);
+ }
+ }
+ PendingRequests.swap(requests);
+ }
+ }
+
+ void SchedulePeriodic() {
+ Schedule(TDuration::MilliSeconds(200), new TEvents::TEvWakeup());
+ }
+
+ public:
+ static constexpr EActivityType ActorActivityType() {
+ return NAMESERVICE;
+ }
+
+ TInterconnectDynamicNameserver(const TIntrusivePtr<TTableNameserverSetup>& setup, const TDuration& pendingPeriod, ui32 /*resolvePoolId*/ )
+ : TInterconnectNameserverBase<TInterconnectDynamicNameserver>(&TInterconnectDynamicNameserver::StateFunc, NodeTable)
+ , NodeTable(setup->StaticNodeTable)
+ , PendingPeriod(pendingPeriod)
+ {
+ Y_VERIFY(setup->IsEntriesUnique());
+ }
+
+ STFUNC(StateFunc) {
+ try {
+ switch (ev->GetTypeRewrite()) {
+ HFunc(TEvInterconnect::TEvResolveNode, Handle);
+ HFunc(TEvResolveAddress, Handle);
+ HFunc(TEvInterconnect::TEvListNodes, Handle);
+ HFunc(TEvInterconnect::TEvGetNode, Handle);
+ HFunc(TEvInterconnect::TEvNodesInfo, HandleUpdate);
+ CFunc(TEvents::TEvWakeup::EventType, HandlePeriodic);
+ }
+ } catch (...) {
+ LOG_ERROR_IC("ICN09", "%s", CurrentExceptionMessage().c_str());
+ }
+ }
+
+ void HandleMissedNodeId(TEvInterconnect::TEvResolveNode::TPtr& ev,
+ const TActorContext& ctx,
+ const TInstant& deadline) {
+ if (PendingPeriod) {
+ if (PendingRequests.size() == 0) {
+ SchedulePeriodic();
+ }
+ PendingRequests.emplace_back(std::move(ev), Min(deadline, Now() + PendingPeriod));
+ } else {
+ LOG_ERROR_IC("ICN07", "Unknown nodeId: %u", ev->Get()->Record.GetNodeId());
+ TInterconnectNameserverBase::HandleMissedNodeId(ev, ctx, deadline);
+ }
+ }
+
+ void HandleUpdate(TEvInterconnect::TEvNodesInfo::TPtr& ev,
+ const TActorContext& ctx) {
+
+ auto request = ev->Get();
+ LOG_DEBUG_IC("ICN04", "Update TEvNodesInfo with sz: %lu ", request->Nodes.size());
+
+ bool printInfo = false;
+ ui32 compactionCount = 0;
+
+ for (const auto& node : request->Nodes) {
+ printInfo |= IsNodeUpdated(node.NodeId, node.Address, node.Port);
+
+ NodeTable[node.NodeId] = TTableNameserverSetup::TNodeInfo(
+ node.Address, node.Host, node.ResolveHost, node.Port, node.Location);
+
+ for (auto& pending : PendingRequests) {
+ if (pending.Request->Get()->Record.GetNodeId() == node.NodeId) {
+ LOG_DEBUG_IC("ICN05", "Pending nodeId: %u discovered", node.NodeId);
+ RegisterWithSameMailbox(
+ CreateResolveActor(node.NodeId, NodeTable[node.NodeId], pending.Request->Sender, SelfId(), pending.Deadline));
+ pending.Request.Reset();
+ compactionCount++;
+ }
+ }
+ }
+
+ if (printInfo) {
+ PrintInfo();
+ }
+
+ DiscardTimedOutRequests(ctx, compactionCount);
+ }
+
+ void HandlePeriodic(const TActorContext& ctx) {
+ DiscardTimedOutRequests(ctx, 0);
+ if (PendingRequests.size()) {
+ SchedulePeriodic();
+ }
+ }
+ };
+
+ IActor* CreateDynamicNameserver(const TIntrusivePtr<TTableNameserverSetup>& setup,
+ const TDuration& pendingPeriod,
+ ui32 poolId) {
+ return new TInterconnectDynamicNameserver(setup, pendingPeriod, poolId);
+ }
+
+}
diff --git a/library/cpp/actors/interconnect/interconnect_nameserver_table.cpp b/library/cpp/actors/interconnect/interconnect_nameserver_table.cpp
index 43419bf70d..b8eade113f 100644
--- a/library/cpp/actors/interconnect/interconnect_nameserver_table.cpp
+++ b/library/cpp/actors/interconnect/interconnect_nameserver_table.cpp
@@ -1,15 +1,15 @@
#include "interconnect.h"
#include "interconnect_impl.h"
#include "interconnect_address.h"
-#include "interconnect_nameserver_base.h"
+#include "interconnect_nameserver_base.h"
#include "events_local.h"
#include <library/cpp/actors/core/hfunc.h>
#include <library/cpp/actors/memory_log/memlog.h>
namespace NActors {
-
- class TInterconnectNameserverTable: public TInterconnectNameserverBase<TInterconnectNameserverTable> {
+
+ class TInterconnectNameserverTable: public TInterconnectNameserverBase<TInterconnectNameserverTable> {
TIntrusivePtr<TTableNameserverSetup> Config;
public:
@@ -18,7 +18,7 @@ namespace NActors {
}
TInterconnectNameserverTable(const TIntrusivePtr<TTableNameserverSetup>& setup, ui32 /*resolvePoolId*/)
- : TInterconnectNameserverBase<TInterconnectNameserverTable>(&TInterconnectNameserverTable::StateFunc, setup->StaticNodeTable)
+ : TInterconnectNameserverBase<TInterconnectNameserverTable>(&TInterconnectNameserverTable::StateFunc, setup->StaticNodeTable)
, Config(setup)
{
Y_VERIFY(Config->IsEntriesUnique());
@@ -26,11 +26,11 @@ namespace NActors {
STFUNC(StateFunc) {
try {
- switch (ev->GetTypeRewrite()) {
- HFunc(TEvInterconnect::TEvResolveNode, Handle);
- HFunc(TEvResolveAddress, Handle);
- HFunc(TEvInterconnect::TEvListNodes, Handle);
- HFunc(TEvInterconnect::TEvGetNode, Handle);
+ switch (ev->GetTypeRewrite()) {
+ HFunc(TEvInterconnect::TEvResolveNode, Handle);
+ HFunc(TEvResolveAddress, Handle);
+ HFunc(TEvInterconnect::TEvListNodes, Handle);
+ HFunc(TEvInterconnect::TEvGetNode, Handle);
}
} catch (...) {
// on error - do nothing
diff --git a/library/cpp/actors/interconnect/ya.make b/library/cpp/actors/interconnect/ya.make
index 60d29b0fc0..f2b16af4b9 100644
--- a/library/cpp/actors/interconnect/ya.make
+++ b/library/cpp/actors/interconnect/ya.make
@@ -29,7 +29,7 @@ SRCS(
interconnect_impl.h
interconnect_mon.cpp
interconnect_mon.h
- interconnect_nameserver_dynamic.cpp
+ interconnect_nameserver_dynamic.cpp
interconnect_nameserver_table.cpp
interconnect_proxy_wrapper.cpp
interconnect_proxy_wrapper.h