aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/actors
diff options
context:
space:
mode:
authorAndrey Fomichev <andrey.fomichev@gmail.com>2022-02-10 16:49:12 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:12 +0300
commite542cc14db4240643a06bb0dde87ecf361f101ab (patch)
tree3b03a4b94acd11a4eca042532035806e5fa08ad1 /library/cpp/actors
parente2ac73225f30f7fcf7df3cb225cba257f56144c1 (diff)
downloadydb-e542cc14db4240643a06bb0dde87ecf361f101ab.tar.gz
Restoring authorship annotation for Andrey Fomichev <andrey.fomichev@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/actors')
-rw-r--r--library/cpp/actors/core/actor.h2
-rw-r--r--library/cpp/actors/core/actorsystem.cpp4
-rw-r--r--library/cpp/actors/core/actorsystem.h8
-rw-r--r--library/cpp/actors/core/defs.h2
-rw-r--r--library/cpp/actors/core/event_pb.h6
-rw-r--r--library/cpp/actors/core/events.h8
-rw-r--r--library/cpp/actors/core/executor_pool_basic.cpp2
-rw-r--r--library/cpp/actors/core/hfunc.h4
-rw-r--r--library/cpp/actors/core/log.cpp106
-rw-r--r--library/cpp/actors/core/log.h282
-rw-r--r--library/cpp/actors/core/log_iface.h18
-rw-r--r--library/cpp/actors/core/log_settings.cpp126
-rw-r--r--library/cpp/actors/core/log_settings.h88
-rw-r--r--library/cpp/actors/core/mon.h90
-rw-r--r--library/cpp/actors/core/process_stats.cpp6
-rw-r--r--library/cpp/actors/core/ya.make10
-rw-r--r--library/cpp/actors/dnscachelib/dnscache.h2
-rw-r--r--library/cpp/actors/helpers/activeactors.cpp4
-rw-r--r--library/cpp/actors/helpers/activeactors.h64
-rw-r--r--library/cpp/actors/helpers/ya.make4
-rw-r--r--library/cpp/actors/interconnect/interconnect_stream.h2
-rw-r--r--library/cpp/actors/util/affinity.h2
-rw-r--r--library/cpp/actors/util/ya.make8
-rw-r--r--library/cpp/actors/wilson/wilson_event.h6
-rw-r--r--library/cpp/actors/ya.make2
25 files changed, 428 insertions, 428 deletions
diff --git a/library/cpp/actors/core/actor.h b/library/cpp/actors/core/actor.h
index ed29bd14b9..2c881921a2 100644
--- a/library/cpp/actors/core/actor.h
+++ b/library/cpp/actors/core/actor.h
@@ -19,7 +19,7 @@ namespace NActors {
}
struct TActorContext;
-
+
struct TActivationContext {
public:
TMailboxHeader& Mailbox;
diff --git a/library/cpp/actors/core/actorsystem.cpp b/library/cpp/actors/core/actorsystem.cpp
index c58698a206..d927aedc3a 100644
--- a/library/cpp/actors/core/actorsystem.cpp
+++ b/library/cpp/actors/core/actorsystem.cpp
@@ -8,7 +8,7 @@
#include "servicemap.h"
#include "scheduler_queue.h"
#include "scheduler_actor.h"
-#include "log.h"
+#include "log.h"
#include "probes.h"
#include "ask.h"
#include <library/cpp/actors/util/affinity.h>
@@ -121,7 +121,7 @@ namespace NActors {
void TActorSystem::Schedule(TInstant deadline, TAutoPtr<IEventHandle> ev, ISchedulerCookie* cookie) const {
Schedule(deadline - Timestamp(), ev, cookie);
}
-
+
void TActorSystem::Schedule(TMonotonic deadline, TAutoPtr<IEventHandle> ev, ISchedulerCookie* cookie) const {
const auto current = Monotonic();
if (deadline < current)
diff --git a/library/cpp/actors/core/actorsystem.h b/library/cpp/actors/core/actorsystem.h
index 40499d7586..47373078df 100644
--- a/library/cpp/actors/core/actorsystem.h
+++ b/library/cpp/actors/core/actorsystem.h
@@ -6,7 +6,7 @@
#include "balancer.h"
#include "config.h"
#include "event.h"
-#include "log_settings.h"
+#include "log_settings.h"
#include "scheduler_cookie.h"
#include "mon_stats.h"
@@ -233,7 +233,7 @@ namespace NActors {
mutable TTicketLock ScheduleLock;
friend class TExecutorThread;
-
+
THolder<TActorSystemSetup> SystemSetup;
TActorId DefSelfID;
void* AppData0;
@@ -331,7 +331,7 @@ namespace NActors {
TActorId LookupLocalService(const TActorId& x) const;
TActorId RegisterLocalService(const TActorId& serviceId, const TActorId& actorId);
-
+
ui32 GetMaxActivityType() const {
return SystemSetup ? SystemSetup->MaxActivityType : 1;
}
@@ -339,7 +339,7 @@ namespace NActors {
TInstant Timestamp() const {
return TInstant::MicroSeconds(RelaxedLoad(&CurrentTimestamp));
}
-
+
TMonotonic Monotonic() const {
return TMonotonic::MicroSeconds(RelaxedLoad(&CurrentMonotonic));
}
diff --git a/library/cpp/actors/core/defs.h b/library/cpp/actors/core/defs.h
index 980b7d767b..914b24212e 100644
--- a/library/cpp/actors/core/defs.h
+++ b/library/cpp/actors/core/defs.h
@@ -39,7 +39,7 @@ namespace NActors {
struct TMailboxType {
enum EType {
- Inherited = -1, // inherit mailbox from parent
+ Inherited = -1, // inherit mailbox from parent
Simple = 0, // simplest queue under producer lock. fastest in no-contention case
Revolving = 1, // somewhat outdated, tries to be wait-free. replaced by ReadAsFilled
HTSwap = 2, // other simple lf queue, suggested for low-contention case
diff --git a/library/cpp/actors/core/event_pb.h b/library/cpp/actors/core/event_pb.h
index d7546b901a..c52761c73d 100644
--- a/library/cpp/actors/core/event_pb.h
+++ b/library/cpp/actors/core/event_pb.h
@@ -228,8 +228,8 @@ namespace NActors {
}
}
return result;
- }
-
+ }
+
static IEventBase* Load(TIntrusivePtr<TEventSerializedData> input) {
THolder<TEventPBBase> ev(new TEv());
if (!input->GetSize()) {
@@ -281,7 +281,7 @@ namespace NActors {
}
return CachedByteSize;
}
-
+
ui32 CalculateSerializedSizeCached() const override {
return GetCachedByteSize();
}
diff --git a/library/cpp/actors/core/events.h b/library/cpp/actors/core/events.h
index 702cf50fad..be55e8ed78 100644
--- a/library/cpp/actors/core/events.h
+++ b/library/cpp/actors/core/events.h
@@ -179,15 +179,15 @@ namespace NActors {
DEFINE_SIMPLE_LOCAL_EVENT(TEvCompleted, "System: TEvCompleted")
};
-
+
struct TEvPoisonTaken: public TEventBase<TEvPoisonTaken, TSystem::PoisonTaken> {
DEFINE_SIMPLE_LOCAL_EVENT(TEvPoisonTaken, "System: TEvPoisonTaken")
};
-
+
struct TEvFlushLog: public TEventBase<TEvFlushLog, TSystem::FlushLog> {
DEFINE_SIMPLE_LOCAL_EVENT(TEvFlushLog, "System: TEvFlushLog")
};
-
+
struct TEvCallbackException: public TEventPB<TEvCallbackException,
NActorsProto::TCallbackException,
TSystem::CallbackException> {
@@ -196,7 +196,7 @@ namespace NActors {
Record.SetExceptionMessage(msg);
}
};
-
+
struct TEvCallbackCompletion: public TEventPB<TEvCallbackCompletion,
NActorsProto::TActorId,
TSystem::CallbackCompletion> {
diff --git a/library/cpp/actors/core/executor_pool_basic.cpp b/library/cpp/actors/core/executor_pool_basic.cpp
index 4dce16939a..c77a329aa6 100644
--- a/library/cpp/actors/core/executor_pool_basic.cpp
+++ b/library/cpp/actors/core/executor_pool_basic.cpp
@@ -144,7 +144,7 @@ namespace NActors {
}
}
} else {
- AtomicSet(threadCtx.WaitingFlag, TThreadCtx::WS_BLOCKED);
+ AtomicSet(threadCtx.WaitingFlag, TThreadCtx::WS_BLOCKED);
do {
hpnow = GetCycleCountFast();
elapsed += hpnow - hpstart;
diff --git a/library/cpp/actors/core/hfunc.h b/library/cpp/actors/core/hfunc.h
index 26f3c65013..6c843dd57b 100644
--- a/library/cpp/actors/core/hfunc.h
+++ b/library/cpp/actors/core/hfunc.h
@@ -40,8 +40,8 @@
typename TEvType::TPtr* x = reinterpret_cast<typename TEvType::TPtr*>(&ev); \
HandleFunc(*x, ctx); \
break; \
- }
-
+ }
+
#define hTemplFunc(TEvType, HandleFunc) \
case TEvType::EventType: { \
typename TEvType::TPtr* x = reinterpret_cast<typename TEvType::TPtr*>(&ev); \
diff --git a/library/cpp/actors/core/log.cpp b/library/cpp/actors/core/log.cpp
index 5f63b5af58..0117acb970 100644
--- a/library/cpp/actors/core/log.cpp
+++ b/library/cpp/actors/core/log.cpp
@@ -1,8 +1,8 @@
-#include "log.h"
+#include "log.h"
#include "log_settings.h"
-
+
#include <library/cpp/monlib/service/pages/templates.h>
-
+
static_assert(int(NActors::NLog::PRI_EMERG) == int(::TLOG_EMERG), "expect int(NActors::NLog::PRI_EMERG) == int(::TLOG_EMERG)");
static_assert(int(NActors::NLog::PRI_ALERT) == int(::TLOG_ALERT), "expect int(NActors::NLog::PRI_ALERT) == int(::TLOG_ALERT)");
static_assert(int(NActors::NLog::PRI_CRIT) == int(::TLOG_CRIT), "expect int(NActors::NLog::PRI_CRIT) == int(::TLOG_CRIT)");
@@ -12,7 +12,7 @@ static_assert(int(NActors::NLog::PRI_NOTICE) == int(::TLOG_NOTICE), "expect int(
static_assert(int(NActors::NLog::PRI_INFO) == int(::TLOG_INFO), "expect int(NActors::NLog::PRI_INFO) == int(::TLOG_INFO)");
static_assert(int(NActors::NLog::PRI_DEBUG) == int(::TLOG_DEBUG), "expect int(NActors::NLog::PRI_DEBUG) == int(::TLOG_DEBUG)");
static_assert(int(NActors::NLog::PRI_TRACE) == int(::TLOG_RESOURCES), "expect int(NActors::NLog::PRI_TRACE) == int(::TLOG_RESOURCES)");
-
+
namespace {
struct TRecordWithNewline {
ELogPriority Priority;
@@ -32,7 +32,7 @@ namespace {
};
}
-namespace NActors {
+namespace NActors {
class TLoggerCounters : public ILoggerMetrics {
public:
@@ -168,12 +168,12 @@ namespace NActors {
TLoggerActor::TLoggerActor(TIntrusivePtr<NLog::TSettings> settings,
TAutoPtr<TLogBackend> logBackend,
- TIntrusivePtr<NMonitoring::TDynamicCounters> counters)
- : TActor(&TLoggerActor::StateFunc)
- , Settings(settings)
+ TIntrusivePtr<NMonitoring::TDynamicCounters> counters)
+ : TActor(&TLoggerActor::StateFunc)
+ , Settings(settings)
, LogBackend(logBackend.Release())
, Metrics(std::make_unique<TLoggerCounters>(counters))
- {
+ {
}
TLoggerActor::TLoggerActor(TIntrusivePtr<NLog::TSettings> settings,
@@ -204,25 +204,25 @@ namespace NActors {
, LogBackend(logBackend)
, Metrics(std::make_unique<TLoggerMetrics>(metrics))
{
- }
-
- TLoggerActor::~TLoggerActor() {
- }
-
+ }
+
+ TLoggerActor::~TLoggerActor() {
+ }
+
void TLoggerActor::Log(TInstant time, NLog::EPriority priority, NLog::EComponent component, const char* c, ...) {
Metrics->IncDirectMsgs();
if (Settings && Settings->Satisfies(priority, component, 0ull)) {
- va_list params;
+ va_list params;
va_start(params, c);
TString formatted;
- vsprintf(formatted, c, params);
-
+ vsprintf(formatted, c, params);
+
auto ok = OutputRecord(time, NLog::EPrio(priority), component, formatted);
Y_UNUSED(ok);
va_end(params);
- }
- }
-
+ }
+ }
+
void TLoggerActor::Throttle(const NLog::TSettings& settings) {
if (AtomicGet(IsOverflow))
Sleep(settings.ThrottleDelay);
@@ -241,7 +241,7 @@ namespace NActors {
IgnoredCount = 0;
PassedCount = 0;
}
-
+
void TLoggerActor::HandleIgnoredEventDrop() {
// logger backend is unavailable, just ignore
}
@@ -295,8 +295,8 @@ namespace NActors {
if (!OutputRecord(ev->Get()->Stamp, prio, ev->Get()->Component, ev->Get()->Line)) {
BecomeDefunct();
}
- }
-
+ }
+
void TLoggerActor::BecomeDefunct() {
Become(&TThis::StateDefunct);
Schedule(WakeupInterval, new TEvents::TEvWakeup);
@@ -306,11 +306,11 @@ namespace NActors {
Metrics->IncLevelRequests();
TString explanation;
int code = Settings->SetLevel(ev->Get()->Priority, ev->Get()->Component, explanation);
- ctx.Send(ev->Sender, new TLogComponentLevelResponse(code, explanation));
- }
-
+ ctx.Send(ev->Sender, new TLogComponentLevelResponse(code, explanation));
+ }
+
void TLoggerActor::RenderComponentPriorities(IOutputStream& str) {
- using namespace NLog;
+ using namespace NLog;
HTML(str) {
H4() {
str << "Priority Settings for the Components";
@@ -333,7 +333,7 @@ namespace NActors {
}
}
TABLEBODY() {
- for (EComponent i = Settings->MinVal; i < Settings->MaxVal; i++) {
+ for (EComponent i = Settings->MinVal; i < Settings->MaxVal; i++) {
auto name = Settings->ComponentName(i);
if (!*name)
continue;
@@ -353,19 +353,19 @@ namespace NActors {
str << componentSettings.Raw.X.SamplingRate;
}
}
- }
+ }
}
}
}
- }
-
- /*
- * Logger INFO:
- * 1. Current priority settings from components
- * 2. Number of log messages (via actors events, directly)
- * 3. Number of messages per components, per priority
- * 4. Log level changes (last N changes)
- */
+ }
+
+ /*
+ * Logger INFO:
+ * 1. Current priority settings from components
+ * 2. Number of log messages (via actors events, directly)
+ * 3. Number of messages per components, per priority
+ * 4. Log level changes (last N changes)
+ */
void TLoggerActor::HandleMonInfo(NMon::TEvHttpInfo::TPtr& ev, const TActorContext& ctx) {
const auto& params = ev->Get()->Request.GetParams();
NLog::EComponent component = NLog::InvalidComponent;
@@ -408,7 +408,7 @@ namespace NActors {
}
}
- TStringStream str;
+ TStringStream str;
if (hasComponent && !hasPriority && !hasSamplingPriority && !hasSamplingRate) {
NLog::TComponentSettings componentSettings = Settings->GetComponentSettings(component);
ui32 samplingRate = componentSettings.Raw.X.SamplingRate;
@@ -568,10 +568,10 @@ namespace NActors {
Metrics->GetOutputHtml(str);
}
}
-
- ctx.Send(ev->Sender, new NMon::TEvHttpInfoRes(str.Str()));
- }
-
+
+ ctx.Send(ev->Sender, new NMon::TEvHttpInfoRes(str.Str()));
+ }
+
constexpr size_t TimeBufSize = 512;
bool TLoggerActor::OutputRecord(TInstant time, NLog::EPrio priority, NLog::EComponent component,
@@ -638,8 +638,8 @@ namespace NActors {
return true;
} catch (...) {
return false;
- }
-
+ }
+
void TLoggerActor::HandleLogEventDrop(const NLog::TEvLog::TPtr& ev) {
WriteMessageStat(*ev->Get());
Metrics->IncDroppedMsgs();
@@ -659,15 +659,15 @@ namespace NActors {
TAutoPtr<TLogBackend> CreateSysLogBackend(const TString& ident,
bool logPError, bool logCons) {
- int flags = 0;
- if (logPError)
- flags |= TSysLogBackend::LogPerror;
- if (logCons)
- flags |= TSysLogBackend::LogCons;
-
+ int flags = 0;
+ if (logPError)
+ flags |= TSysLogBackend::LogPerror;
+ if (logCons)
+ flags |= TSysLogBackend::LogCons;
+
return new TSysLogBackend(ident.data(), TSysLogBackend::TSYSLOG_LOCAL1, flags);
- }
-
+ }
+
class TStderrBackend: public TLogBackend {
public:
TStderrBackend() {
diff --git a/library/cpp/actors/core/log.h b/library/cpp/actors/core/log.h
index c11a7cf3c1..550cdb561c 100644
--- a/library/cpp/actors/core/log.h
+++ b/library/cpp/actors/core/log.h
@@ -1,29 +1,29 @@
-#pragma once
+#pragma once
#include "defs.h"
-
+
#include "log_iface.h"
-#include "log_settings.h"
-#include "actorsystem.h"
-#include "events.h"
-#include "event_local.h"
-#include "hfunc.h"
-#include "mon.h"
-
-#include <util/generic/vector.h>
-#include <util/string/printf.h>
+#include "log_settings.h"
+#include "actorsystem.h"
+#include "events.h"
+#include "event_local.h"
+#include "hfunc.h"
+#include "mon.h"
+
+#include <util/generic/vector.h>
+#include <util/string/printf.h>
#include <util/string/builder.h>
#include <library/cpp/logger/all.h>
#include <library/cpp/monlib/dynamic_counters/counters.h>
#include <library/cpp/monlib/metrics/metric_registry.h>
#include <library/cpp/json/writer/json.h>
#include <library/cpp/svnversion/svnversion.h>
-
+
#include <library/cpp/actors/memory_log/memlog.h>
-
-// TODO: limit number of messages per second
-// TODO: make TLogComponentLevelRequest/Response network messages
-
+
+// TODO: limit number of messages per second
+// TODO: make TLogComponentLevelRequest/Response network messages
+
#define IS_LOG_PRIORITY_ENABLED(actorCtxOrSystem, priority, component) \
(static_cast<::NActors::NLog::TSettings*>((actorCtxOrSystem).LoggerSettings()) && \
static_cast<::NActors::NLog::TSettings*>((actorCtxOrSystem).LoggerSettings())->Satisfies( \
@@ -53,7 +53,7 @@
#define LOG_LOG(actorCtxOrSystem, priority, component, ...) LOG_LOG_SAMPLED_BY(actorCtxOrSystem, priority, component, 0ull, __VA_ARGS__)
#define LOG_LOG_S(actorCtxOrSystem, priority, component, stream) LOG_LOG_S_SAMPLED_BY(actorCtxOrSystem, priority, component, 0ull, stream)
-// use these macros for logging via actor system or actor context
+// use these macros for logging via actor system or actor context
#define LOG_EMERG(actorCtxOrSystem, component, ...) LOG_LOG(actorCtxOrSystem, NActors::NLog::PRI_EMERG, component, __VA_ARGS__)
#define LOG_ALERT(actorCtxOrSystem, component, ...) LOG_LOG(actorCtxOrSystem, NActors::NLog::PRI_ALERT, component, __VA_ARGS__)
#define LOG_CRIT(actorCtxOrSystem, component, ...) LOG_LOG(actorCtxOrSystem, NActors::NLog::PRI_CRIT, component, __VA_ARGS__)
@@ -63,7 +63,7 @@
#define LOG_INFO(actorCtxOrSystem, component, ...) LOG_LOG(actorCtxOrSystem, NActors::NLog::PRI_INFO, component, __VA_ARGS__)
#define LOG_DEBUG(actorCtxOrSystem, component, ...) LOG_LOG(actorCtxOrSystem, NActors::NLog::PRI_DEBUG, component, __VA_ARGS__)
#define LOG_TRACE(actorCtxOrSystem, component, ...) LOG_LOG(actorCtxOrSystem, NActors::NLog::PRI_TRACE, component, __VA_ARGS__)
-
+
#define LOG_EMERG_S(actorCtxOrSystem, component, stream) LOG_LOG_S(actorCtxOrSystem, NActors::NLog::PRI_EMERG, component, stream)
#define LOG_ALERT_S(actorCtxOrSystem, component, stream) LOG_LOG_S(actorCtxOrSystem, NActors::NLog::PRI_ALERT, component, stream)
#define LOG_CRIT_S(actorCtxOrSystem, component, stream) LOG_LOG_S(actorCtxOrSystem, NActors::NLog::PRI_CRIT, component, stream)
@@ -94,14 +94,14 @@
#define LOG_DEBUG_S_SAMPLED_BY(actorCtxOrSystem, component, sampleBy, stream) LOG_LOG_S_SAMPLED_BY(actorCtxOrSystem, NActors::NLog::PRI_DEBUG, component, sampleBy, stream)
#define LOG_TRACE_S_SAMPLED_BY(actorCtxOrSystem, component, sampleBy, stream) LOG_LOG_S_SAMPLED_BY(actorCtxOrSystem, NActors::NLog::PRI_TRACE, component, sampleBy, stream)
-// Log Throttling
-#define LOG_LOG_THROTTLE(throttler, actorCtxOrSystem, priority, component, ...) \
+// Log Throttling
+#define LOG_LOG_THROTTLE(throttler, actorCtxOrSystem, priority, component, ...) \
do { \
if ((throttler).Kick()) { \
LOG_LOG(actorCtxOrSystem, priority, component, __VA_ARGS__); \
} \
} while (0) /**/
-
+
#define TRACE_EVENT(component) \
const auto& currentTracer = component; \
if (ev->HasEvent()) { \
@@ -113,68 +113,68 @@
}
#define TRACE_EVENT_TYPE(eventType) LOG_TRACE(*TlsActivationContext, currentTracer, "%s, processing event %s", __FUNCTION__, eventType)
-class TLog;
-class TLogBackend;
-
-namespace NActors {
- class TLoggerActor;
-
- ////////////////////////////////////////////////////////////////////////////////
- // SET LOG LEVEL FOR A COMPONENT
- ////////////////////////////////////////////////////////////////////////////////
+class TLog;
+class TLogBackend;
+
+namespace NActors {
+ class TLoggerActor;
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // SET LOG LEVEL FOR A COMPONENT
+ ////////////////////////////////////////////////////////////////////////////////
class TLogComponentLevelRequest: public TEventLocal<TLogComponentLevelRequest, int(NLog::EEv::LevelReq)> {
- public:
- // set given priority for the component
- TLogComponentLevelRequest(NLog::EPriority priority, NLog::EComponent component)
- : Priority(priority)
- , Component(component)
- {
- }
-
- // set given priority for all components
- TLogComponentLevelRequest(NLog::EPriority priority)
- : Priority(priority)
- , Component(NLog::InvalidComponent)
- {
- }
-
- protected:
- NLog::EPriority Priority;
- NLog::EComponent Component;
-
- friend class TLoggerActor;
- };
-
+ public:
+ // set given priority for the component
+ TLogComponentLevelRequest(NLog::EPriority priority, NLog::EComponent component)
+ : Priority(priority)
+ , Component(component)
+ {
+ }
+
+ // set given priority for all components
+ TLogComponentLevelRequest(NLog::EPriority priority)
+ : Priority(priority)
+ , Component(NLog::InvalidComponent)
+ {
+ }
+
+ protected:
+ NLog::EPriority Priority;
+ NLog::EComponent Component;
+
+ friend class TLoggerActor;
+ };
+
class TLogComponentLevelResponse: public TEventLocal<TLogComponentLevelResponse, int(NLog::EEv::LevelResp)> {
- public:
+ public:
TLogComponentLevelResponse(int code, const TString& explanation)
- : Code(code)
- , Explanation(explanation)
- {
- }
-
- int GetCode() const {
- return Code;
- }
-
+ : Code(code)
+ , Explanation(explanation)
+ {
+ }
+
+ int GetCode() const {
+ return Code;
+ }
+
const TString& GetExplanation() const {
- return Explanation;
- }
-
- protected:
- int Code;
+ return Explanation;
+ }
+
+ protected:
+ int Code;
TString Explanation;
- };
-
+ };
+
class TLogIgnored: public TEventLocal<TLogIgnored, int(NLog::EEv::Ignored)> {
public:
TLogIgnored() {
}
};
- ////////////////////////////////////////////////////////////////////////////////
- // LOGGER ACTOR
- ////////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////
+ // LOGGER ACTOR
+ ////////////////////////////////////////////////////////////////////////////////
class ILoggerMetrics {
public:
virtual ~ILoggerMetrics() = default;
@@ -191,14 +191,14 @@ namespace NActors {
};
class TLoggerActor: public TActor<TLoggerActor> {
- public:
+ public:
static constexpr IActor::EActivityType ActorActivityType() {
return IActor::LOG_ACTOR;
}
TLoggerActor(TIntrusivePtr<NLog::TSettings> settings,
TAutoPtr<TLogBackend> logBackend,
- TIntrusivePtr<NMonitoring::TDynamicCounters> counters);
+ TIntrusivePtr<NMonitoring::TDynamicCounters> counters);
TLoggerActor(TIntrusivePtr<NLog::TSettings> settings,
std::shared_ptr<TLogBackend> logBackend,
TIntrusivePtr<NMonitoring::TDynamicCounters> counters);
@@ -208,17 +208,17 @@ namespace NActors {
TLoggerActor(TIntrusivePtr<NLog::TSettings> settings,
std::shared_ptr<TLogBackend> logBackend,
std::shared_ptr<NMonitoring::TMetricRegistry> metrics);
- ~TLoggerActor();
-
+ ~TLoggerActor();
+
void StateFunc(TAutoPtr<IEventHandle>& ev, const TActorContext& ctx) {
- switch (ev->GetTypeRewrite()) {
+ switch (ev->GetTypeRewrite()) {
HFunc(TLogIgnored, HandleIgnoredEvent);
HFunc(NLog::TEvLog, HandleLogEvent);
- HFunc(TLogComponentLevelRequest, HandleLogComponentLevelRequest);
- HFunc(NMon::TEvHttpInfo, HandleMonInfo);
- }
- }
-
+ HFunc(TLogComponentLevelRequest, HandleLogComponentLevelRequest);
+ HFunc(NMon::TEvHttpInfo, HandleMonInfo);
+ }
+ }
+
STFUNC(StateDefunct) {
switch (ev->GetTypeRewrite()) {
cFunc(TLogIgnored::EventType, HandleIgnoredEventDrop);
@@ -229,20 +229,20 @@ namespace NActors {
}
}
- // Directly call logger instead of sending a message
+ // Directly call logger instead of sending a message
void Log(TInstant time, NLog::EPriority priority, NLog::EComponent component, const char* c, ...);
-
+
static void Throttle(const NLog::TSettings& settings);
- private:
- TIntrusivePtr<NLog::TSettings> Settings;
+ private:
+ TIntrusivePtr<NLog::TSettings> Settings;
std::shared_ptr<TLogBackend> LogBackend;
ui64 IgnoredCount = 0;
ui64 PassedCount = 0;
static TAtomic IsOverflow;
TDuration WakeupInterval{TDuration::Seconds(5)};
std::unique_ptr<ILoggerMetrics> Metrics;
-
+
void BecomeDefunct();
void HandleIgnoredEvent(TLogIgnored::TPtr& ev, const NActors::TActorContext& ctx);
void HandleIgnoredEventDrop();
@@ -256,51 +256,51 @@ namespace NActors {
void LogIgnoredCount(TInstant now);
void WriteMessageStat(const NLog::TEvLog& ev);
static const char* FormatLocalTimestamp(TInstant time, char* buf);
- };
-
- ////////////////////////////////////////////////////////////////////////////////
- // LOG THROTTLING
- // TTrivialLogThrottler -- log a message every 'period' duration
- // Use case:
- // TTrivialLogThrottler throttler(TDuration::Minutes(1));
- // ....
- // LOG_LOG_THROTTLE(throttler, ctx, NActors::NLog::PRI_ERROR, SOME, "Error");
- ////////////////////////////////////////////////////////////////////////////////
- class TTrivialLogThrottler {
- public:
- TTrivialLogThrottler(TDuration period)
- : Period(period)
+ };
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // LOG THROTTLING
+ // TTrivialLogThrottler -- log a message every 'period' duration
+ // Use case:
+ // TTrivialLogThrottler throttler(TDuration::Minutes(1));
+ // ....
+ // LOG_LOG_THROTTLE(throttler, ctx, NActors::NLog::PRI_ERROR, SOME, "Error");
+ ////////////////////////////////////////////////////////////////////////////////
+ class TTrivialLogThrottler {
+ public:
+ TTrivialLogThrottler(TDuration period)
+ : Period(period)
{
}
-
- // return value:
- // true -- write to log
- // false -- don't write to log, throttle
- bool Kick() {
- auto now = TInstant::Now();
- if (now >= (LastWrite + Period)) {
- LastWrite = now;
- return true;
- } else {
- return false;
- }
- }
-
- private:
- TInstant LastWrite;
- TDuration Period;
- };
-
- ////////////////////////////////////////////////////////////////////////////////
- // SYSLOG BACKEND
- ////////////////////////////////////////////////////////////////////////////////
+
+ // return value:
+ // true -- write to log
+ // false -- don't write to log, throttle
+ bool Kick() {
+ auto now = TInstant::Now();
+ if (now >= (LastWrite + Period)) {
+ LastWrite = now;
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ private:
+ TInstant LastWrite;
+ TDuration Period;
+ };
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // SYSLOG BACKEND
+ ////////////////////////////////////////////////////////////////////////////////
TAutoPtr<TLogBackend> CreateSysLogBackend(const TString& ident,
bool logPError, bool logCons);
TAutoPtr<TLogBackend> CreateStderrBackend();
TAutoPtr<TLogBackend> CreateFileBackend(const TString& fileName);
TAutoPtr<TLogBackend> CreateNullBackend();
TAutoPtr<TLogBackend> CreateCompositeLogBackend(TVector<TAutoPtr<TLogBackend>>&& underlyingBackends);
-
+
/////////////////////////////////////////////////////////////////////
// Logging adaptors for memory log and logging into filesystem
/////////////////////////////////////////////////////////////////////
@@ -312,7 +312,7 @@ namespace NActors {
vsprintf(dst, format, params);
va_end(params);
}
-
+
inline void PrintfV(TString& dst, const char* format, va_list params) {
vsprintf(dst, format, params);
}
@@ -324,8 +324,8 @@ namespace NActors {
const NLog::TSettings *mSettings = ctx.LoggerSettings();
TLoggerActor::Throttle(*mSettings);
ctx.Send(new IEventHandle(mSettings->LoggerActorId, TActorId(), new NLog::TEvLog(mPriority, mComponent, std::move(str))));
- }
-
+ }
+
template <typename TCtx, typename... TArgs>
inline void MemLogAdapter(
TCtx& actorCtxOrSystem,
@@ -342,7 +342,7 @@ namespace NActors {
}
MemLogWrite(Formatted.data(), Formatted.size(), true);
- DeliverLogMessage(actorCtxOrSystem, mPriority, mComponent, std::move(Formatted));
+ DeliverLogMessage(actorCtxOrSystem, mPriority, mComponent, std::move(Formatted));
}
template <typename TCtx>
@@ -351,19 +351,19 @@ namespace NActors {
NLog::EPriority mPriority,
NLog::EComponent mComponent,
const TString& str) {
-
- MemLogWrite(str.data(), str.size(), true);
- DeliverLogMessage(actorCtxOrSystem, mPriority, mComponent, TString(str));
- }
-
- template <typename TCtx>
- Y_WRAPPER inline void MemLogAdapter(
- TCtx& actorCtxOrSystem,
- NLog::EPriority mPriority,
- NLog::EComponent mComponent,
- TString&& str) {
-
+
MemLogWrite(str.data(), str.size(), true);
- DeliverLogMessage(actorCtxOrSystem, mPriority, mComponent, std::move(str));
+ DeliverLogMessage(actorCtxOrSystem, mPriority, mComponent, TString(str));
+ }
+
+ template <typename TCtx>
+ Y_WRAPPER inline void MemLogAdapter(
+ TCtx& actorCtxOrSystem,
+ NLog::EPriority mPriority,
+ NLog::EComponent mComponent,
+ TString&& str) {
+
+ MemLogWrite(str.data(), str.size(), true);
+ DeliverLogMessage(actorCtxOrSystem, mPriority, mComponent, std::move(str));
}
}
diff --git a/library/cpp/actors/core/log_iface.h b/library/cpp/actors/core/log_iface.h
index b331db9ca8..7fbf38c6d6 100644
--- a/library/cpp/actors/core/log_iface.h
+++ b/library/cpp/actors/core/log_iface.h
@@ -75,18 +75,18 @@ namespace NActors {
class TEvLog: public TEventLocal<TEvLog, int(EEv::Log)> {
public:
- TEvLog(TInstant stamp, TLevel level, EComponent comp, const TString &line)
- : Stamp(stamp)
- , Level(level)
- , Component(comp)
- , Line(line)
- {
- }
-
- TEvLog(TInstant stamp, TLevel level, EComponent comp, TString &&line)
+ TEvLog(TInstant stamp, TLevel level, EComponent comp, const TString &line)
: Stamp(stamp)
, Level(level)
, Component(comp)
+ , Line(line)
+ {
+ }
+
+ TEvLog(TInstant stamp, TLevel level, EComponent comp, TString &&line)
+ : Stamp(stamp)
+ , Level(level)
+ , Component(comp)
, Line(std::move(line))
{
}
diff --git a/library/cpp/actors/core/log_settings.cpp b/library/cpp/actors/core/log_settings.cpp
index f52f2fc5d2..1b76f83cbc 100644
--- a/library/cpp/actors/core/log_settings.cpp
+++ b/library/cpp/actors/core/log_settings.cpp
@@ -1,44 +1,44 @@
-#include "log_settings.h"
-
-#include <util/stream/str.h>
-
-namespace NActors {
- namespace NLog {
+#include "log_settings.h"
+
+#include <util/stream/str.h>
+
+namespace NActors {
+ namespace NLog {
TSettings::TSettings(const TActorId& loggerActorId, const EComponent loggerComponent,
EComponent minVal, EComponent maxVal, EComponentToStringFunc func,
EPriority defPriority, EPriority defSamplingPriority,
ui32 defSamplingRate, ui64 timeThresholdMs)
- : LoggerActorId(loggerActorId)
+ : LoggerActorId(loggerActorId)
, LoggerComponent(loggerComponent)
, TimeThresholdMs(timeThresholdMs)
, AllowDrop(true)
, ThrottleDelay(TDuration::MilliSeconds(100))
- , MinVal(0)
- , MaxVal(0)
- , Mask(0)
- , DefPriority(defPriority)
+ , MinVal(0)
+ , MaxVal(0)
+ , Mask(0)
+ , DefPriority(defPriority)
, DefSamplingPriority(defSamplingPriority)
, DefSamplingRate(defSamplingRate)
, UseLocalTimestamps(false)
, Format(PLAIN_FULL_FORMAT)
, ShortHostName("")
, ClusterName("")
- {
- Append(minVal, maxVal, func);
- }
-
+ {
+ Append(minVal, maxVal, func);
+ }
+
TSettings::TSettings(const TActorId& loggerActorId, const EComponent loggerComponent,
EPriority defPriority, EPriority defSamplingPriority,
ui32 defSamplingRate, ui64 timeThresholdMs)
- : LoggerActorId(loggerActorId)
+ : LoggerActorId(loggerActorId)
, LoggerComponent(loggerComponent)
, TimeThresholdMs(timeThresholdMs)
, AllowDrop(true)
, ThrottleDelay(TDuration::MilliSeconds(100))
- , MinVal(0)
- , MaxVal(0)
- , Mask(0)
- , DefPriority(defPriority)
+ , MinVal(0)
+ , MaxVal(0)
+ , Mask(0)
+ , DefPriority(defPriority)
, DefSamplingPriority(defSamplingPriority)
, DefSamplingRate(defSamplingRate)
, UseLocalTimestamps(false)
@@ -47,8 +47,8 @@ namespace NActors {
, ClusterName("")
{
}
-
- void TSettings::Append(EComponent minVal, EComponent maxVal, EComponentToStringFunc func) {
+
+ void TSettings::Append(EComponent minVal, EComponent maxVal, EComponentToStringFunc func) {
Y_VERIFY(minVal >= 0, "NLog::TSettings: minVal must be non-negative");
Y_VERIFY(maxVal > minVal, "NLog::TSettings: maxVal must be greater than minVal");
@@ -78,30 +78,30 @@ namespace NActors {
ComponentNames.resize(Mask + 1);
}
-
+
// assign new names but validate if newly added members were not used before
- for (int i = minVal; i <= maxVal; i++) {
+ for (int i = minVal; i <= maxVal; i++) {
Y_VERIFY(!ComponentNames[i], "component name at %d already set: %s",
i, ComponentNames[i].data());
- ComponentNames[i] = func(i);
- }
- }
-
+ ComponentNames[i] = func(i);
+ }
+ }
+
int TSettings::SetLevelImpl(
const TString& name, bool isSampling,
EPriority priority, EComponent component, TString& explanation) {
TString titleName(name);
titleName.to_title();
- // check priority
- if (!IsValidPriority(priority)) {
+ // check priority
+ if (!IsValidPriority(priority)) {
TStringStream str;
str << "Invalid " << name;
explanation = str.Str();
- return 1;
- }
-
- if (component == InvalidComponent) {
+ return 1;
+ }
+
+ if (component == InvalidComponent) {
for (int i = 0; i < Mask + 1; i++) {
TComponentSettings settings = AtomicGet(ComponentInfo[i]);
if (isSampling) {
@@ -118,12 +118,12 @@ namespace NActors {
<< " for all components has been changed to "
<< PriorityToString(EPrio(priority));
explanation = str.Str();
- return 0;
- } else {
- if (!IsValidComponent(component)) {
- explanation = "Invalid component";
- return 1;
- }
+ return 0;
+ } else {
+ if (!IsValidComponent(component)) {
+ explanation = "Invalid component";
+ return 1;
+ }
TComponentSettings settings = AtomicGet(ComponentInfo[component]);
EPriority oldPriority;
if (isSampling) {
@@ -134,15 +134,15 @@ namespace NActors {
settings.Raw.X.Level = priority;
}
AtomicSet(ComponentInfo[component], settings.Raw.Data);
- TStringStream str;
+ TStringStream str;
str << titleName << " for the component " << ComponentNames[component]
<< " has been changed from " << PriorityToString(EPrio(oldPriority))
<< " to " << PriorityToString(EPrio(priority));
- explanation = str.Str();
- return 0;
- }
- }
-
+ explanation = str.Str();
+ return 0;
+ }
+ }
+
int TSettings::SetLevel(EPriority priority, EComponent component, TString& explanation) {
return SetLevelImpl("priority", false,
priority, component, explanation);
@@ -181,26 +181,26 @@ namespace NActors {
return 0;
}
- int TSettings::PowerOf2Mask(int val) {
- int mask = 1;
- while ((val & mask) != val) {
- mask <<= 1;
- mask |= 1;
- }
- return mask;
- }
-
- bool TSettings::IsValidPriority(EPriority priority) {
- return priority == PRI_EMERG || priority == PRI_ALERT ||
+ int TSettings::PowerOf2Mask(int val) {
+ int mask = 1;
+ while ((val & mask) != val) {
+ mask <<= 1;
+ mask |= 1;
+ }
+ return mask;
+ }
+
+ bool TSettings::IsValidPriority(EPriority priority) {
+ return priority == PRI_EMERG || priority == PRI_ALERT ||
priority == PRI_CRIT || priority == PRI_ERROR ||
priority == PRI_WARN || priority == PRI_NOTICE ||
priority == PRI_INFO || priority == PRI_DEBUG || priority == PRI_TRACE;
- }
-
- bool TSettings::IsValidComponent(EComponent component) {
+ }
+
+ bool TSettings::IsValidComponent(EComponent component) {
return (MinVal <= component) && (component <= MaxVal) && !ComponentNames[component].empty();
- }
-
+ }
+
void TSettings::SetAllowDrop(bool val) {
AllowDrop = val;
}
@@ -226,5 +226,5 @@ namespace NActors {
}
}
-
+
}
diff --git a/library/cpp/actors/core/log_settings.h b/library/cpp/actors/core/log_settings.h
index 7fe4504edd..4676da0dee 100644
--- a/library/cpp/actors/core/log_settings.h
+++ b/library/cpp/actors/core/log_settings.h
@@ -1,15 +1,15 @@
-#pragma once
-
-#include "actor.h"
+#pragma once
+
+#include "actor.h"
#include "log_iface.h"
-#include <util/generic/vector.h>
+#include <util/generic/vector.h>
#include <util/digest/murmur.h>
#include <util/random/easy.h>
-
-namespace NActors {
- namespace NLog {
+
+namespace NActors {
+ namespace NLog {
inline const char* PriorityToString(EPrio priority) {
- switch (priority) {
+ switch (priority) {
case EPrio::Emerg:
return "EMERG";
case EPrio::Alert:
@@ -30,21 +30,21 @@ namespace NActors {
return "TRACE";
default:
return "UNKNOWN";
- }
- }
-
- // You can structure your program to have multiple logical components.
- // In this case you can set different log priorities for different
- // components. And you can change component's priority while system
- // is running. Suspect a component has a bug? Turn DEBUG priority level on
- // for this component.
- static const int InvalidComponent = -1;
-
- // Functions converts EComponent id to string
+ }
+ }
+
+ // You can structure your program to have multiple logical components.
+ // In this case you can set different log priorities for different
+ // components. And you can change component's priority while system
+ // is running. Suspect a component has a bug? Turn DEBUG priority level on
+ // for this component.
+ static const int InvalidComponent = -1;
+
+ // Functions converts EComponent id to string
using EComponentToStringFunc = std::function<const TString&(EComponent)>;
;
-
- // Log settings
+
+ // Log settings
struct TComponentSettings {
union {
struct {
@@ -76,14 +76,14 @@ namespace NActors {
TDuration ThrottleDelay;
TArrayHolder<TAtomic> ComponentInfo;
TVector<TString> ComponentNames;
- EComponent MinVal;
- EComponent MaxVal;
- EComponent Mask;
- EPriority DefPriority;
+ EComponent MinVal;
+ EComponent MaxVal;
+ EComponent Mask;
+ EPriority DefPriority;
EPriority DefSamplingPriority;
ui32 DefSamplingRate;
bool UseLocalTimestamps;
-
+
enum ELogFormat {
PLAIN_FULL_FORMAT,
PLAIN_SHORT_FORMAT,
@@ -94,21 +94,21 @@ namespace NActors {
TString ClusterName;
TString MessagePrefix;
- // The best way to provide minVal, maxVal and func is to have
- // protobuf enumeration of components. In this case protoc
- // automatically generates YOURTYPE_MIN, YOURTYPE_MAX and
- // YOURTYPE_Name for you.
+ // The best way to provide minVal, maxVal and func is to have
+ // protobuf enumeration of components. In this case protoc
+ // automatically generates YOURTYPE_MIN, YOURTYPE_MAX and
+ // YOURTYPE_Name for you.
TSettings(const TActorId& loggerActorId, const EComponent loggerComponent,
EComponent minVal, EComponent maxVal, EComponentToStringFunc func,
EPriority defPriority, EPriority defSamplingPriority = PRI_DEBUG,
ui32 defSamplingRate = 0, ui64 timeThresholdMs = 1000);
-
+
TSettings(const TActorId& loggerActorId, const EComponent loggerComponent,
EPriority defPriority, EPriority defSamplingPriority = PRI_DEBUG,
ui32 defSamplingRate = 0, ui64 timeThresholdMs = 1000);
- void Append(EComponent minVal, EComponent maxVal, EComponentToStringFunc func);
-
+ void Append(EComponent minVal, EComponent maxVal, EComponentToStringFunc func);
+
template <typename T>
void Append(T minVal, T maxVal, const TString& (*func)(T)) {
Append(
@@ -121,7 +121,7 @@ namespace NActors {
}
inline bool Satisfies(EPriority priority, EComponent component, ui64 sampleBy = 0) const {
- // by using Mask we don't get outside of array boundaries
+ // by using Mask we don't get outside of array boundaries
TComponentSettings settings = GetComponentSettings(component);
if (priority > settings.Raw.X.Level) {
if (priority > settings.Raw.X.SamplingLevel) {
@@ -141,8 +141,8 @@ namespace NActors {
// priority <= log level ==> log
return true;
}
- }
-
+ }
+
inline TComponentSettings GetComponentSettings(EComponent component) const {
Y_VERIFY_DEBUG((component & Mask) == component);
// by using Mask we don't get outside of array boundaries
@@ -152,15 +152,15 @@ namespace NActors {
const char* ComponentName(EComponent component) const {
Y_VERIFY_DEBUG((component & Mask) == component);
return ComponentNames[component & Mask].data();
- }
-
+ }
+
int SetLevel(EPriority priority, EComponent component, TString& explanation);
int SetSamplingLevel(EPriority priority, EComponent component, TString& explanation);
int SetSamplingRate(ui32 sampling, EComponent component, TString& explanation);
EComponent FindComponent(const TStringBuf& componentName) const;
- static int PowerOf2Mask(int val);
- static bool IsValidPriority(EPriority priority);
- bool IsValidComponent(EComponent component);
+ static int PowerOf2Mask(int val);
+ static bool IsValidPriority(EPriority priority);
+ bool IsValidComponent(EComponent component);
void SetAllowDrop(bool val);
void SetThrottleDelay(TDuration value);
void SetUseLocalTimestamps(bool value);
@@ -169,8 +169,8 @@ namespace NActors {
int SetLevelImpl(
const TString& name, bool isSampling,
EPriority priority, EComponent component, TString& explanation);
- };
-
+ };
+
}
-
+
}
diff --git a/library/cpp/actors/core/mon.h b/library/cpp/actors/core/mon.h
index c450f2338e..3c050bad2a 100644
--- a/library/cpp/actors/core/mon.h
+++ b/library/cpp/actors/core/mon.h
@@ -1,32 +1,32 @@
-#pragma once
-
-#include "events.h"
-#include "event_local.h"
+#pragma once
+
+#include "events.h"
+#include "event_local.h"
#include <library/cpp/monlib/service/monservice.h>
#include <library/cpp/monlib/service/pages/mon_page.h>
-
-namespace NActors {
- namespace NMon {
- enum {
- HttpInfo = EventSpaceBegin(NActors::TEvents::ES_MON),
- HttpInfoRes,
+
+namespace NActors {
+ namespace NMon {
+ enum {
+ HttpInfo = EventSpaceBegin(NActors::TEvents::ES_MON),
+ HttpInfoRes,
RemoteHttpInfo,
RemoteHttpInfoRes,
RemoteJsonInfoRes,
RemoteBinaryInfoRes,
- End
- };
-
+ End
+ };
+
static_assert(End < EventSpaceEnd(NActors::TEvents::ES_MON), "expect End < EventSpaceEnd(NActors::TEvents::ES_MON)");
-
- // request info from an actor in HTML format
+
+ // request info from an actor in HTML format
struct TEvHttpInfo: public NActors::TEventLocal<TEvHttpInfo, HttpInfo> {
TEvHttpInfo(const NMonitoring::IMonHttpRequest& request, int subReqId = 0)
- : Request(request)
- , SubRequestId(subReqId)
- {
- }
-
+ : Request(request)
+ , SubRequestId(subReqId)
+ {
+ }
+
TEvHttpInfo(const NMonitoring::IMonHttpRequest& request, const TString& userToken)
: Request(request)
, UserToken(userToken)
@@ -36,49 +36,49 @@ namespace NActors {
const NMonitoring::IMonHttpRequest& Request;
TString UserToken; // built and serialized
- // SubRequestId != 0 means that we assemble reply from multiple parts and SubRequestId contains this part id
- int SubRequestId;
- };
-
- // base class for HTTP info response
+ // SubRequestId != 0 means that we assemble reply from multiple parts and SubRequestId contains this part id
+ int SubRequestId;
+ };
+
+ // base class for HTTP info response
struct IEvHttpInfoRes: public NActors::TEventLocal<IEvHttpInfoRes, HttpInfoRes> {
enum EContentType {
Html,
Custom,
};
- IEvHttpInfoRes() {
- }
-
- virtual ~IEvHttpInfoRes() {
- }
-
+ IEvHttpInfoRes() {
+ }
+
+ virtual ~IEvHttpInfoRes() {
+ }
+
virtual void Output(IOutputStream& out) const = 0;
virtual EContentType GetContentType() const = 0;
- };
-
+ };
+
// Ready to output HTML in TString
struct TEvHttpInfoRes: public IEvHttpInfoRes {
TEvHttpInfoRes(const TString& answer, int subReqId = 0, EContentType contentType = Html)
- : Answer(answer)
- , SubRequestId(subReqId)
+ : Answer(answer)
+ , SubRequestId(subReqId)
, ContentType(contentType)
- {
- }
-
+ {
+ }
+
void Output(IOutputStream& out) const override {
- out << Answer;
- }
-
+ out << Answer;
+ }
+
EContentType GetContentType() const override {
return ContentType;
}
const TString Answer;
- const int SubRequestId;
+ const int SubRequestId;
const EContentType ContentType;
- };
-
+ };
+
struct TEvRemoteHttpInfo: public NActors::TEventBase<TEvRemoteHttpInfo, RemoteHttpInfo> {
TEvRemoteHttpInfo() {
}
@@ -230,5 +230,5 @@ namespace NActors {
};
}
-
+
}
diff --git a/library/cpp/actors/core/process_stats.cpp b/library/cpp/actors/core/process_stats.cpp
index 0e1dbd0031..61ebcabc9c 100644
--- a/library/cpp/actors/core/process_stats.cpp
+++ b/library/cpp/actors/core/process_stats.cpp
@@ -76,7 +76,7 @@ namespace NActors {
CStime /= tickPerMillisec;
SystemUptime = ::Uptime();
Uptime = SystemUptime - TDuration::MilliSeconds(StartTime / TicksPerMillisec());
- }
+ }
TFileInput statm("/proc/" + strPid + "/statm");
statm.ReadLine(str);
@@ -122,7 +122,7 @@ namespace NActors {
long sz = sysconf(_SC_PAGESIZE);
return sz;
}
-
+
#else
bool TProcStat::Fill(pid_t pid) {
@@ -133,7 +133,7 @@ namespace NActors {
long TProcStat::ObtainPageSize() {
return 0;
}
-
+
#endif
namespace {
diff --git a/library/cpp/actors/core/ya.make b/library/cpp/actors/core/ya.make
index 880a9d00db..19d643ecce 100644
--- a/library/cpp/actors/core/ya.make
+++ b/library/cpp/actors/core/ya.make
@@ -67,10 +67,10 @@ SRCS(
io_dispatcher.cpp
io_dispatcher.h
lease.h
- log.cpp
- log.h
- log_settings.cpp
- log_settings.h
+ log.cpp
+ log.h
+ log_settings.cpp
+ log_settings.h
mailbox.cpp
mailbox.h
mailbox_queue_revolving.h
@@ -79,7 +79,7 @@ SRCS(
memory_track.h
memory_tracker.cpp
memory_tracker.h
- mon.h
+ mon.h
mon_stats.h
monotonic.cpp
monotonic.h
diff --git a/library/cpp/actors/dnscachelib/dnscache.h b/library/cpp/actors/dnscachelib/dnscache.h
index 3313a251a1..8bf77444f7 100644
--- a/library/cpp/actors/dnscachelib/dnscache.h
+++ b/library/cpp/actors/dnscachelib/dnscache.h
@@ -23,7 +23,7 @@ public:
TString GetHostByAddr(const NAddr::IRemoteAddr&);
- // ip in network byte order
+ // ip in network byte order
TIpHost Get(const TString& host);
/* use with AF_INET, AF_INET6 or AF_UNSPEC */
diff --git a/library/cpp/actors/helpers/activeactors.cpp b/library/cpp/actors/helpers/activeactors.cpp
index 145e97dc57..c49c37b230 100644
--- a/library/cpp/actors/helpers/activeactors.cpp
+++ b/library/cpp/actors/helpers/activeactors.cpp
@@ -1,2 +1,2 @@
-#include "activeactors.h"
-
+#include "activeactors.h"
+
diff --git a/library/cpp/actors/helpers/activeactors.h b/library/cpp/actors/helpers/activeactors.h
index 0fdb0fab10..43ad640dd6 100644
--- a/library/cpp/actors/helpers/activeactors.h
+++ b/library/cpp/actors/helpers/activeactors.h
@@ -2,41 +2,41 @@
#include <library/cpp/actors/core/actor.h>
#include <library/cpp/actors/core/events.h>
-#include <util/generic/hash_set.h>
+#include <util/generic/hash_set.h>
-namespace NActors {
+namespace NActors {
- ////////////////////////////////////////////////////////////////////////////
- // TActiveActors
- // This class helps manage created actors and kill them all on PoisonPill.
- ////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////
+ // TActiveActors
+ // This class helps manage created actors and kill them all on PoisonPill.
+ ////////////////////////////////////////////////////////////////////////////
class TActiveActors : public THashSet<TActorId> {
- public:
+ public:
void Insert(const TActorId &aid) {
- bool inserted = insert(aid).second;
- Y_VERIFY(inserted);
- }
-
- void Insert(const TActiveActors &moreActors) {
- for (const auto &aid : moreActors) {
- Insert(aid);
- }
- }
-
+ bool inserted = insert(aid).second;
+ Y_VERIFY(inserted);
+ }
+
+ void Insert(const TActiveActors &moreActors) {
+ for (const auto &aid : moreActors) {
+ Insert(aid);
+ }
+ }
+
void Erase(const TActorId &aid) {
- auto num = erase(aid);
- Y_VERIFY(num == 1);
- }
-
- size_t KillAndClear(const TActorContext &ctx) {
- size_t s = size(); // number of actors managed
- for (const auto &x: *this) {
- ctx.Send(x, new TEvents::TEvPoisonPill());
- }
- clear();
- return s; // how many actors we killed
- }
- };
-
+ auto num = erase(aid);
+ Y_VERIFY(num == 1);
+ }
+
+ size_t KillAndClear(const TActorContext &ctx) {
+ size_t s = size(); // number of actors managed
+ for (const auto &x: *this) {
+ ctx.Send(x, new TEvents::TEvPoisonPill());
+ }
+ clear();
+ return s; // how many actors we killed
+ }
+ };
+
} // NKikimr
-
+
diff --git a/library/cpp/actors/helpers/ya.make b/library/cpp/actors/helpers/ya.make
index d8771179de..2c31d5190a 100644
--- a/library/cpp/actors/helpers/ya.make
+++ b/library/cpp/actors/helpers/ya.make
@@ -3,8 +3,8 @@ LIBRARY()
OWNER(g:kikimr)
SRCS(
- activeactors.cpp
- activeactors.h
+ activeactors.cpp
+ activeactors.h
flow_controlled_queue.cpp
flow_controlled_queue.h
future_callback.h
diff --git a/library/cpp/actors/interconnect/interconnect_stream.h b/library/cpp/actors/interconnect/interconnect_stream.h
index 074adc6e74..1e8e9323cf 100644
--- a/library/cpp/actors/interconnect/interconnect_stream.h
+++ b/library/cpp/actors/interconnect/interconnect_stream.h
@@ -77,7 +77,7 @@ namespace NInterconnect {
~TSecureSocketContext();
public:
- using TPtr = std::shared_ptr<TSecureSocketContext>;
+ using TPtr = std::shared_ptr<TSecureSocketContext>;
};
class TSecureSocket : public TStreamSocket {
diff --git a/library/cpp/actors/util/affinity.h b/library/cpp/actors/util/affinity.h
index ae106ed180..781fe10084 100644
--- a/library/cpp/actors/util/affinity.h
+++ b/library/cpp/actors/util/affinity.h
@@ -28,7 +28,7 @@ class TAffinityGuard : TNonCopyable {
public:
TAffinityGuard(const TAffinity* affinity) {
- Stacked = false;
+ Stacked = false;
if (affinity && !affinity->Empty()) {
OldAffinity.Current();
affinity->Set();
diff --git a/library/cpp/actors/util/ya.make b/library/cpp/actors/util/ya.make
index 37488c3962..ce60468720 100644
--- a/library/cpp/actors/util/ya.make
+++ b/library/cpp/actors/util/ya.make
@@ -1,9 +1,9 @@
LIBRARY()
-OWNER(
- ddoarn
- g:kikimr
-)
+OWNER(
+ ddoarn
+ g:kikimr
+)
SRCS(
affinity.cpp
diff --git a/library/cpp/actors/wilson/wilson_event.h b/library/cpp/actors/wilson/wilson_event.h
index 7d89c33b51..9bcbf340fc 100644
--- a/library/cpp/actors/wilson/wilson_event.h
+++ b/library/cpp/actors/wilson/wilson_event.h
@@ -160,15 +160,15 @@ namespace NWilson {
--end;
// generate log record
- TString finalMessage;
- TStringOutput s(finalMessage);
+ TString finalMessage;
+ TStringOutput s(finalMessage);
s << GetNodeId(actorSystem) << " " << TStringBuf(base64, end) << " ";
traceId->Output(s, parentTraceId);
s << " ";
event.Output(s);
// output wilson event FIXME: special facility for wilson events w/binary serialization
- NActors::MemLogAdapter(actorSystem, NActors::NLog::PRI_DEBUG, WilsonComponentId, std::move(finalMessage));
+ NActors::MemLogAdapter(actorSystem, NActors::NLog::PRI_DEBUG, WilsonComponentId, std::move(finalMessage));
}
#else
diff --git a/library/cpp/actors/ya.make b/library/cpp/actors/ya.make
index 737c7fbc18..a8a59f9e7f 100644
--- a/library/cpp/actors/ya.make
+++ b/library/cpp/actors/ya.make
@@ -6,7 +6,7 @@ RECURSE(
dnsresolver
examples
memory_log
- helpers
+ helpers
prof
protos
util