aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp
diff options
context:
space:
mode:
authorAndrey Fomichev <andrey.fomichev@gmail.com>2022-02-10 16:49:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:15 +0300
commit1c61afbf3db63940d05e6fefa3104b03457788a1 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp
parente542cc14db4240643a06bb0dde87ecf361f101ab (diff)
downloadydb-1c61afbf3db63940d05e6fefa3104b03457788a1.tar.gz
Restoring authorship annotation for Andrey Fomichev <andrey.fomichev@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp')
-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
-rw-r--r--library/cpp/containers/intrusive_avl_tree/avltree.h8
-rw-r--r--library/cpp/containers/intrusive_avl_tree/ut/avltree_ut.cpp78
-rw-r--r--library/cpp/grpc/client/ya.make6
-rw-r--r--library/cpp/http/fetch/httpfsm.rl62
-rw-r--r--library/cpp/http/io/stream.cpp4
-rw-r--r--library/cpp/http/io/stream_ut.cpp8
-rw-r--r--library/cpp/http/misc/httpcodes.cpp4
-rw-r--r--library/cpp/lfalloc/lf_allocX64.cpp12
-rw-r--r--library/cpp/logger/log.cpp18
-rw-r--r--library/cpp/logger/null.h2
-rw-r--r--library/cpp/logger/priority.h2
-rw-r--r--library/cpp/logger/stream.h2
-rw-r--r--library/cpp/logger/system.cpp42
-rw-r--r--library/cpp/logger/system.h24
-rw-r--r--library/cpp/lwtrace/example5/lwtrace_example5.cpp4
-rw-r--r--library/cpp/lwtrace/protos/ya.make2
-rw-r--r--library/cpp/lwtrace/ya.make2
-rw-r--r--library/cpp/messagebus/network.cpp38
-rw-r--r--library/cpp/messagebus/network_ut.cpp8
-rw-r--r--library/cpp/messagebus/session_impl.cpp2
-rw-r--r--library/cpp/messagebus/test/helper/hanging_server.cpp2
-rw-r--r--library/cpp/mime/types/mime.h4
-rw-r--r--library/cpp/monlib/counters/counters.cpp40
-rw-r--r--library/cpp/monlib/counters/counters.h4
-rw-r--r--library/cpp/monlib/dynamic_counters/counters.cpp26
-rw-r--r--library/cpp/monlib/dynamic_counters/page.h2
-rw-r--r--library/cpp/monlib/dynamic_counters/percentile/percentile_base.h12
-rw-r--r--library/cpp/monlib/service/monservice.cpp2
-rw-r--r--library/cpp/monlib/service/pages/html_mon_page.cpp16
-rw-r--r--library/cpp/monlib/service/pages/index_mon_page.cpp28
-rw-r--r--library/cpp/monlib/service/pages/pre_mon_page.cpp6
-rw-r--r--library/cpp/monlib/service/pages/pre_mon_page.h2
-rw-r--r--library/cpp/monlib/service/pages/templates.cpp36
-rw-r--r--library/cpp/monlib/service/pages/templates.h116
-rw-r--r--library/cpp/sliding_window/sliding_window.h30
-rw-r--r--library/cpp/sliding_window/sliding_window_ut.cpp10
-rw-r--r--library/cpp/testing/common/env.h4
-rw-r--r--library/cpp/testing/unittest/tests_data.h38
-rw-r--r--library/cpp/uri/common.h6
-rw-r--r--library/cpp/uri/uri.cpp2
-rw-r--r--library/cpp/uri/uri.h2
66 files changed, 756 insertions, 756 deletions
diff --git a/library/cpp/actors/core/actor.h b/library/cpp/actors/core/actor.h
index 2c881921a2..ed29bd14b9 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 d927aedc3a..c58698a206 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 47373078df..40499d7586 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 914b24212e..980b7d767b 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 c52761c73d..d7546b901a 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 be55e8ed78..702cf50fad 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 c77a329aa6..4dce16939a 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 6c843dd57b..26f3c65013 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 0117acb970..5f63b5af58 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 550cdb561c..c11a7cf3c1 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, 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, std::move(str));
}
}
diff --git a/library/cpp/actors/core/log_iface.h b/library/cpp/actors/core/log_iface.h
index 7fbf38c6d6..b331db9ca8 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)
+ 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(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 1b76f83cbc..f52f2fc5d2 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 4676da0dee..7fe4504edd 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 3c050bad2a..c450f2338e 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 61ebcabc9c..0e1dbd0031 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 19d643ecce..880a9d00db 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 8bf77444f7..3313a251a1 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 c49c37b230..145e97dc57 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 43ad640dd6..0fdb0fab10 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 2c31d5190a..d8771179de 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 1e8e9323cf..074adc6e74 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 781fe10084..ae106ed180 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 ce60468720..37488c3962 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 9bcbf340fc..7d89c33b51 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 a8a59f9e7f..737c7fbc18 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
diff --git a/library/cpp/containers/intrusive_avl_tree/avltree.h b/library/cpp/containers/intrusive_avl_tree/avltree.h
index e5683f3315..a58c63b07c 100644
--- a/library/cpp/containers/intrusive_avl_tree/avltree.h
+++ b/library/cpp/containers/intrusive_avl_tree/avltree.h
@@ -247,7 +247,7 @@ public:
return nullptr;
}
-
+
inline T* LowerBound(const TTreeItem* el) const noexcept {
TTreeItem* curEl = Root_;
TTreeItem* lowerBound = nullptr;
@@ -260,9 +260,9 @@ public:
curEl = curEl->Right_;
} else {
return AsT(curEl);
- }
- }
-
+ }
+ }
+
return AsT(lowerBound);
}
diff --git a/library/cpp/containers/intrusive_avl_tree/ut/avltree_ut.cpp b/library/cpp/containers/intrusive_avl_tree/ut/avltree_ut.cpp
index bb258ac078..cab2365cce 100644
--- a/library/cpp/containers/intrusive_avl_tree/ut/avltree_ut.cpp
+++ b/library/cpp/containers/intrusive_avl_tree/ut/avltree_ut.cpp
@@ -1,66 +1,66 @@
#include <library/cpp/testing/unittest/registar.h>
-
+
#include <library/cpp/containers/intrusive_avl_tree/avltree.h>
-
-class TAvlTreeTest: public TTestBase {
+
+class TAvlTreeTest: public TTestBase {
UNIT_TEST_SUITE(TAvlTreeTest);
UNIT_TEST(TestLowerBound);
UNIT_TEST(TestIterator);
UNIT_TEST_SUITE_END();
-
+
private:
void TestLowerBound();
void TestIterator();
-
+
class TIt;
struct TItCompare {
static inline bool Compare(const TIt& l, const TIt& r) noexcept;
};
-
+
class TIt: public TAvlTreeItem<TIt, TItCompare> {
public:
TIt(int val = 0)
: Val(val)
{
}
-
+
int Val;
};
-
+
using TIts = TAvlTree<TIt, TItCompare>;
-};
-
+};
+
inline bool TAvlTreeTest::TItCompare::Compare(const TIt& l, const TIt& r) noexcept {
- return l.Val < r.Val;
-}
-
-UNIT_TEST_SUITE_REGISTRATION(TAvlTreeTest);
-
-void TAvlTreeTest::TestLowerBound() {
- TIts its;
- TIt it1(5);
- TIt it2(2);
- TIt it3(10);
- TIt it4(879);
- TIt it5(1);
- TIt it6(52);
- TIt it7(4);
- TIt it8(5);
- its.Insert(&it1);
- its.Insert(&it2);
- its.Insert(&it3);
- its.Insert(&it4);
- its.Insert(&it5);
- its.Insert(&it6);
- its.Insert(&it7);
- its.Insert(&it8);
-
- TIt it_zero(0);
- TIt it_large(1000);
- UNIT_ASSERT_EQUAL(its.LowerBound(&it3), &it3);
- UNIT_ASSERT_EQUAL(its.LowerBound(&it_zero), &it5);
+ return l.Val < r.Val;
+}
+
+UNIT_TEST_SUITE_REGISTRATION(TAvlTreeTest);
+
+void TAvlTreeTest::TestLowerBound() {
+ TIts its;
+ TIt it1(5);
+ TIt it2(2);
+ TIt it3(10);
+ TIt it4(879);
+ TIt it5(1);
+ TIt it6(52);
+ TIt it7(4);
+ TIt it8(5);
+ its.Insert(&it1);
+ its.Insert(&it2);
+ its.Insert(&it3);
+ its.Insert(&it4);
+ its.Insert(&it5);
+ its.Insert(&it6);
+ its.Insert(&it7);
+ its.Insert(&it8);
+
+ TIt it_zero(0);
+ TIt it_large(1000);
+ UNIT_ASSERT_EQUAL(its.LowerBound(&it3), &it3);
+ UNIT_ASSERT_EQUAL(its.LowerBound(&it_zero), &it5);
UNIT_ASSERT_EQUAL(its.LowerBound(&it_large), nullptr);
-}
+}
void TAvlTreeTest::TestIterator() {
TIts its;
diff --git a/library/cpp/grpc/client/ya.make b/library/cpp/grpc/client/ya.make
index 0c02efdd87..a4e74b067c 100644
--- a/library/cpp/grpc/client/ya.make
+++ b/library/cpp/grpc/client/ya.make
@@ -1,9 +1,9 @@
LIBRARY()
-OWNER(
- ddoarn
+OWNER(
+ ddoarn
g:kikimr
-)
+)
SRCS(
grpc_client_low.cpp
diff --git a/library/cpp/http/fetch/httpfsm.rl6 b/library/cpp/http/fetch/httpfsm.rl6
index 2807b7ff46..eab0328b18 100644
--- a/library/cpp/http/fetch/httpfsm.rl6
+++ b/library/cpp/http/fetch/httpfsm.rl6
@@ -5,7 +5,7 @@
#include <library/cpp/charset/codepage.h>
#include <library/cpp/http/misc/httpcodes.h>
#include <util/datetime/base.h>
-#include <util/generic/ylimits.h>
+#include <util/generic/ylimits.h>
#include <algorithm> // max
#include <library/cpp/http/fetch/httpheader.h>
diff --git a/library/cpp/http/io/stream.cpp b/library/cpp/http/io/stream.cpp
index 98434dc7a2..6689be684f 100644
--- a/library/cpp/http/io/stream.cpp
+++ b/library/cpp/http/io/stream.cpp
@@ -73,8 +73,8 @@ namespace {
for (TPtr* cur = Beg_; cur != end; ++cur) {
f(*cur);
}
- }
-
+ }
+
TPtr Top() {
const TPtr* end = T_ + N;
return end == Beg_ ? nullptr : *Beg_;
diff --git a/library/cpp/http/io/stream_ut.cpp b/library/cpp/http/io/stream_ut.cpp
index c7749eb5fd..1ea35df675 100644
--- a/library/cpp/http/io/stream_ut.cpp
+++ b/library/cpp/http/io/stream_ut.cpp
@@ -315,15 +315,15 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {
TBufferedOutput bufOut(&strOut, 8192);
TTeeOutput teeOut(&bufOut, &checkOut);
THttpOutput httpOut(&teeOut);
-
+
httpOut.EnableKeepAlive(true);
httpOut.EnableCompression(true);
-
+
const char* header = "POST / HTTP/1.1\r\nHost: yandex.ru\r\n\r\n";
httpOut << header;
-
+
UNIT_ASSERT_VALUES_EQUAL(str.size(), 0u);
-
+
const char* body = "<html>Hello</html>";
httpOut << body;
UNIT_ASSERT_VALUES_EQUAL(str.size(), 0u);
diff --git a/library/cpp/http/misc/httpcodes.cpp b/library/cpp/http/misc/httpcodes.cpp
index b2aab8a001..ad8c80ac1e 100644
--- a/library/cpp/http/misc/httpcodes.cpp
+++ b/library/cpp/http/misc/httpcodes.cpp
@@ -46,7 +46,7 @@ TStringBuf HttpCodeStrEx(int code) noexcept {
return TStringBuf("307 Temporarily redirect");
case HTTP_PERMANENT_REDIRECT:
return TStringBuf("308 Permanent redirect");
-
+
case HTTP_BAD_REQUEST:
return TStringBuf("400 Bad request");
case HTTP_UNAUTHORIZED:
@@ -134,7 +134,7 @@ TStringBuf HttpCodeStrEx(int code) noexcept {
return TStringBuf("511 Network Authentication Required");
case HTTP_UNASSIGNED_512:
return TStringBuf("512 Unassigned");
-
+
default:
return TStringBuf("000 Unknown HTTP code");
}
diff --git a/library/cpp/lfalloc/lf_allocX64.cpp b/library/cpp/lfalloc/lf_allocX64.cpp
index 7837772208..2eb90761fe 100644
--- a/library/cpp/lfalloc/lf_allocX64.cpp
+++ b/library/cpp/lfalloc/lf_allocX64.cpp
@@ -128,7 +128,7 @@ NMalloc::TMallocInfo NMalloc::MallocInfo() {
r.Name = "lfalloc_dbg";
#elif defined(LFALLOC_YT)
r.Name = "lfalloc_yt";
-#else
+#else
r.Name = "lfalloc";
#endif
r.SetParam = &LFAlloc_SetParam;
@@ -136,9 +136,9 @@ NMalloc::TMallocInfo NMalloc::MallocInfo() {
return r;
}
#else
-NMalloc::TMallocInfo NMalloc::MallocInfo() {
- NMalloc::TMallocInfo r;
- r.Name = "system-darwin";
- return r;
-}
+NMalloc::TMallocInfo NMalloc::MallocInfo() {
+ NMalloc::TMallocInfo r;
+ r.Name = "system-darwin";
+ return r;
+}
#endif
diff --git a/library/cpp/logger/log.cpp b/library/cpp/logger/log.cpp
index 21643afdc7..e1d70cc3d2 100644
--- a/library/cpp/logger/log.cpp
+++ b/library/cpp/logger/log.cpp
@@ -162,16 +162,16 @@ void TLog::AddLog(const char* format, ...) const {
}
void TLog::AddLog(ELogPriority priority, const char* format, ...) const {
- va_list args;
- va_start(args, format);
-
+ va_list args;
+ va_start(args, format);
+
Y_DEFER {
- va_end(args);
+ va_end(args);
};
-
+
Impl_->AddLog(priority, format, args);
-}
-
+}
+
void TLog::AddLogVAList(const char* format, va_list lst) {
Impl_->AddLog(Impl_->DefaultPriority(), format, lst);
}
@@ -233,8 +233,8 @@ void TLog::Write(ELogPriority priority, const char* data, size_t len) const {
} else {
Impl_->WriteData(priority, data, len);
}
-}
-
+}
+
void TLog::Write(ELogPriority priority, const TStringBuf data) const {
Write(priority, data.data(), data.size());
}
diff --git a/library/cpp/logger/null.h b/library/cpp/logger/null.h
index 1d6130b7f7..a02f250b00 100644
--- a/library/cpp/logger/null.h
+++ b/library/cpp/logger/null.h
@@ -1,7 +1,7 @@
#pragma once
#include "backend.h"
-
+
class TNullLogBackend: public TLogBackend {
public:
TNullLogBackend();
diff --git a/library/cpp/logger/priority.h b/library/cpp/logger/priority.h
index 5696fde561..d2a9fa0a07 100644
--- a/library/cpp/logger/priority.h
+++ b/library/cpp/logger/priority.h
@@ -10,6 +10,6 @@ enum ELogPriority {
TLOG_INFO = 6 /* "INFO" */,
TLOG_DEBUG = 7 /* "DEBUG" */,
TLOG_RESOURCES = 8 /* "RESOURCES" */
-};
+};
#define LOG_MAX_PRIORITY TLOG_RESOURCES
#define LOG_DEF_PRIORITY TLOG_INFO
diff --git a/library/cpp/logger/stream.h b/library/cpp/logger/stream.h
index 044219ca7f..feb240afcb 100644
--- a/library/cpp/logger/stream.h
+++ b/library/cpp/logger/stream.h
@@ -1,7 +1,7 @@
#pragma once
#include "backend.h"
-
+
class IOutputStream;
class TStreamLogBackend: public TLogBackend {
diff --git a/library/cpp/logger/system.cpp b/library/cpp/logger/system.cpp
index f2b58fcc82..42233f63d2 100644
--- a/library/cpp/logger/system.cpp
+++ b/library/cpp/logger/system.cpp
@@ -14,11 +14,11 @@
#include "record.h"
#include "stream.h"
-TSysLogBackend::TSysLogBackend(const char* ident, EFacility facility, int flags)
- : Ident(ident)
- , Facility(facility)
- , Flags(flags)
-{
+TSysLogBackend::TSysLogBackend(const char* ident, EFacility facility, int flags)
+ : Ident(ident)
+ , Facility(facility)
+ , Flags(flags)
+{
#if defined(_unix_)
Y_ASSERT(TSYSLOG_LOCAL0 <= facility && facility <= TSYSLOG_LOCAL7);
@@ -43,34 +43,34 @@ TSysLogBackend::TSysLogBackend(const char* ident, EFacility facility, int flags)
}
openlog(Ident.data(), sysflags, f2sf[(size_t)facility]);
-#endif
-}
-
+#endif
+}
+
TSysLogBackend::~TSysLogBackend() {
#if defined(_unix_)
- closelog();
-#endif
-}
-
+ closelog();
+#endif
+}
+
void TSysLogBackend::WriteData(const TLogRecord& rec) {
#if defined(_unix_)
syslog(ELogPriority2SyslogPriority(rec.Priority), "%.*s", (int)rec.Len, rec.Data);
#else
Y_UNUSED(rec);
-#endif
-}
-
-void TSysLogBackend::ReopenLog() {
-}
-
+#endif
+}
+
+void TSysLogBackend::ReopenLog() {
+}
+
int TSysLogBackend::ELogPriority2SyslogPriority(ELogPriority priority) {
#if defined(_unix_)
return Min(int(priority), (int)LOG_PRIMASK);
#else
- // trivial conversion
- return int(priority);
+ // trivial conversion
+ return int(priority);
#endif
-}
+}
namespace {
class TSysLogInstance: public TLog {
diff --git a/library/cpp/logger/system.h b/library/cpp/logger/system.h
index 9c7c142907..b8c60b3023 100644
--- a/library/cpp/logger/system.h
+++ b/library/cpp/logger/system.h
@@ -12,10 +12,10 @@
(ident) ? (TLogBackend*)(new TSysLogBackend((ident), (facility), (flags))) : (TLogBackend*)(new TNullLogBackend())));\
} \
} Y_CAT(loginit, __LINE__);
-
+
#define YSYSLOGINIT(ident, facility) YSYSLOGINIT_FLAGS((ident), (facility), 0)
-
-class TSysLogBackend: public TLogBackend {
+
+class TSysLogBackend: public TLogBackend {
public:
enum EFacility {
TSYSLOG_LOCAL0 = 0,
@@ -27,7 +27,7 @@ public:
TSYSLOG_LOCAL6 = 6,
TSYSLOG_LOCAL7 = 7
};
-
+
enum EFlags {
LogPerror = 1,
LogCons = 2
@@ -35,30 +35,30 @@ public:
TSysLogBackend(const char* ident, EFacility facility, int flags = 0);
~TSysLogBackend() override;
-
+
void WriteData(const TLogRecord& rec) override;
void ReopenLog() override;
-
+
virtual TString GetIdent() const {
return Ident;
}
-
+
virtual EFacility GetFacility() const {
return Facility;
}
-
+
virtual int GetFlags() const {
return Flags;
}
-
+
protected:
int ELogPriority2SyslogPriority(ELogPriority priority);
-
+
TString Ident;
EFacility Facility;
int Flags;
-};
-
+};
+
/*
* return system-wide logger instance
* better do not use in real programs(instead of robot, of course)
diff --git a/library/cpp/lwtrace/example5/lwtrace_example5.cpp b/library/cpp/lwtrace/example5/lwtrace_example5.cpp
index 11aee7568f..1c324473c2 100644
--- a/library/cpp/lwtrace/example5/lwtrace_example5.cpp
+++ b/library/cpp/lwtrace/example5/lwtrace_example5.cpp
@@ -5,7 +5,7 @@ template <ui64 N>
ui64 Fact() {
ui64 result = N * Fact<N - 1>();
-#ifndef LWTRACE_DISABLE
+#ifndef LWTRACE_DISABLE
// Note that probe is create on the first pass
// LWTRACE_DECLARE_PROVIDER and LWTRACE_DEFINE_PROVIDER are not needed
// (Provider is created implicitly)
@@ -13,7 +13,7 @@ ui64 Fact() {
"LWTRACE_EXAMPLE_PROVIDER", "FactProbe_" + ToString(N), {}, {"result"});
LWPROBE_OBJ(factProbe, result);
-#endif // LWTRACE_DISABLE
+#endif // LWTRACE_DISABLE
return result;
}
diff --git a/library/cpp/lwtrace/protos/ya.make b/library/cpp/lwtrace/protos/ya.make
index f6e4695ad5..503d5e515f 100644
--- a/library/cpp/lwtrace/protos/ya.make
+++ b/library/cpp/lwtrace/protos/ya.make
@@ -1,7 +1,7 @@
PROTO_LIBRARY()
OWNER(serxa)
-
+
INCLUDE_TAGS(GO_PROTO)
SRCS(
diff --git a/library/cpp/lwtrace/ya.make b/library/cpp/lwtrace/ya.make
index dde958803c..d9accb3006 100644
--- a/library/cpp/lwtrace/ya.make
+++ b/library/cpp/lwtrace/ya.make
@@ -1,7 +1,7 @@
LIBRARY()
OWNER(serxa)
-
+
PEERDIR(
library/cpp/lwtrace/protos
)
diff --git a/library/cpp/messagebus/network.cpp b/library/cpp/messagebus/network.cpp
index a8dc5f6155..304bedae5a 100644
--- a/library/cpp/messagebus/network.cpp
+++ b/library/cpp/messagebus/network.cpp
@@ -10,7 +10,7 @@ using namespace NBus;
using namespace NBus::NPrivate;
namespace {
- TBindResult BindOnPortProto(int port, int af, bool reusePort) {
+ TBindResult BindOnPortProto(int port, int af, bool reusePort) {
Y_VERIFY(af == AF_INET || af == AF_INET6, "wrong af");
SOCKET fd = ::socket(af, SOCK_STREAM, 0);
@@ -24,17 +24,17 @@ namespace {
ythrow TSystemError() << "failed to setsockopt SO_REUSEADDR";
}
-#ifdef SO_REUSEPORT
- if (reusePort) {
- int r = SetSockOpt(fd, SOL_SOCKET, SO_REUSEPORT, one);
- if (r < 0) {
- ythrow TSystemError() << "failed to setsockopt SO_REUSEPORT";
- }
- }
-#else
- Y_UNUSED(reusePort);
-#endif
-
+#ifdef SO_REUSEPORT
+ if (reusePort) {
+ int r = SetSockOpt(fd, SOL_SOCKET, SO_REUSEPORT, one);
+ if (r < 0) {
+ ythrow TSystemError() << "failed to setsockopt SO_REUSEPORT";
+ }
+ }
+#else
+ Y_UNUSED(reusePort);
+#endif
+
THolder<TOpaqueAddr> addr(new TOpaqueAddr);
sockaddr* sa = addr->MutableAddr();
sa->sa_family = af;
@@ -73,7 +73,7 @@ namespace {
return r;
}
- TMaybe<TBindResult> TryBindOnPortProto(int port, int af, bool reusePort) {
+ TMaybe<TBindResult> TryBindOnPortProto(int port, int af, bool reusePort) {
try {
return {BindOnPortProto(port, af, reusePort)};
} catch (const TSystemError&) {
@@ -93,23 +93,23 @@ namespace {
}
}
-std::pair<unsigned, TVector<TBindResult>> NBus::BindOnPort(int port, bool reusePort) {
+std::pair<unsigned, TVector<TBindResult>> NBus::BindOnPort(int port, bool reusePort) {
std::pair<unsigned, TVector<TBindResult>> r;
r.second.reserve(2);
if (port != 0) {
- return AggregateBindResults(BindOnPortProto(port, AF_INET, reusePort),
+ return AggregateBindResults(BindOnPortProto(port, AF_INET, reusePort),
BindOnPortProto(port, AF_INET6, reusePort));
}
// use nothrow versions in cycle
for (int i = 0; i < 1000; ++i) {
- TMaybe<TBindResult> in4 = TryBindOnPortProto(0, AF_INET, reusePort);
+ TMaybe<TBindResult> in4 = TryBindOnPortProto(0, AF_INET, reusePort);
if (!in4) {
continue;
}
- TMaybe<TBindResult> in6 = TryBindOnPortProto(in4->Addr.GetPort(), AF_INET6, reusePort);
+ TMaybe<TBindResult> in6 = TryBindOnPortProto(in4->Addr.GetPort(), AF_INET6, reusePort);
if (!in6) {
continue;
}
@@ -117,8 +117,8 @@ std::pair<unsigned, TVector<TBindResult>> NBus::BindOnPort(int port, bool reuseP
return AggregateBindResults(std::move(*in4), std::move(*in6));
}
- TBindResult in4 = BindOnPortProto(0, AF_INET, reusePort);
- TBindResult in6 = BindOnPortProto(in4.Addr.GetPort(), AF_INET6, reusePort);
+ TBindResult in4 = BindOnPortProto(0, AF_INET, reusePort);
+ TBindResult in6 = BindOnPortProto(in4.Addr.GetPort(), AF_INET6, reusePort);
return AggregateBindResults(std::move(in4), std::move(in6));
}
diff --git a/library/cpp/messagebus/network_ut.cpp b/library/cpp/messagebus/network_ut.cpp
index d984284bd2..f1798419db 100644
--- a/library/cpp/messagebus/network_ut.cpp
+++ b/library/cpp/messagebus/network_ut.cpp
@@ -37,7 +37,7 @@ Y_UNIT_TEST_SUITE(Network) {
return;
}
- TVector<TBindResult> r = BindOnPort(FixedPort, false).second;
+ TVector<TBindResult> r = BindOnPort(FixedPort, false).second;
UNIT_ASSERT_VALUES_EQUAL(size_t(2), r.size());
for (TVector<TBindResult>::iterator i = r.begin(); i != r.end(); ++i) {
@@ -46,7 +46,7 @@ Y_UNIT_TEST_SUITE(Network) {
}
Y_UNIT_TEST(BindOnPortRandom) {
- TVector<TBindResult> r = BindOnPort(0, false).second;
+ TVector<TBindResult> r = BindOnPort(0, false).second;
UNIT_ASSERT_VALUES_EQUAL(size_t(2), r.size());
for (TVector<TBindResult>::iterator i = r.begin(); i != r.end(); ++i) {
@@ -58,8 +58,8 @@ Y_UNIT_TEST_SUITE(Network) {
}
Y_UNIT_TEST(BindOnBusyPort) {
- auto r = BindOnPort(0, false);
+ auto r = BindOnPort(0, false);
- UNIT_ASSERT_EXCEPTION_CONTAINS(BindOnPort(r.first, false), TSystemError, "failed to bind on port " + ToString(r.first));
+ UNIT_ASSERT_EXCEPTION_CONTAINS(BindOnPort(r.first, false), TSystemError, "failed to bind on port " + ToString(r.first));
}
}
diff --git a/library/cpp/messagebus/session_impl.cpp b/library/cpp/messagebus/session_impl.cpp
index 64c9c7e81e..ddf9f360c4 100644
--- a/library/cpp/messagebus/session_impl.cpp
+++ b/library/cpp/messagebus/session_impl.cpp
@@ -484,7 +484,7 @@ void TBusSessionImpl::Act(TConnectionTag) {
}
void TBusSessionImpl::Listen(int port, TBusMessageQueue* q) {
- Listen(BindOnPort(port, Config.ReusePort).second, q);
+ Listen(BindOnPort(port, Config.ReusePort).second, q);
}
void TBusSessionImpl::Listen(const TVector<TBindResult>& bindTo, TBusMessageQueue* q) {
diff --git a/library/cpp/messagebus/test/helper/hanging_server.cpp b/library/cpp/messagebus/test/helper/hanging_server.cpp
index ce09e75273..a35514b00d 100644
--- a/library/cpp/messagebus/test/helper/hanging_server.cpp
+++ b/library/cpp/messagebus/test/helper/hanging_server.cpp
@@ -5,7 +5,7 @@
using namespace NBus;
THangingServer::THangingServer(int port) {
- BindResult = BindOnPort(port, false);
+ BindResult = BindOnPort(port, false);
}
int THangingServer::GetPort() const {
diff --git a/library/cpp/mime/types/mime.h b/library/cpp/mime/types/mime.h
index 9b0fcb06da..05da389ea9 100644
--- a/library/cpp/mime/types/mime.h
+++ b/library/cpp/mime/types/mime.h
@@ -31,7 +31,7 @@ enum MimeTypes {
MIME_ODT = 17,
MIME_ODP = 18,
MIME_ODS = 19,
- //MIME_XHTMLXML = 20,
+ //MIME_XHTMLXML = 20,
MIME_IMAGE_BMP = 21,
MIME_WAV = 22,
MIME_ARCHIVE = 23,
@@ -40,7 +40,7 @@ enum MimeTypes {
MIME_GZIP = 26,
MIME_XLSX = 27,
MIME_PPTX = 28,
- MIME_JAVASCRIPT = 29,
+ MIME_JAVASCRIPT = 29,
MIME_EPUB = 30,
MIME_TEX = 31,
MIME_JSON = 32,
diff --git a/library/cpp/monlib/counters/counters.cpp b/library/cpp/monlib/counters/counters.cpp
index 318c99ad38..50dca4c577 100644
--- a/library/cpp/monlib/counters/counters.cpp
+++ b/library/cpp/monlib/counters/counters.cpp
@@ -1,31 +1,31 @@
-
-#include "counters.h"
-
-namespace NMonitoring {
+
+#include "counters.h"
+
+namespace NMonitoring {
char* PrettyNumShort(i64 val, char* buf, size_t size) {
static const char shorts[] = {' ', 'K', 'M', 'G', 'T', 'P', 'E'};
- unsigned i = 0;
- i64 major = val;
- i64 minor = 0;
+ unsigned i = 0;
+ i64 major = val;
+ i64 minor = 0;
const unsigned imax = sizeof(shorts) / sizeof(char);
for (i = 0; i < imax; i++) {
- if (major >> 10 == 0)
- break;
- else {
+ if (major >> 10 == 0)
+ break;
+ else {
minor = major - (major >> 10 << 10);
- major = major >> 10;
- }
- }
+ major = major >> 10;
+ }
+ }
minor = (minor * 10) >> 10;
-
+
if (i == 0 || i >= imax)
- *buf = '\0';
- else
+ *buf = '\0';
+ else
snprintf(buf, size, "%" PRId64 ".%" PRId64 "%c", major, minor, shorts[i]);
-
- return buf;
- }
-
+
+ return buf;
+ }
+
char* PrettyNum(i64 val, char* buf, size_t size) {
Y_ASSERT(buf);
if (size < 4) {
diff --git a/library/cpp/monlib/counters/counters.h b/library/cpp/monlib/counters/counters.h
index 3492231282..038b55f0c8 100644
--- a/library/cpp/monlib/counters/counters.h
+++ b/library/cpp/monlib/counters/counters.h
@@ -21,7 +21,7 @@
namespace NMonitoring {
#define BEGIN_OUTPUT_COUNTERS \
void OutputImpl(IOutputStream& out) { \
- char prettyBuf[32];
+ char prettyBuf[32];
#define END_OUTPUT_COUNTERS \
out.Flush(); \
}
@@ -31,7 +31,7 @@ namespace NMonitoring {
char* PrettyNumShort(i64 val, char* buf, size_t size);
char* PrettyNum(i64 val, char* buf, size_t size);
-
+
// This class is deprecated. Please consider to use
// library/cpp/monlib/metrics instead. See more info at
// https://wiki.yandex-team.ru/solomon/libs/monlib_cpp/
diff --git a/library/cpp/monlib/dynamic_counters/counters.cpp b/library/cpp/monlib/dynamic_counters/counters.cpp
index 2d7d0954d6..3635d87d0d 100644
--- a/library/cpp/monlib/dynamic_counters/counters.cpp
+++ b/library/cpp/monlib/dynamic_counters/counters.cpp
@@ -127,13 +127,13 @@ TIntrusivePtr<TDynamicCounters> TDynamicCounters::GetSubgroup(const TString& nam
}
return res;
}
-
+
TIntrusivePtr<TDynamicCounters> TDynamicCounters::FindSubgroup(const TString& name, const TString& value) const {
TReadGuard g(Lock);
const auto it = Counters.find({name, value});
return it != Counters.end() ? AsDynamicCounters(it->second) : nullptr;
-}
-
+}
+
void TDynamicCounters::RemoveSubgroup(const TString& name, const TString& value) {
auto g = LockForUpdate("RemoveSubgroup", name, value);
if (const auto it = Counters.find({name, value}); it != Counters.end() && AsDynamicCounters(it->second)) {
@@ -189,8 +189,8 @@ void TDynamicCounters::OutputHtml(IOutputStream& os) const {
OutputPlainText(os);
}
}
-}
-
+}
+
void TDynamicCounters::EnumerateSubgroups(const std::function<void(const TString& name, const TString& value)>& output) const {
TReadGuard g(Lock);
for (const auto& [key, value] : Counters) {
@@ -202,24 +202,24 @@ void TDynamicCounters::EnumerateSubgroups(const std::function<void(const TString
void TDynamicCounters::OutputPlainText(IOutputStream& os, const TString& indent) const {
auto snap = ReadSnapshot();
- // mark private records in plain text output
- auto outputVisibilityMarker = [] (EVisibility vis) {
- return vis == EVisibility::Private ? "\t[PRIVATE]" : "";
- };
+ // mark private records in plain text output
+ auto outputVisibilityMarker = [] (EVisibility vis) {
+ return vis == EVisibility::Private ? "\t[PRIVATE]" : "";
+ };
for (const auto& [key, value] : snap) {
if (const auto counter = AsCounter(value)) {
os << indent
<< key.LabelName << '=' << key.LabelValue
<< ": " << counter->Val()
- << outputVisibilityMarker(counter->Visibility())
+ << outputVisibilityMarker(counter->Visibility())
<< '\n';
} else if (const auto histogram = AsHistogram(value)) {
os << indent
<< key.LabelName << '=' << key.LabelValue
- << ":"
- << outputVisibilityMarker(histogram->Visibility())
- << "\n";
+ << ":"
+ << outputVisibilityMarker(histogram->Visibility())
+ << "\n";
auto snapshot = histogram->Snapshot();
for (ui32 i = 0, count = snapshot->Count(); i < count; i++) {
diff --git a/library/cpp/monlib/dynamic_counters/page.h b/library/cpp/monlib/dynamic_counters/page.h
index 0f1091360a..1f0ef6a5ea 100644
--- a/library/cpp/monlib/dynamic_counters/page.h
+++ b/library/cpp/monlib/dynamic_counters/page.h
@@ -31,7 +31,7 @@ namespace NMonitoring {
const TString& title,
TIntrusivePtr<TDynamicCounters> counters,
TOutputCallback outputCallback = nullptr)
- : TPreMonPage(path, title)
+ : TPreMonPage(path, title)
, Counters(counters)
, OutputCallback(outputCallback)
{
diff --git a/library/cpp/monlib/dynamic_counters/percentile/percentile_base.h b/library/cpp/monlib/dynamic_counters/percentile/percentile_base.h
index 1500ab4c9a..d3c825c43d 100644
--- a/library/cpp/monlib/dynamic_counters/percentile/percentile_base.h
+++ b/library/cpp/monlib/dynamic_counters/percentile/percentile_base.h
@@ -16,20 +16,20 @@ struct TPercentileBase : public TThrRefBase {
TPercentiles Percentiles;
- void Initialize(const TIntrusivePtr<NMonitoring::TDynamicCounters> &counters, const TVector<float> &thresholds,
- TCountableBase::EVisibility visibility = TCountableBase::EVisibility::Public) {
+ void Initialize(const TIntrusivePtr<NMonitoring::TDynamicCounters> &counters, const TVector<float> &thresholds,
+ TCountableBase::EVisibility visibility = TCountableBase::EVisibility::Public) {
Percentiles.reserve(thresholds.size());
for (size_t i = 0; i < thresholds.size(); ++i) {
Percentiles.emplace_back(thresholds[i],
- counters->GetNamedCounter("percentile", Sprintf("%.1f", thresholds[i] * 100.f), false, visibility));
+ counters->GetNamedCounter("percentile", Sprintf("%.1f", thresholds[i] * 100.f), false, visibility));
}
}
void Initialize(const TIntrusivePtr<NMonitoring::TDynamicCounters> &counters, TString group, TString subgroup,
- TString name, const TVector<float> &thresholds,
- TCountableBase::EVisibility visibility = TCountableBase::EVisibility::Public) {
+ TString name, const TVector<float> &thresholds,
+ TCountableBase::EVisibility visibility = TCountableBase::EVisibility::Public) {
auto subCounters = counters->GetSubgroup(group, subgroup)->GetSubgroup("sensor", name);
- Initialize(subCounters, thresholds, visibility);
+ Initialize(subCounters, thresholds, visibility);
}
};
diff --git a/library/cpp/monlib/service/monservice.cpp b/library/cpp/monlib/service/monservice.cpp
index 13d64c2937..d1b9cda1d2 100644
--- a/library/cpp/monlib/service/monservice.cpp
+++ b/library/cpp/monlib/service/monservice.cpp
@@ -113,7 +113,7 @@ void TMonService2::Register(TMonPagePtr page) {
}
TIndexMonPage* TMonService2::RegisterIndexPage(const TString& path, const TString& title) {
- return IndexMonPage->RegisterIndexPage(path, title);
+ return IndexMonPage->RegisterIndexPage(path, title);
}
IMonPage* TMonService2::FindPage(const TString& relativePath) {
diff --git a/library/cpp/monlib/service/pages/html_mon_page.cpp b/library/cpp/monlib/service/pages/html_mon_page.cpp
index 26c9a69334..eb4eb3b66c 100644
--- a/library/cpp/monlib/service/pages/html_mon_page.cpp
+++ b/library/cpp/monlib/service/pages/html_mon_page.cpp
@@ -24,14 +24,14 @@ void THtmlMonPage::Output(NMonitoring::IMonHttpRequest& request) {
out << "<script language='javascript' type='text/javascript' src='/jquery.tablesorter.js'></script>\n";
}
- out << "<style type=\"text/css\">\n";
- out << ".table-nonfluid { width: auto; }\n";
- out << ".narrow-line50 {line-height: 50%}\n";
- out << ".narrow-line60 {line-height: 60%}\n";
- out << ".narrow-line70 {line-height: 70%}\n";
- out << ".narrow-line80 {line-height: 80%}\n";
- out << ".narrow-line90 {line-height: 90%}\n";
- out << "</style>\n";
+ out << "<style type=\"text/css\">\n";
+ out << ".table-nonfluid { width: auto; }\n";
+ out << ".narrow-line50 {line-height: 50%}\n";
+ out << ".narrow-line60 {line-height: 60%}\n";
+ out << ".narrow-line70 {line-height: 70%}\n";
+ out << ".narrow-line80 {line-height: 80%}\n";
+ out << ".narrow-line90 {line-height: 90%}\n";
+ out << "</style>\n";
}
BODY() {
OutputNavBar(out);
diff --git a/library/cpp/monlib/service/pages/index_mon_page.cpp b/library/cpp/monlib/service/pages/index_mon_page.cpp
index fb41f468a6..83ff8b529a 100644
--- a/library/cpp/monlib/service/pages/index_mon_page.cpp
+++ b/library/cpp/monlib/service/pages/index_mon_page.cpp
@@ -67,19 +67,19 @@ void TIndexMonPage::OutputIndex(IOutputStream& out, bool pathEndsWithSlash) {
void TIndexMonPage::Register(TMonPagePtr page) {
TGuard<TMutex> g(Mtx);
- auto insres = PagesByPath.insert(std::make_pair("/" + page->GetPath(), page));
- if (insres.second) {
- // new unique page just inserted, update Pages
- Pages.push_back(page);
- } else {
- // a page with the given path is already present, replace it with the new page
-
- // find old page, sorry for O(n)
- auto it = std::find(Pages.begin(), Pages.end(), insres.first->second);
- *it = page;
- // this already present, replace it
- insres.first->second = page;
- }
+ auto insres = PagesByPath.insert(std::make_pair("/" + page->GetPath(), page));
+ if (insres.second) {
+ // new unique page just inserted, update Pages
+ Pages.push_back(page);
+ } else {
+ // a page with the given path is already present, replace it with the new page
+
+ // find old page, sorry for O(n)
+ auto it = std::find(Pages.begin(), Pages.end(), insres.first->second);
+ *it = page;
+ // this already present, replace it
+ insres.first->second = page;
+ }
page->Parent = this;
}
@@ -90,7 +90,7 @@ TIndexMonPage* TIndexMonPage::RegisterIndexPage(const TString& path, const TStri
return page;
}
page = new TIndexMonPage(path, title);
- Register(page);
+ Register(page);
return VerifyDynamicCast<TIndexMonPage*>(page);
}
diff --git a/library/cpp/monlib/service/pages/pre_mon_page.cpp b/library/cpp/monlib/service/pages/pre_mon_page.cpp
index 6db90243ee..fc03a19b80 100644
--- a/library/cpp/monlib/service/pages/pre_mon_page.cpp
+++ b/library/cpp/monlib/service/pages/pre_mon_page.cpp
@@ -4,14 +4,14 @@ using namespace NMonitoring;
void TPreMonPage::OutputContent(NMonitoring::IMonHttpRequest& request) {
auto& out = request.Output();
- if (PreTag) {
+ if (PreTag) {
BeforePre(request);
out << "<pre>\n";
OutputText(out, request);
out << "</pre>\n";
- } else {
+ } else {
OutputText(out, request);
- }
+ }
}
void TPreMonPage::BeforePre(NMonitoring::IMonHttpRequest&) {
diff --git a/library/cpp/monlib/service/pages/pre_mon_page.h b/library/cpp/monlib/service/pages/pre_mon_page.h
index 281e625de3..c9a923d39a 100644
--- a/library/cpp/monlib/service/pages/pre_mon_page.h
+++ b/library/cpp/monlib/service/pages/pre_mon_page.h
@@ -23,5 +23,5 @@ namespace NMonitoring {
const bool PreTag;
};
-
+
}
diff --git a/library/cpp/monlib/service/pages/templates.cpp b/library/cpp/monlib/service/pages/templates.cpp
index 281f9c9c68..ece12bea71 100644
--- a/library/cpp/monlib/service/pages/templates.cpp
+++ b/library/cpp/monlib/service/pages/templates.cpp
@@ -1,35 +1,35 @@
-#include "templates.h"
-
-namespace NMonitoring {
+#include "templates.h"
+
+namespace NMonitoring {
extern const char HtmlTag[] = "html";
extern const char HeadTag[] = "head";
extern const char BodyTag[] = "body";
- extern const char DivTag[] = "div";
- extern const char TableTag[] = "table";
- extern const char TableHeadTag[] = "thead";
- extern const char TableBodyTag[] = "tbody";
- extern const char TableRTag[] = "tr";
- extern const char TableDTag[] = "td";
- extern const char TableHTag[] = "th";
- extern const char FormTag[] = "form";
- extern const char LabelTag[] = "label";
- extern const char SpanTag[] = "span";
- extern const char CaptionTag[] = "caption";
+ extern const char DivTag[] = "div";
+ extern const char TableTag[] = "table";
+ extern const char TableHeadTag[] = "thead";
+ extern const char TableBodyTag[] = "tbody";
+ extern const char TableRTag[] = "tr";
+ extern const char TableDTag[] = "td";
+ extern const char TableHTag[] = "th";
+ extern const char FormTag[] = "form";
+ extern const char LabelTag[] = "label";
+ extern const char SpanTag[] = "span";
+ extern const char CaptionTag[] = "caption";
extern const char PreTag[] = "pre";
- extern const char ParaTag[] = "p";
+ extern const char ParaTag[] = "p";
extern const char H1Tag[] = "h1";
extern const char H2Tag[] = "h2";
extern const char H3Tag[] = "h3";
extern const char H4Tag[] = "h4";
extern const char H5Tag[] = "h5";
extern const char H6Tag[] = "h6";
- extern const char SmallTag[] = "small";
- extern const char StrongTag[] = "strong";
+ extern const char SmallTag[] = "small";
+ extern const char StrongTag[] = "strong";
extern const char ListTag[] = "li";
extern const char UListTag[] = "ul";
extern const char OListTag[] = "ol";
extern const char DListTag[] = "dl";
extern const char DTermTag[] = "dt";
extern const char DDescTag[] = "dd";
-
+
}
diff --git a/library/cpp/monlib/service/pages/templates.h b/library/cpp/monlib/service/pages/templates.h
index dba4e8a11a..b4656f059f 100644
--- a/library/cpp/monlib/service/pages/templates.h
+++ b/library/cpp/monlib/service/pages/templates.h
@@ -1,10 +1,10 @@
-#pragma once
-
-#include <util/stream/output.h>
+#pragma once
+
+#include <util/stream/output.h>
#include <util/system/defaults.h>
-
+
#define WITH_SCOPED(var, value) WITH_SCOPED_I(var, value, Y_GENERATE_UNIQUE_ID(WITH_SCOPED_LABEL_))
-
+
#define WITH_SCOPED_I(var, value, label) \
if (auto var = (value)) { \
Y_UNUSED(var); \
@@ -12,7 +12,7 @@
} else \
label \
:
-
+
#define TAG(name) WITH_SCOPED(tmp, NMonitoring::name(__stream))
#define TAG_CLASS(name, cls) WITH_SCOPED(tmp, NMonitoring::name(__stream, cls))
#define TAG_CLASS_STYLE(name, cls, style) WITH_SCOPED(tmp, NMonitoring::name(__stream, {{"class", cls}, {"style", style}}))
@@ -21,7 +21,7 @@
#define TAG_ATTRS(name, ...) WITH_SCOPED(tmp, NMonitoring::name(__stream, ##__VA_ARGS__))
#define HTML(str) WITH_SCOPED(__stream, NMonitoring::TOutputStreamRef(str))
-
+
#define HEAD() TAG(THead)
#define BODY() TAG(TBody)
#define HTML_TAG() TAG(THtml)
@@ -51,7 +51,7 @@
#define LABEL_CLASS_FOR(cls, for0) TAG_CLASS_FOR(TLabelC, cls, for0)
#define SPAN_CLASS(cls) TAG_CLASS(TSpanC, cls)
#define SPAN_CLASS_STYLE(cls, style) TAG_CLASS_STYLE(TSpanC, cls, style)
-
+
#define PARA() TAG(TPara)
#define PARA_CLASS(cls) TAG_CLASS(TPara, cls)
@@ -67,7 +67,7 @@
#define H5_CLASS(cls) TAG_CLASS(TH5, cls)
#define H6() TAG(TH6)
#define H6_CLASS(cls) TAG_CLASS(TH6, cls)
-
+
#define SMALL() TAG(TSMALL)
#define STRONG() TAG(TSTRONG)
@@ -77,7 +77,7 @@
#define UL_CLASS(cls) TAG_CLASS(TULIST, cls)
#define OL() TAG(TOLIST)
#define OL_CLASS(cls) TAG_CLASS(TOLIST, cls)
-
+
#define DL() TAG(DLIST)
#define DL_CLASS(cls) TAG_CLASS(DLIST, cls)
#define DT() TAG(DTERM)
@@ -88,16 +88,16 @@
#define CAPTION() TAG(TCaption)
#define CAPTION_CLASS(cls) CAPTION_CLASS(TCaption, cls)
-#define HTML_OUTPUT_PARAM(str, param) str << #param << ": " << param << "<br/>"
-#define HTML_OUTPUT_TIME_PARAM(str, param) str << #param << ": " << ToStringLocalTimeUpToSeconds(param) << "<br/>"
-
+#define HTML_OUTPUT_PARAM(str, param) str << #param << ": " << param << "<br/>"
+#define HTML_OUTPUT_TIME_PARAM(str, param) str << #param << ": " << ToStringLocalTimeUpToSeconds(param) << "<br/>"
+
#define COLLAPSED_BUTTON_CONTENT(targetId, buttonText) \
WITH_SCOPED(tmp, NMonitoring::TCollapsedButton(__stream, targetId, buttonText))
-
+
#define HREF(path) \
WITH_SCOPED(tmp, NMonitoring::THref(__stream, path))
-namespace NMonitoring {
+namespace NMonitoring {
struct THref {
THref(IOutputStream& str, TStringBuf path)
: Str(str)
@@ -117,16 +117,16 @@ namespace NMonitoring {
};
template <const char* tag>
- struct TTag {
+ struct TTag {
TTag(IOutputStream& str, TStringBuf cls = "", TStringBuf for0 = "", TStringBuf id = "")
- : Str(str)
- {
+ : Str(str)
+ {
Str << "<" << tag;
-
+
if (!cls.empty()) {
Str << " class=\"" << cls << "\"";
}
-
+
if (!for0.empty()) {
Str << " for=\"" << for0 << "\"";
}
@@ -135,8 +135,8 @@ namespace NMonitoring {
Str << "id=\"" << id << "\"";
}
Str << ">";
- }
-
+ }
+
TTag(IOutputStream& str, std::initializer_list<std::pair<TStringBuf, TStringBuf>> attributes)
: Str(str)
{
@@ -149,44 +149,44 @@ namespace NMonitoring {
Str << ">";
}
- ~TTag() {
+ ~TTag() {
try {
Str << "</" << tag << ">";
} catch (...) {
}
- }
-
+ }
+
explicit inline operator bool() const noexcept {
return true; // just to work with WITH_SCOPED
}
IOutputStream& Str;
- };
-
- // a nice class for creating collapsable regions of html output
- struct TCollapsedButton {
+ };
+
+ // a nice class for creating collapsable regions of html output
+ struct TCollapsedButton {
TCollapsedButton(IOutputStream& str, const TString& targetId, const TString& buttonText)
- : Str(str)
- {
- Str << "<button type='button' class='btn' data-toggle='collapse' data-target='#" << targetId << "'>"
- << buttonText << "</button>";
- Str << "<div id='" << targetId << "' class='collapse'>";
- }
-
- ~TCollapsedButton() {
- try {
- Str << "</div>";
+ : Str(str)
+ {
+ Str << "<button type='button' class='btn' data-toggle='collapse' data-target='#" << targetId << "'>"
+ << buttonText << "</button>";
+ Str << "<div id='" << targetId << "' class='collapse'>";
+ }
+
+ ~TCollapsedButton() {
+ try {
+ Str << "</div>";
} catch (...) {
}
- }
-
+ }
+
explicit inline operator bool() const noexcept {
return true; // just to work with WITH_SCOPED
}
IOutputStream& Str;
- };
-
+ };
+
struct TOutputStreamRef {
TOutputStreamRef(IOutputStream& str)
: Str(str)
@@ -234,31 +234,31 @@ namespace NMonitoring {
extern const char DListTag[3];
extern const char DTermTag[3];
extern const char DDescTag[3];
-
+
typedef TTag<HtmlTag> THtml;
typedef TTag<HeadTag> THead;
typedef TTag<BodyTag> TBody;
- typedef TTag<DivTag> TDiv;
- typedef TTag<TableTag> TTable;
- typedef TTag<TableHeadTag> TTableHead;
- typedef TTag<TableBodyTag> TTableBody;
- typedef TTag<TableRTag> TTableR;
- typedef TTag<TableDTag> TTableD;
- typedef TTag<TableHTag> TTableH;
- typedef TTag<FormTag> TFormC;
- typedef TTag<LabelTag> TLabelC;
- typedef TTag<SpanTag> TSpanC;
- typedef TTag<CaptionTag> TCaption;
+ typedef TTag<DivTag> TDiv;
+ typedef TTag<TableTag> TTable;
+ typedef TTag<TableHeadTag> TTableHead;
+ typedef TTag<TableBodyTag> TTableBody;
+ typedef TTag<TableRTag> TTableR;
+ typedef TTag<TableDTag> TTableD;
+ typedef TTag<TableHTag> TTableH;
+ typedef TTag<FormTag> TFormC;
+ typedef TTag<LabelTag> TLabelC;
+ typedef TTag<SpanTag> TSpanC;
+ typedef TTag<CaptionTag> TCaption;
typedef TTag<PreTag> TPre;
- typedef TTag<ParaTag> TPara;
+ typedef TTag<ParaTag> TPara;
typedef TTag<H1Tag> TH1;
typedef TTag<H2Tag> TH2;
typedef TTag<H3Tag> TH3;
typedef TTag<H4Tag> TH4;
typedef TTag<H5Tag> TH5;
typedef TTag<H6Tag> TH6;
- typedef TTag<SmallTag> TSMALL;
- typedef TTag<StrongTag> TSTRONG;
+ typedef TTag<SmallTag> TSMALL;
+ typedef TTag<StrongTag> TSTRONG;
typedef TTag<ListTag> TLIST;
typedef TTag<UListTag> TULIST;
typedef TTag<OListTag> TOLIST;
diff --git a/library/cpp/sliding_window/sliding_window.h b/library/cpp/sliding_window/sliding_window.h
index 8c6bc516f8..180bdf93d0 100644
--- a/library/cpp/sliding_window/sliding_window.h
+++ b/library/cpp/sliding_window/sliding_window.h
@@ -1,26 +1,26 @@
-#pragma once
-
+#pragma once
+
#include <util/datetime/base.h>
#include <util/generic/vector.h>
#include <util/system/guard.h>
#include <util/system/mutex.h>
#include <util/system/types.h>
#include <util/system/yassert.h>
-
+
#include <functional>
#include <limits>
-
+
namespace NSlidingWindow {
namespace NPrivate {
template <class TValueType_, class TCmp, TValueType_ initialValue> // std::less for max, std::greater for min
struct TMinMaxOperationImpl {
using TValueType = TValueType_;
using TValueVector = TVector<TValueType>;
-
+
static constexpr TValueType InitialValue() {
return initialValue;
}
-
+
// Updates value in current bucket and returns window value
static TValueType UpdateBucket(TValueType windowValue, TValueVector& buckets, size_t index, TValueType newVal) {
Y_ASSERT(index < buckets.size());
@@ -34,7 +34,7 @@ namespace NSlidingWindow {
}
return windowValue;
}
-
+
static TValueType ClearBuckets(TValueType windowValue, TValueVector& buckets, const size_t firstElemIndex, const size_t bucketsToClear) {
Y_ASSERT(!buckets.empty());
Y_ASSERT(firstElemIndex < buckets.size());
@@ -72,7 +72,7 @@ namespace NSlidingWindow {
};
}
-
+
template <class TValueType>
using TMaxOperation = NPrivate::TMinMaxOperationImpl<TValueType, std::less<TValueType>, std::numeric_limits<TValueType>::min()>;
@@ -111,7 +111,7 @@ namespace NSlidingWindow {
return windowValue;
}
};
-
+
/////////////////////////////////////////////////////////////////////////////////////////
// TSlidingWindow
/////////////////////////////////////////////////////////////////////////////////////////
@@ -121,7 +121,7 @@ namespace NSlidingWindow {
using TValueType = typename TOperation::TValueType;
using TValueVector = TVector<TValueType>;
using TSizeType = typename TValueVector::size_type;
-
+
public:
TSlidingWindow(const TDuration& length, TSizeType partsNum)
: Mutex()
@@ -133,7 +133,7 @@ namespace NSlidingWindow {
, MicroSecondsPerBucket(length.MicroSeconds() / partsNum)
{
}
-
+
TSlidingWindow(const TSlidingWindow& w)
: Mutex()
{
@@ -175,20 +175,20 @@ namespace NSlidingWindow {
TValueType GetValue() const {
TGuard<TMutexImpl> guard(&Mutex);
return WindowValue;
- }
-
+ }
+
private:
void UpdateCurrentBucket(TValueType val) {
const TSizeType arraySize = Buckets.size();
const TSizeType pos = (FirstElem + arraySize - 1) % arraySize;
WindowValue = TOperation::UpdateBucket(WindowValue, Buckets, pos, val);
}
-
+
void AdvanceTime(const TInstant& time) {
if (time < PeriodStart + Length) {
return;
}
-
+
if (PeriodStart.MicroSeconds() == 0) {
PeriodStart = time - Length;
return;
diff --git a/library/cpp/sliding_window/sliding_window_ut.cpp b/library/cpp/sliding_window/sliding_window_ut.cpp
index d655f0bb0c..1e7343a8d3 100644
--- a/library/cpp/sliding_window/sliding_window_ut.cpp
+++ b/library/cpp/sliding_window/sliding_window_ut.cpp
@@ -1,9 +1,9 @@
#include "sliding_window.h"
#include <library/cpp/testing/unittest/registar.h>
-
+
using namespace NSlidingWindow;
-
+
Y_UNIT_TEST_SUITE(TSlidingWindowTest) {
Y_UNIT_TEST(TestSlidingWindowMax) {
TSlidingWindow<TMaxOperation<unsigned>> w(TDuration::Minutes(5), 5);
@@ -29,7 +29,7 @@ Y_UNIT_TEST_SUITE(TSlidingWindowTest) {
now += TDuration::Minutes(5);
w.Update(1, now); // ~ 1 ~ ~ ~
UNIT_ASSERT_VALUES_EQUAL(w.GetValue(), 1); // ^
-
+
// update current bucket
w.Update(2, now); // ~ 2 ~ ~ ~
UNIT_ASSERT_VALUES_EQUAL(w.GetValue(), 2); // ^
@@ -44,8 +44,8 @@ Y_UNIT_TEST_SUITE(TSlidingWindowTest) {
now += TDuration::Minutes(5); // ~ ~ ~ ~ ~
UNIT_ASSERT_VALUES_EQUAL(w.Update(now), 0);
- }
-
+ }
+
Y_UNIT_TEST(TestSlidingWindowMin) {
TSlidingWindow<TMinOperation<unsigned>> w(TDuration::Minutes(5), 5);
TInstant start = TInstant::MicroSeconds(TDuration::Hours(1).MicroSeconds());
diff --git a/library/cpp/testing/common/env.h b/library/cpp/testing/common/env.h
index 952faa91bc..7b89aa1bed 100644
--- a/library/cpp/testing/common/env.h
+++ b/library/cpp/testing/common/env.h
@@ -17,10 +17,10 @@ TString ArcadiaFromCurrentLocation(TStringBuf where, TStringBuf path);
// @brief return build folder path
TString BuildRoot();
-
+
// @brief return full path to built artefact, where path is relative from arcadia root
TString BinaryPath(TStringBuf path);
-
+
// @brief return true if environment is testenv otherwise false
bool FromYaTest();
diff --git a/library/cpp/testing/unittest/tests_data.h b/library/cpp/testing/unittest/tests_data.h
index 6775e98b5d..6536bc1ae6 100644
--- a/library/cpp/testing/unittest/tests_data.h
+++ b/library/cpp/testing/unittest/tests_data.h
@@ -5,28 +5,28 @@
#include <util/generic/noncopyable.h>
#include <util/generic/ptr.h>
#include <util/generic/string.h>
-#include <util/network/sock.h>
+#include <util/network/sock.h>
class TInet6StreamSocket;
-// set two options: SO_REUSEADDR and SO_REUSEPORT, both are required for
-// correct implementation of TPortManager because of different operating systems
-// incompatibility: singe SO_REUSEADDR is enough for Linux, but not enough for Darwin
-template <class TSocketType>
-void SetReuseAddressAndPort(const TSocketType& sock) {
- const int retAddr = SetSockOpt(sock, SOL_SOCKET, SO_REUSEADDR, 1);
- if (retAddr < 0) {
- ythrow yexception() << "can't set SO_REUSEADDR: " << LastSystemErrorText(-retAddr);
- }
-
-#ifdef SO_REUSEPORT
- const int retPort = SetSockOpt(sock, SOL_SOCKET, SO_REUSEPORT, 1);
- if (retPort < 0) {
- ythrow yexception() << "can't set SO_REUSEPORT: " << LastSystemErrorText(-retPort);
- }
-#endif
-}
-
+// set two options: SO_REUSEADDR and SO_REUSEPORT, both are required for
+// correct implementation of TPortManager because of different operating systems
+// incompatibility: singe SO_REUSEADDR is enough for Linux, but not enough for Darwin
+template <class TSocketType>
+void SetReuseAddressAndPort(const TSocketType& sock) {
+ const int retAddr = SetSockOpt(sock, SOL_SOCKET, SO_REUSEADDR, 1);
+ if (retAddr < 0) {
+ ythrow yexception() << "can't set SO_REUSEADDR: " << LastSystemErrorText(-retAddr);
+ }
+
+#ifdef SO_REUSEPORT
+ const int retPort = SetSockOpt(sock, SOL_SOCKET, SO_REUSEPORT, 1);
+ if (retPort < 0) {
+ ythrow yexception() << "can't set SO_REUSEPORT: " << LastSystemErrorText(-retPort);
+ }
+#endif
+}
+
class TPortManager: public TNonCopyable {
public:
TPortManager(bool reservePortsForCurrentTest = true);
diff --git a/library/cpp/uri/common.h b/library/cpp/uri/common.h
index 38bd460556..8025357763 100644
--- a/library/cpp/uri/common.h
+++ b/library/cpp/uri/common.h
@@ -501,11 +501,11 @@ Y_DECLARE_OUT_SPEC(inline, NUri::TScheme::EKind, out, t) {
Y_DECLARE_OUT_SPEC(inline, NUri::TState::EParsed, out, t) {
out << NUri::ParsedStateToString(t);
}
-
+
static inline ui16 DefaultPort(NUri::TScheme::EKind scheme) {
return NUri::TSchemeInfo::GetDefaultPort(scheme);
-}
-
+}
+
static inline NUri::TScheme::EKind SchemeKind(const TStringBuf& scheme) {
return NUri::TSchemeInfo::GetKind(scheme);
}
diff --git a/library/cpp/uri/uri.cpp b/library/cpp/uri/uri.cpp
index 464c7f54f0..56a9a4e5ef 100644
--- a/library/cpp/uri/uri.cpp
+++ b/library/cpp/uri/uri.cpp
@@ -351,7 +351,7 @@ namespace NUri {
IOutputStream& TUri::PrintImpl(IOutputStream& out, int flags) const {
TStringBuf v;
-
+
const int wantFlags = flags; // save the original
flags &= FieldsSet; // can't print what we don't have
if (flags & FlagHostAscii)
diff --git a/library/cpp/uri/uri.h b/library/cpp/uri/uri.h
index 0b57246a1e..3b6c19fe4a 100644
--- a/library/cpp/uri/uri.h
+++ b/library/cpp/uri/uri.h
@@ -401,7 +401,7 @@ namespace NUri {
const size_t printSize = PrintSize(flags) + 1;
return printSize > size ? nullptr : PrintImpl(str, size, flags);
}
-
+
char* Serialize(int flags = FlagUrlFields) const {
flags = PrintFlags(flags);
const size_t size = PrintSize(flags) + 1;