diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:17 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:17 +0300 |
commit | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch) | |
tree | dd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/messagebus/www | |
parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) | |
download | ydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/messagebus/www')
-rw-r--r-- | library/cpp/messagebus/www/concat_strings.h | 8 | ||||
-rw-r--r-- | library/cpp/messagebus/www/html_output.cpp | 4 | ||||
-rw-r--r-- | library/cpp/messagebus/www/html_output.h | 70 | ||||
-rw-r--r-- | library/cpp/messagebus/www/www.cpp | 64 | ||||
-rw-r--r-- | library/cpp/messagebus/www/www.h | 54 |
5 files changed, 100 insertions, 100 deletions
diff --git a/library/cpp/messagebus/www/concat_strings.h b/library/cpp/messagebus/www/concat_strings.h index 77a77d4695..7b730564eb 100644 --- a/library/cpp/messagebus/www/concat_strings.h +++ b/library/cpp/messagebus/www/concat_strings.h @@ -5,16 +5,16 @@ // ATTN: not equivalent to TString::Join - cat concat anything "outputable" to stream, not only TString convertable types. -inline void DoConcatStrings(TStringStream&) { +inline void DoConcatStrings(TStringStream&) { } -template <class T, class... R> -inline void DoConcatStrings(TStringStream& ss, const T& t, const R&... r) { +template <class T, class... R> +inline void DoConcatStrings(TStringStream& ss, const T& t, const R&... r) { ss << t; DoConcatStrings(ss, r...); } -template <class... R> +template <class... R> inline TString ConcatStrings(const R&... r) { TStringStream ss; DoConcatStrings(ss, r...); diff --git a/library/cpp/messagebus/www/html_output.cpp b/library/cpp/messagebus/www/html_output.cpp index 5128f74718..10ea2e163b 100644 --- a/library/cpp/messagebus/www/html_output.cpp +++ b/library/cpp/messagebus/www/html_output.cpp @@ -1,4 +1,4 @@ #include "html_output.h" -Y_POD_THREAD(IOutputStream*) -HtmlOutputStreamPtr; +Y_POD_THREAD(IOutputStream*) +HtmlOutputStreamPtr; diff --git a/library/cpp/messagebus/www/html_output.h b/library/cpp/messagebus/www/html_output.h index 50c3f1fa15..27e77adefa 100644 --- a/library/cpp/messagebus/www/html_output.h +++ b/library/cpp/messagebus/www/html_output.h @@ -32,26 +32,26 @@ struct TChars { TString Text; bool NeedEscape; - TChars(TStringBuf text) - : Text(text) - , NeedEscape(true) - { - } - TChars(TStringBuf text, bool escape) - : Text(text) - , NeedEscape(escape) - { - } - TChars(const char* text) - : Text(text) - , NeedEscape(true) - { - } - TChars(const char* text, bool escape) - : Text(text) - , NeedEscape(escape) - { - } + TChars(TStringBuf text) + : Text(text) + , NeedEscape(true) + { + } + TChars(TStringBuf text, bool escape) + : Text(text) + , NeedEscape(escape) + { + } + TChars(const char* text) + : Text(text) + , NeedEscape(true) + { + } + TChars(const char* text, bool escape) + : Text(text) + , NeedEscape(escape) + { + } TString Escape() { if (NeedEscape) { @@ -67,13 +67,13 @@ struct TAttr { TString Value; TAttr(TStringBuf name, TStringBuf value) - : Name(name) - , Value(value) - { - } + : Name(name) + , Value(value) + { + } - TAttr() { - } + TAttr() { + } bool operator!() const { return !Name; @@ -239,9 +239,9 @@ static inline void BootstrapInfo(TStringBuf text) { static inline void ScriptHref(TStringBuf href) { Open("script", - TAttr("language", "javascript"), - TAttr("type", "text/javascript"), - TAttr("src", href)); + TAttr("language", "javascript"), + TAttr("type", "text/javascript"), + TAttr("src", href)); Close("script"); Nl(); } @@ -290,17 +290,17 @@ struct TTagGuard { struct TDivGuard: public TTagGuard { TDivGuard(TStringBuf cssClass, TStringBuf id = "") : TTagGuard("div", cssClass, id) - { - } + { + } TDivGuard(TAttr a1 = TAttr(), TAttr a2 = TAttr(), TAttr a3 = TAttr()) : TTagGuard("div", a1, a2, a3) - { - } + { + } }; struct TAGuard { - TAGuard(TStringBuf href) { + TAGuard(TStringBuf href) { OpenA(href); } @@ -318,7 +318,7 @@ struct TScriptFunctionGuard { Line("$(function() {"); } - ~TScriptFunctionGuard() { + ~TScriptFunctionGuard() { Line("});"); } }; diff --git a/library/cpp/messagebus/www/www.cpp b/library/cpp/messagebus/www/www.cpp index 9af596a143..62ec241d85 100644 --- a/library/cpp/messagebus/www/www.cpp +++ b/library/cpp/messagebus/www/www.cpp @@ -35,7 +35,7 @@ namespace { template <typename TValuePtr> struct TNamedValues { - TVector<std::pair<TString, TValuePtr>> Entries; + TVector<std::pair<TString, TValuePtr>> Entries; TValuePtr FindByName(TStringBuf name) { Y_VERIFY(!!name); @@ -79,7 +79,7 @@ namespace { } } - for (unsigned i = 1;; ++i) { + for (unsigned i = 1;; ++i) { TString prefix = p->GetNameInternal(); if (!prefix) { prefix = "unnamed"; @@ -169,7 +169,7 @@ const unsigned char WWW_STATIC_DATA[] = { #include "www_static.inc" }; -class TWwwStaticLoader: public TArchiveReader { +class TWwwStaticLoader: public TArchiveReader { public: TWwwStaticLoader() : TArchiveReader(TBlob::NoCopy(WWW_STATIC_DATA, sizeof(WWW_STATIC_DATA))) @@ -180,8 +180,8 @@ public: struct TBusWww::TImpl { // TODO: use weak pointers TNamedValues<TBusMessageQueuePtr> Queues; - TSessionValues<TIntrusivePtr<TBusClientSession>> ClientSessions; - TSessionValues<TIntrusivePtr<TBusServerSession>> ServerSessions; + TSessionValues<TIntrusivePtr<TBusClientSession>> ClientSessions; + TSessionValues<TIntrusivePtr<TBusServerSession>> ServerSessions; TSessionValues<TBusModuleInternalPtr> Modules; TMutex Mutex; @@ -250,12 +250,12 @@ struct TBusWww::TImpl { const TOptionalParams& Params; TRequest(TImpl* outer, IOutputStream& os, const TCgiParameters& cgiParams, const TOptionalParams& params) - : Outer(outer) - , Os(os) - , CgiParams(cgiParams) - , Params(params) - { - } + : Outer(outer) + , Os(os) + , CgiParams(cgiParams) + , Params(params) + { + } void CrumbsParentLinks() { for (unsigned i = 0; i < Params.ParentLinks.size(); ++i) { @@ -482,7 +482,7 @@ struct TBusWww::TImpl { if (needTick) { ticks.BeginList(); ticks.WriteInt(i); - ticks.WriteString(Sprintf(":%02u:%02u", (unsigned)minuteOfHour, (unsigned)secondOfMinute)); + ticks.WriteString(Sprintf(":%02u:%02u", (unsigned)minuteOfHour, (unsigned)secondOfMinute)); ticks.EndList(); } } @@ -554,10 +554,10 @@ struct TBusWww::TImpl { { TDivGuard div; TTagGuard button("button", - TAttr("type", "button"), - TAttr("class", "btn"), - TAttr("data-toggle", "collapse"), - TAttr("data-target", "#connections")); + TAttr("type", "button"), + TAttr("class", "btn"), + TAttr("data-toggle", "collapse"), + TAttr("data-target", "#connections")); Text("Show connection details"); } { @@ -572,7 +572,7 @@ struct TBusWww::TImpl { H3("Message process time histogram"); const TDurationHistogram& h = - dumpStatus.ConnectionStatusSummary.WriterStatus.Incremental.ProcessDurationHistogram; + dumpStatus.ConnectionStatusSummary.WriterStatus.Incremental.ProcessDurationHistogram; { TDivGuard div; @@ -630,7 +630,7 @@ struct TBusWww::TImpl { } void WriteMessageCounterSensors(NMonitoring::TDeprecatedJsonWriter& sj, - TStringBuf labelName, TStringBuf sessionName, bool read, const TMessageCounter& counter) { + TStringBuf labelName, TStringBuf sessionName, bool read, const TMessageCounter& counter) { TStringBuf readOrWrite = read ? "read" : "write"; sj.OpenMetric(); @@ -647,7 +647,7 @@ struct TBusWww::TImpl { } void WriteSessionStatus(NMonitoring::TDeprecatedJsonWriter& sj, TStringBuf sessionName, bool client, - TBusSession* session) { + TBusSession* session) { TStringBuf labelName = client ? "mb_client_session" : "mb_server_session"; auto status = session->GetStatusRecordInternal(); @@ -675,9 +675,9 @@ struct TBusWww::TImpl { } WriteMessageCounterSensors(sj, labelName, sessionName, false, - status.ConnectionStatusSummary.WriterStatus.Incremental.MessageCounter); + status.ConnectionStatusSummary.WriterStatus.Incremental.MessageCounter); WriteMessageCounterSensors(sj, labelName, sessionName, true, - status.ConnectionStatusSummary.ReaderStatus.Incremental.MessageCounter); + status.ConnectionStatusSummary.ReaderStatus.Incremental.MessageCounter); } void ServeSolomonJson(const TString& q, const TString& cs, const TString& ss) { @@ -813,14 +813,14 @@ NBus::TBusWww::TBusWww() { } -NBus::TBusWww::~TBusWww() { +NBus::TBusWww::~TBusWww() { } -void NBus::TBusWww::RegisterClientSession(TBusClientSessionPtr s) { +void NBus::TBusWww::RegisterClientSession(TBusClientSessionPtr s) { Impl->RegisterClientSession(s); } -void TBusWww::RegisterServerSession(TBusServerSessionPtr s) { +void TBusWww::RegisterServerSession(TBusServerSessionPtr s) { Impl->RegisterServerSession(s); } @@ -833,8 +833,8 @@ void TBusWww::RegisterModule(TBusModule* module) { } void TBusWww::ServeHttp(IOutputStream& httpOutputStream, - const TCgiParameters& queryArgs, - const TBusWww::TOptionalParams& params) { + const TCgiParameters& queryArgs, + const TBusWww::TOptionalParams& params) { Impl->ServeHttp(httpOutputStream, queryArgs, params); } @@ -861,8 +861,8 @@ struct TBusWwwHttpServer::TImpl: public THttpServer::ICallBack { TClientRequestImpl(TBusWwwHttpServer::TImpl* outer) : Outer(outer) - { - } + { + } bool Reply(void*) override { Outer->ServeRequest(Input(), Output()); @@ -878,8 +878,8 @@ struct TBusWwwHttpServer::TImpl: public THttpServer::ICallBack { } TStringStream ss; ss << "HTTP/1.1 " - << code << " " << text << "\r\nConnection: Close\r\n\r\n" - << content; + << code << " " << text << "\r\nConnection: Close\r\n\r\n" + << content; return ss.Str(); } @@ -908,7 +908,7 @@ struct TBusWwwHttpServer::TImpl: public THttpServer::ICallBack { Www->ServeHttp(output, cgiParams, params); } catch (...) { output << MakeSimpleResponse(500, "Exception", - TString() + "Exception: " + CurrentExceptionMessage()); + TString() + "Exception: " + CurrentExceptionMessage()); } } @@ -926,5 +926,5 @@ NBus::TBusWwwHttpServer::TBusWwwHttpServer(TIntrusivePtr<TBusWww> www, unsigned { } -NBus::TBusWwwHttpServer::~TBusWwwHttpServer() { +NBus::TBusWwwHttpServer::~TBusWwwHttpServer() { } diff --git a/library/cpp/messagebus/www/www.h b/library/cpp/messagebus/www/www.h index 064f42b9db..6cd652b477 100644 --- a/library/cpp/messagebus/www/www.h +++ b/library/cpp/messagebus/www/www.h @@ -8,38 +8,38 @@ #include <library/cpp/cgiparam/cgiparam.h> namespace NBus { - class TBusWww: public TAtomicRefCount<TBusWww> { - public: - struct TLink { - TString Title; - TString Href; - }; + class TBusWww: public TAtomicRefCount<TBusWww> { + public: + struct TLink { + TString Title; + TString Href; + }; - struct TOptionalParams { - TVector<TLink> ParentLinks; - }; + struct TOptionalParams { + TVector<TLink> ParentLinks; + }; - TBusWww(); - ~TBusWww(); + TBusWww(); + ~TBusWww(); - void RegisterClientSession(TBusClientSessionPtr); - void RegisterServerSession(TBusServerSessionPtr); - void RegisterQueue(TBusMessageQueuePtr); - void RegisterModule(TBusModule*); + void RegisterClientSession(TBusClientSessionPtr); + void RegisterServerSession(TBusServerSessionPtr); + void RegisterQueue(TBusMessageQueuePtr); + void RegisterModule(TBusModule*); - void ServeHttp(IOutputStream& httpOutputStream, const TCgiParameters& queryArgs, const TOptionalParams& params = TOptionalParams()); + void ServeHttp(IOutputStream& httpOutputStream, const TCgiParameters& queryArgs, const TOptionalParams& params = TOptionalParams()); - struct TImpl; - THolder<TImpl> Impl; - }; + struct TImpl; + THolder<TImpl> Impl; + }; - class TBusWwwHttpServer { - public: - TBusWwwHttpServer(TIntrusivePtr<TBusWww> www, unsigned port); - ~TBusWwwHttpServer(); + class TBusWwwHttpServer { + public: + TBusWwwHttpServer(TIntrusivePtr<TBusWww> www, unsigned port); + ~TBusWwwHttpServer(); - struct TImpl; - THolder<TImpl> Impl; - }; + struct TImpl; + THolder<TImpl> Impl; + }; -} +} |