diff options
author | leo <leo@yandex-team.ru> | 2022-02-10 16:46:40 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:40 +0300 |
commit | 99609724f661f7e21d1cb08e8d80e87c3632fdb3 (patch) | |
tree | 49e222ea1c5804306084bb3ae065bb702625360f /library/cpp/messagebus/oldmodule | |
parent | 980edcd3304699edf9d4e4d6a656e585028e2a72 (diff) | |
download | ydb-99609724f661f7e21d1cb08e8d80e87c3632fdb3.tar.gz |
Restoring authorship annotation for <leo@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/messagebus/oldmodule')
-rw-r--r-- | library/cpp/messagebus/oldmodule/module.cpp | 46 | ||||
-rw-r--r-- | library/cpp/messagebus/oldmodule/module.h | 10 | ||||
-rw-r--r-- | library/cpp/messagebus/oldmodule/startsession.cpp | 6 |
3 files changed, 31 insertions, 31 deletions
diff --git a/library/cpp/messagebus/oldmodule/module.cpp b/library/cpp/messagebus/oldmodule/module.cpp index 3dc9c80a94..24bd778799 100644 --- a/library/cpp/messagebus/oldmodule/module.cpp +++ b/library/cpp/messagebus/oldmodule/module.cpp @@ -60,7 +60,7 @@ namespace { } -namespace NBus { +namespace NBus { namespace NPrivate { class TJobStorage { }; @@ -327,11 +327,11 @@ namespace NBus { { Handler = TJobHandler(&TBusModule::Start); } - + TBusJob::~TBusJob() { Y_ASSERT(Pending.size() == 0); //Y_ASSERT(SleepUntil == 0); - + ClearAllMessageStates(); } @@ -618,7 +618,7 @@ namespace NBus { } ////////////////////////////////////////////////////////////////////// - + void TBusModuleImpl::CancelJob(TBusJob* job, EMessageStatus status) { TWhatThreadDoesAcquireGuard<TMutex> G(Lock, "modules: acquiring lock for CancelJob"); if (job) { @@ -636,8 +636,8 @@ namespace NBus { strReturn += "TODO\n"; } return strReturn; - } - + } + TBusModuleConfig::TBusModuleConfig() : StarterMaxInFlight(1000) { @@ -652,10 +652,10 @@ namespace NBus { : Impl(new TBusModuleImpl(this, name)) { } - + TBusModule::~TBusModule() { } - + const char* TBusModule::GetName() const { return Impl->Name; } @@ -680,7 +680,7 @@ namespace NBus { bool TBusModule::Shutdown() { Impl->Shutdown(); - + return true; } @@ -688,16 +688,16 @@ namespace NBus { TBusJob* job = new TBusJob(this, message); return job; } - + /** -Example for external session creation: - -TBusSession* TMyModule::CreateExtSession(TBusMessageQueue& queue) { - TBusSession* session = CreateDefaultDestination(queue, &ExternalProto, ExternalConfig); - session->RegisterService(hostname, begin, end); - return session; -*/ - +Example for external session creation: + +TBusSession* TMyModule::CreateExtSession(TBusMessageQueue& queue) { + TBusSession* session = CreateDefaultDestination(queue, &ExternalProto, ExternalConfig); + session->RegisterService(hostname, begin, end); + return session; +*/ + bool TBusModule::CreatePrivateSessions(TBusMessageQueue* queue) { Impl->Queue = queue; return true; @@ -782,11 +782,11 @@ void TBusModuleImpl::DestroyJob(TJobRunner* job) { ShutdownCondVar.BroadCast(); } } - } + } job->JobStorageIterator = TList<TJobRunner*>::iterator(); } - + void TBusModuleImpl::OnMessageReceived(TAutoPtr<TBusMessage> msg0, TOnMessageContext& context) { TBusMessage* msg = !!msg0 ? msg0.Get() : context.GetMessage(); Y_VERIFY(!!msg); @@ -797,7 +797,7 @@ void TBusModuleImpl::OnMessageReceived(TAutoPtr<TBusMessage> msg0, TOnMessageCon SetJob(jobRunner->Job->Message, jobRunner.Get()); AtomicIncrement(JobCount); - + AddJob(jobRunner.Get()); jobRunner.Release()->Schedule(); @@ -858,14 +858,14 @@ void TModuleClientHandler::OnReply(TAutoPtr<TBusMessage> req, TAutoPtr<TBusMessa job->EnqueueAndSchedule(TJobResponseMessage(req.Release(), resp.Release(), MESSAGE_OK)); job->UnRef(); } - + void TModuleClientHandler::OnMessageSentOneWay(TAutoPtr<TBusMessage> req) { TJobRunner* job = GetJob(req.Get()); Y_ASSERT(job); Y_ASSERT(job->Job->Message != req.Get()); job->EnqueueAndSchedule(TJobResponseMessage(req.Release(), nullptr, MESSAGE_OK)); job->UnRef(); -} +} void TModuleClientHandler::OnError(TAutoPtr<TBusMessage> msg, EMessageStatus status) { TJobRunner* job = GetJob(msg.Get()); diff --git a/library/cpp/messagebus/oldmodule/module.h b/library/cpp/messagebus/oldmodule/module.h index dc3b6377f0..8d1c4a5d52 100644 --- a/library/cpp/messagebus/oldmodule/module.h +++ b/library/cpp/messagebus/oldmodule/module.h @@ -9,7 +9,7 @@ /// NBus::TBusSession. /// To implement the module some virtual functions needs to be overridden: - + /// NBus::TBusModule::CreateExtSession() creates and registers an /// external session that receives incoming messages as input for module /// processing. @@ -18,13 +18,13 @@ /// NBus::TBusJob is somewhat similar to a thread, it maintains all the state /// during processing of one incoming message. Default implementation of /// NBus::TBusJob will maintain all send and received messages during -/// lifetime of this job. Each message, status and reply can be found +/// lifetime of this job. Each message, status and reply can be found /// within NBus::TJobState using NBus::TBusJob::GetState(). If your module /// needs to maintain an additional information during lifetime of the job /// you can derive your own class from NBus::TBusJob and override job -/// factory method NBus::IJobFactory::CreateJobInstance() to create your instances. +/// factory method NBus::IJobFactory::CreateJobInstance() to create your instances. -/// Processing of a given message starts with a call to NBus::TBusModule::Start() +/// Processing of a given message starts with a call to NBus::TBusModule::Start() /// handler that should be overridden in the module implementation. Within /// the callback handler module can perform any computation and access any /// datastore tables that it needs. The handler can also access any module @@ -33,7 +33,7 @@ /// Handler should use NBus::TBusJob::Send() to send messages to other client /// sessions and it can use NBus::TBusJob::Reply() to send reply to the main -/// job message. When handler is done, it returns the pointer to the next handler to call +/// job message. When handler is done, it returns the pointer to the next handler to call /// when all pending messages have cleared. If handler /// returns pointer to itself the module will reschedule execution of this handler /// for a later time. This should be done in case NBus::TBusJob::Send() returns diff --git a/library/cpp/messagebus/oldmodule/startsession.cpp b/library/cpp/messagebus/oldmodule/startsession.cpp index 0827972d88..7c38801d62 100644 --- a/library/cpp/messagebus/oldmodule/startsession.cpp +++ b/library/cpp/messagebus/oldmodule/startsession.cpp @@ -18,7 +18,7 @@ #include <library/cpp/messagebus/ybus.h> -namespace NBus { +namespace NBus { void* TBusStarter::_starter(void* data) { TBusStarter* pThis = static_cast<TBusStarter*>(data); pThis->Starter(); @@ -61,5 +61,5 @@ namespace NBus { } } } - -} + +} |