aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/test/helper/example.h
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:17 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:17 +0300
commitd3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch)
treedd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/messagebus/test/helper/example.h
parent72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff)
downloadydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/messagebus/test/helper/example.h')
-rw-r--r--library/cpp/messagebus/test/helper/example.h200
1 files changed, 100 insertions, 100 deletions
diff --git a/library/cpp/messagebus/test/helper/example.h b/library/cpp/messagebus/test/helper/example.h
index 819562719d..26b7475308 100644
--- a/library/cpp/messagebus/test/helper/example.h
+++ b/library/cpp/messagebus/test/helper/example.h
@@ -10,123 +10,123 @@
#include <util/system/event.h>
-namespace NBus {
- namespace NTest {
- class TExampleRequest: public TBusMessage {
- friend class TExampleProtocol;
-
- private:
- TAllocCounter AllocCounter;
-
- public:
- TString Data;
-
- public:
- TExampleRequest(TAtomic* counterPtr, size_t payloadSize = 320);
- TExampleRequest(ECreateUninitialized, TAtomic* counterPtr);
- };
-
- class TExampleResponse: public TBusMessage {
- friend class TExampleProtocol;
-
- private:
- TAllocCounter AllocCounter;
-
- public:
- TString Data;
- TExampleResponse(TAtomic* counterPtr, size_t payloadSize = 320);
- TExampleResponse(ECreateUninitialized, TAtomic* counterPtr);
- };
-
- class TExampleProtocol: public TBusProtocol {
- public:
- TAtomic RequestCount;
- TAtomic ResponseCount;
- TAtomic RequestCountDeserialized;
- TAtomic ResponseCountDeserialized;
- TAtomic StartCount;
-
- TExampleProtocol(int port = 0);
-
- ~TExampleProtocol() override;
-
- void Serialize(const TBusMessage* message, TBuffer& buffer) override;
-
- TAutoPtr<TBusMessage> Deserialize(ui16 messageType, TArrayRef<const char> payload) override;
- };
-
- class TExampleClient: private TBusClientHandlerError {
- public:
- TExampleProtocol Proto;
- bool UseCompression;
- bool CrashOnError;
- size_t DataSize;
-
- ssize_t MessageCount;
- TAtomic RepliesCount;
- TAtomic Errors;
- EMessageStatus LastError;
+namespace NBus {
+ namespace NTest {
+ class TExampleRequest: public TBusMessage {
+ friend class TExampleProtocol;
+
+ private:
+ TAllocCounter AllocCounter;
+
+ public:
+ TString Data;
+
+ public:
+ TExampleRequest(TAtomic* counterPtr, size_t payloadSize = 320);
+ TExampleRequest(ECreateUninitialized, TAtomic* counterPtr);
+ };
+
+ class TExampleResponse: public TBusMessage {
+ friend class TExampleProtocol;
+
+ private:
+ TAllocCounter AllocCounter;
+
+ public:
+ TString Data;
+ TExampleResponse(TAtomic* counterPtr, size_t payloadSize = 320);
+ TExampleResponse(ECreateUninitialized, TAtomic* counterPtr);
+ };
+
+ class TExampleProtocol: public TBusProtocol {
+ public:
+ TAtomic RequestCount;
+ TAtomic ResponseCount;
+ TAtomic RequestCountDeserialized;
+ TAtomic ResponseCountDeserialized;
+ TAtomic StartCount;
+
+ TExampleProtocol(int port = 0);
+
+ ~TExampleProtocol() override;
+
+ void Serialize(const TBusMessage* message, TBuffer& buffer) override;
+
+ TAutoPtr<TBusMessage> Deserialize(ui16 messageType, TArrayRef<const char> payload) override;
+ };
+
+ class TExampleClient: private TBusClientHandlerError {
+ public:
+ TExampleProtocol Proto;
+ bool UseCompression;
+ bool CrashOnError;
+ size_t DataSize;
+
+ ssize_t MessageCount;
+ TAtomic RepliesCount;
+ TAtomic Errors;
+ EMessageStatus LastError;
TSystemEvent WorkDone;
- TBusMessageQueuePtr Bus;
- TBusClientSessionPtr Session;
+ TBusMessageQueuePtr Bus;
+ TBusClientSessionPtr Session;
- public:
- TExampleClient(const TBusClientSessionConfig sessionConfig = TBusClientSessionConfig(), int port = 0);
- ~TExampleClient() override;
+ public:
+ TExampleClient(const TBusClientSessionConfig sessionConfig = TBusClientSessionConfig(), int port = 0);
+ ~TExampleClient() override;
- EMessageStatus SendMessage(const TNetAddr* addr = nullptr);
+ EMessageStatus SendMessage(const TNetAddr* addr = nullptr);
- void SendMessages(size_t count, const TNetAddr* addr = nullptr);
- void SendMessages(size_t count, const TNetAddr& addr);
+ void SendMessages(size_t count, const TNetAddr* addr = nullptr);
+ void SendMessages(size_t count, const TNetAddr& addr);
- void ResetCounters();
- void WaitReplies();
- EMessageStatus WaitForError();
- void WaitForError(EMessageStatus status);
+ void ResetCounters();
+ void WaitReplies();
+ EMessageStatus WaitForError();
+ void WaitForError(EMessageStatus status);
- void SendMessagesWaitReplies(size_t count, const TNetAddr* addr = nullptr);
- void SendMessagesWaitReplies(size_t count, const TNetAddr& addr);
+ void SendMessagesWaitReplies(size_t count, const TNetAddr* addr = nullptr);
+ void SendMessagesWaitReplies(size_t count, const TNetAddr& addr);
- void OnReply(TAutoPtr<TBusMessage> mess, TAutoPtr<TBusMessage> reply) override;
+ void OnReply(TAutoPtr<TBusMessage> mess, TAutoPtr<TBusMessage> reply) override;
- void OnError(TAutoPtr<TBusMessage> mess, EMessageStatus) override;
- };
+ void OnError(TAutoPtr<TBusMessage> mess, EMessageStatus) override;
+ };
- class TExampleServer: private TBusServerHandlerError {
- public:
- TExampleProtocol Proto;
- bool UseCompression;
- bool AckMessageBeforeSendReply;
- TMaybe<size_t> DataSize; // Nothing means use request size
- bool ForgetRequest;
+ class TExampleServer: private TBusServerHandlerError {
+ public:
+ TExampleProtocol Proto;
+ bool UseCompression;
+ bool AckMessageBeforeSendReply;
+ TMaybe<size_t> DataSize; // Nothing means use request size
+ bool ForgetRequest;
- TTestSync TestSync;
+ TTestSync TestSync;
- TBusMessageQueuePtr Bus;
- TBusServerSessionPtr Session;
+ TBusMessageQueuePtr Bus;
+ TBusServerSessionPtr Session;
- public:
- TExampleServer(
- const char* name = "TExampleServer",
- const TBusServerSessionConfig& sessionConfig = TBusServerSessionConfig());
+ public:
+ TExampleServer(
+ const char* name = "TExampleServer",
+ const TBusServerSessionConfig& sessionConfig = TBusServerSessionConfig());
- TExampleServer(unsigned port, const char* name = "TExampleServer");
+ TExampleServer(unsigned port, const char* name = "TExampleServer");
- ~TExampleServer() override;
+ ~TExampleServer() override;
- public:
- size_t GetInFlight() const;
- unsigned GetActualListenPort() const;
- // any of
- TNetAddr GetActualListenAddr() const;
+ public:
+ size_t GetInFlight() const;
+ unsigned GetActualListenPort() const;
+ // any of
+ TNetAddr GetActualListenAddr() const;
- void WaitForOnMessageCount(unsigned n);
+ void WaitForOnMessageCount(unsigned n);
- protected:
- void OnMessage(TOnMessageContext& mess) override;
- };
+ protected:
+ void OnMessage(TOnMessageContext& mess) override;
+ };
- }
-}
+ }
+}