BlueZero (BØ)
Middleware for distributed applications
client.h
1 #ifndef B0__RESOLVER__CLIENT_H__INCLUDED
2 #define B0__RESOLVER__CLIENT_H__INCLUDED
3 
4 #include <b0/protobuf/service_client.h>
5 
6 #include <cstdint>
7 #include <string>
8 
9 namespace b0
10 {
11 
12 class Node;
13 
14 namespace resolver_msgs
15 {
16 
17 class Request;
18 class Response;
19 class Graph;
20 
21 } // namespace resolver_msgs
22 
23 namespace resolver
24 {
25 
31 class Client : public protobuf::ServiceClient<b0::resolver_msgs::Request, b0::resolver_msgs::Response>
32 {
33 public:
37  Client(b0::Node *node);
38 
42  virtual ~Client();
43 
49  void setAnnounceTimeout(int timeout = -1);
50 
54  virtual void announceNode(std::string &node_name, std::string &xpub_sock_addr, std::string &xsub_sock_addr);
55 
59  virtual void notifyShutdown();
60 
64  virtual void sendHeartbeat(int64_t *time_usec = nullptr);
65 
69  virtual void notifyTopic(std::string topic_name, bool reverse, bool active);
70 
74  virtual void notifyService(std::string service_name, bool reverse, bool active);
75 
79  virtual void announceService(std::string name, std::string addr);
80 
84  virtual void resolveService(std::string name, std::string &addr);
85 
89  virtual void getGraph(b0::resolver_msgs::Graph &graph);
90 
91 private:
92  int announce_timeout_;
93 };
94 
95 } // namespace resolver
96 
97 } // namespace b0
98 
99 #endif // B0__RESOLVER__CLIENT_H__INCLUDED
virtual void announceNode(std::string &node_name, std::string &xpub_sock_addr, std::string &xsub_sock_addr)
Announce this node to resolver.
virtual void getGraph(b0::resolver_msgs::Graph &graph)
Request the node sockets graph.
The resolver client.
Definition: client.h:31
virtual void notifyService(std::string service_name, bool reverse, bool active)
Notify service advertising/use start or end.
virtual void sendHeartbeat(int64_t *time_usec=nullptr)
Send a heartbeat to resolver.
virtual ~Client()
Resolver client destructor.
The abstraction for a node in the network.
Definition: node.h:40
virtual void resolveService(std::string name, std::string &addr)
Resolve a service name.
virtual void notifyTopic(std::string topic_name, bool reverse, bool active)
Notify topic publishing/subscription start or end.
void setAnnounceTimeout(int timeout=-1)
Set a timeout for the read in the announce phase. Use -1 for no timeout. A timeout will cause the ann...
virtual void announceService(std::string name, std::string addr)
Announce a service name and address.
A complete graph of the network.
Definition: resolver.proto:141
virtual void notifyShutdown()
Notify resolver of this node shutdown.
Definition: node.h:17
Client(b0::Node *node)
Resolver client constructr.