Browse Source

Restoring authorship annotation for <single@yandex-team.ru>. Commit 2 of 2.

single 3 years ago
parent
commit
f7835298a8

+ 10 - 10
library/cpp/actors/core/actor.cpp

@@ -16,15 +16,15 @@ namespace NActors {
     }
 
     void IActor::Registered(TActorSystem* sys, const TActorId& owner) {
-        // fallback to legacy method, do not use it anymore 
-        if (auto eh = AfterRegister(SelfId(), owner)) 
-            sys->Send(eh); 
-    } 
- 
-    void IActor::Describe(IOutputStream &out) const noexcept { 
-        SelfActorId.Out(out); 
-    } 
- 
+        // fallback to legacy method, do not use it anymore
+        if (auto eh = AfterRegister(SelfId(), owner))
+            sys->Send(eh);
+    }
+
+    void IActor::Describe(IOutputStream &out) const noexcept {
+        SelfActorId.Out(out);
+    }
+
     bool IActor::Send(const TActorId& recipient, IEventBase* ev, ui32 flags, ui64 cookie, NWilson::TTraceId traceId) const noexcept {
         return SelfActorId.Send(recipient, ev, flags, cookie, std::move(traceId));
     }
@@ -123,7 +123,7 @@ namespace NActors {
         TlsActivationContext->ExecutorThread.Schedule(deadline, new IEventHandle(SelfActorId, TActorId(), ev), cookie);
     }
 
