10 #include <common/flags.h> 39 std::string
endpoint = std::string(),
40 std::shared_ptr<zmq::context_t> context =
nullptr);
45 void publish(
void const* data,
size_t len, int64_t tag);
46 void publish(std::vector<char>&& data, int64_t tag);
49 void run(std::string
endpoint, std::promise<std::string>&& endpointP);
51 std::shared_ptr<zmq::context_t> context_;
52 mutable std::string endpoint_;
53 mutable std::future<std::string> endpointF_;
54 mutable std::mutex endpointM_;
56 std::atomic<bool> stop_{
false};
58 std::vector<char> data_;
61 std::condition_variable dataCV_;
83 std::function<void(void const* data, size_t len, int64_t tag)>;
88 std::vector<std::string> endpoints,
89 std::shared_ptr<zmq::context_t> context =
nullptr);
92 void updateEndpoints(std::vector<std::string> endpoints);
98 std::shared_ptr<zmq::context_t> context_;
99 std::vector<std::string> endpoints_;
100 std::mutex endpointsM_;
102 std::atomic<bool> stop_{
false};
103 std::atomic<bool> endpointsChanged_{
false};
std::string endpoint() const
Definition: blobpubsub.cpp:52
Definition: blobpubsub.h:35
std::function< void(void const *data, size_t len, int64_t tag)> CallbackFn
Definition: blobpubsub.h:83
~BlobPublisher()
Definition: blobpubsub.cpp:46
DEFINE_FLAG_OPERATORS(BlobPublisher::DataFlags)
Publisher for ZeroMQ PUB-SUB pattern.
Definition: blobpubsub.h:30
The TorchCraftAI training library.
Definition: batcher.cpp:15
Definition: blobpubsub.h:34
BlobPublisher(std::string endpoint=std::string(), std::shared_ptr< zmq::context_t > context=nullptr)
Definition: blobpubsub.cpp:35
Definition: blobpubsub.h:33
void publish(void const *data, size_t len, int64_t tag)
Definition: blobpubsub.cpp:61
DataFlags
Definition: blobpubsub.h:32
Subscriber for ZeroMQ PUB-SUB pattern.
Definition: blobpubsub.h:80