-    void IActor::Schedule(TDuration delta, IEventBase* ev, ISchedulerCookie* cookie) const noexcept { 
+    void IActor::Schedule(TDuration delta, IEventBase* ev, ISchedulerCookie* cookie) const noexcept {
         TlsActivationContext->ExecutorThread.Schedule(delta, new IEventHandle(SelfActorId, TActorId(), ev), cookie);
     }
 

+ 12 - 12
library/cpp/actors/core/actor.h

@@ -6,7 +6,7 @@
 #include <library/cpp/actors/util/local_process_key.h>
 
 namespace NActors {
-    class TActorSystem; 
+    class TActorSystem;
     class TMailboxTable;
     struct TMailboxHeader;
 
@@ -169,11 +169,11 @@ namespace NActors {
         void Schedule(TDuration delta, IEventBase* ev, ISchedulerCookie* cookie = nullptr) const;
     };
 
-    class IActor; 
- 
-    class IActorOps : TNonCopyable { 
+    class IActor;
+
+    class IActorOps : TNonCopyable {
     public:
-        virtual void Describe(IOutputStream&) const noexcept = 0; 
+        virtual void Describe(IOutputStream&) const noexcept = 0;
         virtual bool Send(const TActorId& recipient, IEventBase*, ui32 flags = 0, ui64 cookie = 0, NWilson::TTraceId traceId = {}) const noexcept = 0;
 
         /**
@@ -205,12 +205,12 @@ namespace NActors {
 
         virtual TActorId Register(IActor*, TMailboxType::EType mailboxType = TMailboxType::HTSwap, ui32 poolId = Max<ui32>()) const noexcept = 0;
         virtual TActorId RegisterWithSameMailbox(IActor*) const noexcept = 0;
-    }; 
- 
+    };
+
     class TDecorator;
 
-    class IActor : protected IActorOps { 
-    public: 
+    class IActor : protected IActorOps {
+    public:
         typedef void (IActor::*TReceiveFunc)(TAutoPtr<IEventHandle>& ev, const TActorContext& ctx);
 
     private:
@@ -324,7 +324,7 @@ namespace NActors {
         }
 
         virtual void Registered(TActorSystem* sys, const TActorId& owner);
- 
+
         virtual TAutoPtr<IEventHandle> AfterRegister(const TActorId& self, const TActorId& parentId) {
             Y_UNUSED(self);
             Y_UNUSED(parentId);
@@ -349,7 +349,7 @@ namespace NActors {
         }
 
     protected:
-        void Describe(IOutputStream&) const noexcept override; 
+        void Describe(IOutputStream&) const noexcept override;
         bool Send(const TActorId& recipient, IEventBase* ev, ui32 flags = 0, ui64 cookie = 0, NWilson::TTraceId traceId = {}) const noexcept final;
         template <typename TEvent>
         bool Send(const TActorId& recipient, THolder<TEvent> ev, ui32 flags = 0, ui64 cookie = 0, NWilson::TTraceId traceId = {}) const{
@@ -363,7 +363,7 @@ namespace NActors {
 
         void Schedule(TInstant deadline, IEventBase* ev, ISchedulerCookie* cookie = nullptr) const noexcept final;
         void Schedule(TMonotonic deadline, IEventBase* ev, ISchedulerCookie* cookie = nullptr) const noexcept final;
-        void Schedule(TDuration delta, IEventBase* ev, ISchedulerCookie* cookie = nullptr) const noexcept final; 
+        void Schedule(TDuration delta, IEventBase* ev, ISchedulerCookie* cookie = nullptr) const noexcept final;
 
         // register new actor in ActorSystem on new fresh mailbox.
         TActorId Register(IActor* actor, TMailboxType::EType mailboxType = TMailboxType::HTSwap, ui32 poolId = Max<ui32>()) const noexcept final;

+ 5 - 5
library/cpp/actors/core/event.h

@@ -59,11 +59,11 @@ namespace NActors {
     public:
         template <typename TEv>
         inline TEv* CastAsLocal() const noexcept {
-            auto fits = GetTypeRewrite() == TEv::EventType; 
- 
-            return fits ? static_cast<TEv*>(Event.Get()) : nullptr; 
-        } 
- 
+            auto fits = GetTypeRewrite() == TEv::EventType;
+
+            return fits ? static_cast<TEv*>(Event.Get()) : nullptr;
+        }
+
         template <typename TEventType>
         TEventType* Get() {
             if (Type != TEventType::EventType)

+ 18 - 18
library/cpp/actors/core/events.h

@@ -85,23 +85,23 @@ namespace NActors {
                 Unsubscribe, // generic unsubscribe from something
                 Delivered,   // event delivered
                 Undelivered, // event undelivered
-                Poison,      // request actor to shutdown 
+                Poison,      // request actor to shutdown
                 Completed,   // generic async job result event
-                PoisonTaken, // generic Poison taken (reply to PoisonPill event, i.e. died completely) 
+                PoisonTaken, // generic Poison taken (reply to PoisonPill event, i.e. died completely)
                 FlushLog,
                 CallbackCompletion,
                 CallbackException,
-                Gone,        // Generic notification of actor death 
+                Gone,        // Generic notification of actor death
                 TrackActor,
                 UntrackActor,
                 InvokeResult,
                 CoroTimeout,
                 InvokeQuery,
-                End, 
- 
+                End,
+
                 // Compatibility section
-                PoisonPill = Poison, 
-                ActorDied = Gone, 
+                PoisonPill = Poison,
+                ActorDied = Gone,
             };
 
             static_assert(End < EventSpaceEnd(ES_SYSTEM), "expect End < EventSpaceEnd(ES_SYSTEM)");
@@ -111,16 +111,16 @@ namespace NActors {
             DEFINE_SIMPLE_LOCAL_EVENT(TEvBootstrap, "System: TEvBootstrap")
         };
 
-        struct TEvPoison : public TEventBase<TEvPoison, TSystem::Poison> { 
-            DEFINE_SIMPLE_NONLOCAL_EVENT(TEvPoison, "System: TEvPoison") 
+        struct TEvPoison : public TEventBase<TEvPoison, TSystem::Poison> {
+            DEFINE_SIMPLE_NONLOCAL_EVENT(TEvPoison, "System: TEvPoison")
         };
 
         struct TEvWakeup: public TEventBase<TEvWakeup, TSystem::Wakeup> {
             DEFINE_SIMPLE_LOCAL_EVENT(TEvWakeup, "System: TEvWakeup")
- 
-            TEvWakeup(ui64 tag = 0) : Tag(tag) { } 
- 
-            const ui64 Tag = 0; 
+
+            TEvWakeup(ui64 tag = 0) : Tag(tag) { }
+
+            const ui64 Tag = 0;
         };
 
         struct TEvSubscribe: public TEventBase<TEvSubscribe, TSystem::Subscribe> {
@@ -205,14 +205,14 @@ namespace NActors {
             }
         };
 
-        struct TEvGone: public TEventBase<TEvGone, TSystem::Gone> { 
-            DEFINE_SIMPLE_LOCAL_EVENT(TEvGone, "System: TEvGone") 
+        struct TEvGone: public TEventBase<TEvGone, TSystem::Gone> {
+            DEFINE_SIMPLE_LOCAL_EVENT(TEvGone, "System: TEvGone")
         };
- 
+
         struct TEvInvokeResult;
 
-        using TEvPoisonPill = TEvPoison; // Legacy name, deprecated 
-        using TEvActorDied = TEvGone; 
+        using TEvPoisonPill = TEvPoison; // Legacy name, deprecated
+        using TEvActorDied = TEvGone;
     };
 }
 

+ 4 - 4
library/cpp/actors/core/executor_pool_base.cpp

@@ -8,8 +8,8 @@ namespace NActors {
     LWTRACE_USING(ACTORLIB_PROVIDER);
 
     void DoActorInit(TActorSystem* sys, IActor* actor, const TActorId& self, const TActorId& owner) {
-        actor->SelfActorId = self; 
-        actor->Registered(sys, owner); 
+        actor->SelfActorId = self;
+        actor->Registered(sys, owner);
     }
 
     TExecutorPoolBaseMailboxed::TExecutorPoolBaseMailboxed(ui32 poolId, ui32 maxActivityType)
@@ -98,7 +98,7 @@ namespace NActors {
 
         // do init
         const TActorId actorId(ActorSystem->NodeId, PoolId, localActorId, hint);
-        DoActorInit(ActorSystem, actor, actorId, parentId); 
+        DoActorInit(ActorSystem, actor, actorId, parentId);
 
         // Once we unlock the mailbox the actor starts running and we cannot use the pointer any more
         actor = nullptr;
@@ -145,7 +145,7 @@ namespace NActors {
         mailbox->AttachActor(localActorId, actor);
 
         const TActorId actorId(ActorSystem->NodeId, PoolId, localActorId, hint);
-        DoActorInit(ActorSystem, actor, actorId, parentId); 
+        DoActorInit(ActorSystem, actor, actorId, parentId);
         NHPTimer::STime elapsed = GetCycleCountFast() - hpstart;
         if (elapsed > 1000000) {
             LWPROBE(SlowRegisterAdd, PoolId, NHPTimer::GetSeconds(elapsed) * 1000.0);

+ 5 - 5
library/cpp/actors/core/executor_thread.cpp

@@ -67,10 +67,10 @@ namespace NActors {
         DyingActors.push_back(THolder(actor));
     }
 
-    void TExecutorThread::DropUnregistered() { 
-        DyingActors.clear(); // here is actual destruction of actors 
-    } 
- 
+    void TExecutorThread::DropUnregistered() {
+        DyingActors.clear(); // here is actual destruction of actors
+    }
+
     void TExecutorThread::Schedule(TInstant deadline, TAutoPtr<IEventHandle> ev, ISchedulerCookie* cookie) {
         ++CurrentActorScheduledEventsCounter;
         Ctx.Executor->Schedule(deadline, ev, cookie, Ctx.WorkerId);
@@ -181,7 +181,7 @@ namespace NActors {
                     size_t dyingActorsCnt = DyingActors.size();
                     Ctx.UpdateActorsStats(dyingActorsCnt);
                     if (dyingActorsCnt) {
-                        DropUnregistered(); 
+                        DropUnregistered();
                         actor = nullptr;
                     }
 

+ 1 - 1
library/cpp/actors/core/executor_thread.h

@@ -43,7 +43,7 @@ namespace NActors {
                                const TActorId& parentId = TActorId());
         TActorId RegisterActor(IActor* actor, TMailboxHeader* mailbox, ui32 hint, const TActorId& parentId = TActorId());
         void UnregisterActor(TMailboxHeader* mailbox, ui64 localActorId);
-        void DropUnregistered(); 
+        void DropUnregistered();
         const std::vector<THolder<IActor>>& GetUnregistered() const { return DyingActors; }
 
         void Schedule(TInstant deadline, TAutoPtr<IEventHandle> ev, ISchedulerCookie* cookie = nullptr);

+ 13 - 13
library/cpp/actors/core/log.cpp

@@ -251,11 +251,11 @@ namespace NActors {
 
         const auto prio = ev.Level.ToPrio();
 
-        switch (prio) { 
-            case ::NActors::NLog::EPrio::Alert: 
+        switch (prio) {
+            case ::NActors::NLog::EPrio::Alert:
                 Metrics->IncAlertMsgs();
                 break;
-            case ::NActors::NLog::EPrio::Emerg: 
+            case ::NActors::NLog::EPrio::Emerg:
                 Metrics->IncEmergMsgs();
                 break;
             default:
@@ -344,10 +344,10 @@ namespace NActors {
                                 str << "<a href='logger?c=" << i << "'>" << name << "</a>";
                             }
                             TABLED() {
-                                str << PriorityToString(EPrio(componentSettings.Raw.X.Level)); 
+                                str << PriorityToString(EPrio(componentSettings.Raw.X.Level));
                             }
                             TABLED() {
-                                str << PriorityToString(EPrio(componentSettings.Raw.X.SamplingLevel)); 
+                                str << PriorityToString(EPrio(componentSettings.Raw.X.SamplingLevel));
                             }
                             TABLED() {
                                 str << componentSettings.Raw.X.SamplingRate;
@@ -421,11 +421,11 @@ namespace NActors {
                         UL() {
                             LI() {
                                 str << "Priority: "
-                                    << NLog::PriorityToString(NLog::EPrio(componentSettings.Raw.X.Level)); 
+                                    << NLog::PriorityToString(NLog::EPrio(componentSettings.Raw.X.Level));
                             }
                             LI() {
                                 str << "Sampling priority: "
-                                    << NLog::PriorityToString(NLog::EPrio(componentSettings.Raw.X.SamplingLevel)); 
+                                    << NLog::PriorityToString(NLog::EPrio(componentSettings.Raw.X.SamplingLevel));
                             }
                             LI() {
                                 str << "Sampling rate: "
@@ -444,7 +444,7 @@ namespace NActors {
                             for (int p = NLog::PRI_EMERG; p <= NLog::PRI_TRACE; ++p) {
                                 LI() {
                                     str << "<a href='logger?c=" << component << "&p=" << p << "'>"
-                                        << NLog::PriorityToString(NLog::EPrio(p)) << "</a>"; 
+                                        << NLog::PriorityToString(NLog::EPrio(p)) << "</a>";
                                 }
                             }
                         }
@@ -455,7 +455,7 @@ namespace NActors {
                             for (int p = NLog::PRI_EMERG; p <= NLog::PRI_TRACE; ++p) {
                                 LI() {
                                     str << "<a href='logger?c=" << component << "&sp=" << p << "'>"
-                                        << NLog::PriorityToString(NLog::EPrio(p)) << "</a>"; 
+                                        << NLog::PriorityToString(NLog::EPrio(p)) << "</a>";
                                 }
                             }
                         }
@@ -519,7 +519,7 @@ namespace NActors {
                                     TABLER() {
                                         TABLED() {
                                             str << "<a href = 'logger?c=-1&p=" << p << "'>"
-                                                << NLog::PriorityToString(NLog::EPrio(p)) << "</a>"; 
+                                                << NLog::PriorityToString(NLog::EPrio(p)) << "</a>";
                                         }
                                     }
                                 }
@@ -541,7 +541,7 @@ namespace NActors {
                                     TABLER() {
                                         TABLED() {
                                             str << "<a href = 'logger?c=-1&sp=" << p << "'>"
-                                                << NLog::PriorityToString(NLog::EPrio(p)) << "</a>"; 
+                                                << NLog::PriorityToString(NLog::EPrio(p)) << "</a>";
                                         }
                                     }
                                 }
@@ -576,8 +576,8 @@ namespace NActors {
 
     bool TLoggerActor::OutputRecord(TInstant time, NLog::EPrio priority, NLog::EComponent component,
                                     const TString& formatted) noexcept try {
-        const auto logPrio = ::ELogPriority(ui16(priority)); 
- 
+        const auto logPrio = ::ELogPriority(ui16(priority));
+
         char buf[TimeBufSize];
         switch (Settings->Format) {
             case NActors::NLog::TSettings::PLAIN_FULL_FORMAT: {

+ 6 - 6
library/cpp/actors/core/log.h

@@ -2,7 +2,7 @@
 
 #include "defs.h"
 
-#include "log_iface.h" 
+#include "log_iface.h"
 #include "log_settings.h"
 #include "actorsystem.h"
 #include "events.h"
@@ -122,7 +122,7 @@ namespace NActors {
     ////////////////////////////////////////////////////////////////////////////////
     // SET LOG LEVEL FOR A COMPONENT
     ////////////////////////////////////////////////////////////////////////////////
-    class TLogComponentLevelRequest: public TEventLocal<TLogComponentLevelRequest, int(NLog::EEv::LevelReq)> { 
+    class TLogComponentLevelRequest: public TEventLocal<TLogComponentLevelRequest, int(NLog::EEv::LevelReq)> {
     public:
         // set given priority for the component
         TLogComponentLevelRequest(NLog::EPriority priority, NLog::EComponent component)
@@ -145,7 +145,7 @@ namespace NActors {
         friend class TLoggerActor;
     };
 
-    class TLogComponentLevelResponse: public TEventLocal<TLogComponentLevelResponse, int(NLog::EEv::LevelResp)> { 
+    class TLogComponentLevelResponse: public TEventLocal<TLogComponentLevelResponse, int(NLog::EEv::LevelResp)> {
     public:
         TLogComponentLevelResponse(int code, const TString& explanation)
             : Code(code)
@@ -166,7 +166,7 @@ namespace NActors {
         TString Explanation;
     };
 
-    class TLogIgnored: public TEventLocal<TLogIgnored, int(NLog::EEv::Ignored)> { 
+    class TLogIgnored: public TEventLocal<TLogIgnored, int(NLog::EEv::Ignored)> {
     public:
         TLogIgnored() {
         }
@@ -213,7 +213,7 @@ namespace NActors {
         void StateFunc(TAutoPtr<IEventHandle>& ev, const TActorContext& ctx) {
             switch (ev->GetTypeRewrite()) {
                 HFunc(TLogIgnored, HandleIgnoredEvent);
-                HFunc(NLog::TEvLog, HandleLogEvent); 
+                HFunc(NLog::TEvLog, HandleLogEvent);
                 HFunc(TLogComponentLevelRequest, HandleLogComponentLevelRequest);
                 HFunc(NMon::TEvHttpInfo, HandleMonInfo);
             }
@@ -246,7 +246,7 @@ namespace NActors {
         void BecomeDefunct();
         void HandleIgnoredEvent(TLogIgnored::TPtr& ev, const NActors::TActorContext& ctx);
         void HandleIgnoredEventDrop();
-        void HandleLogEvent(NLog::TEvLog::TPtr& ev, const TActorContext& ctx); 
+        void HandleLogEvent(NLog::TEvLog::TPtr& ev, const TActorContext& ctx);
         void HandleLogEventDrop(const NLog::TEvLog::TPtr& ev);
         void HandleLogComponentLevelRequest(TLogComponentLevelRequest::TPtr& ev, const TActorContext& ctx);
         void HandleMonInfo(NMon::TEvHttpInfo::TPtr& ev, const TActorContext& ctx);

+ 28 - 28
library/cpp/actors/core/log_iface.h

@@ -1,12 +1,12 @@
-#pragma once 
- 
-#include "events.h" 
-#include "event_local.h" 
- 
-namespace NActors { 
+#pragma once
+
+#include "events.h"
+#include "event_local.h"
+
+namespace NActors {
     namespace NLog {
         using EComponent = int;
- 
+
         enum EPriority : ui16 { // migrate it to EPrio whenever possible
             PRI_EMERG,
             PRI_ALERT,
@@ -18,7 +18,7 @@ namespace NActors {
             PRI_DEBUG,
             PRI_TRACE
         };
- 
+
         enum class EPrio : ui16 {
             Emerg = 0,
             Alert = 1,
@@ -30,39 +30,39 @@ namespace NActors {
             Debug = 7,
             Trace = 8,
         };
- 
+
         struct TLevel {
             TLevel(ui32 raw)
                 : Raw(raw)
             {
             }
- 
+
             TLevel(EPrio prio)
                 : Raw((ui16(prio) + 1) << 8)
             {
             }
- 
+
             EPrio ToPrio() const noexcept {
                 const auto major = Raw >> 8;
- 
+
                 return major > 0 ? EPrio(major - 1) : EPrio::Emerg;
             }
- 
+
             bool IsUrgentAbortion() const noexcept {
                 return (Raw >> 8) == 0;
             }
- 
+
             /* Generalized monotonic level value composed with major and minor
-            levels. Minor is used for verbosity within major, basic EPrio 
-            mapped to (EPrio + 1, 0) and Major = 0 is reserved as special 
-            space with meaning like EPrio::Emerg but with extened actions. 
-            Thus logger should map Major = 0 to EPrio::Emerg if it have no 
-            idea how to handle special emergency actions. 
-         */ 
- 
+            levels. Minor is used for verbosity within major, basic EPrio
+            mapped to (EPrio + 1, 0) and Major = 0 is reserved as special
+            space with meaning like EPrio::Emerg but with extened actions.
+            Thus logger should map Major = 0 to EPrio::Emerg if it have no
+            idea how to handle special emergency actions.
+         */
+
             ui32 Raw = 0; // ((ui16(EPrio) + 1) << 8) | ui8(minor)
         };
- 
+
         enum class EEv {
             Log = EventSpaceBegin(TEvents::ES_LOGGER),
             LevelReq,
@@ -70,9 +70,9 @@ namespace NActors {
             Ignored,
             End
         };
- 
+
         static_assert(int(EEv::End) < EventSpaceEnd(TEvents::ES_LOGGER), "");
- 
+
         class TEvLog: public TEventLocal<TEvLog, int(EEv::Log)> {
         public:
             TEvLog(TInstant stamp, TLevel level, EComponent comp, const TString &line)
@@ -90,7 +90,7 @@ namespace NActors {
                 , Line(std::move(line))
             {
             }
- 
+
             TEvLog(EPriority prio, EComponent comp, TString line, TInstant time = TInstant::Now())
                 : Stamp(time)
                 , Level(EPrio(prio))
@@ -98,12 +98,12 @@ namespace NActors {
                 , Line(std::move(line))
             {
             }
- 
+
             const TInstant Stamp = TInstant::Max();
             const TLevel Level;
             const EComponent Component = 0;
             TString Line;
         };
- 
+
     }
-} 
+}

Some files were not shown because too many files changed in this diff