First pass through turning instance into ++
[m6w6/libmemcached] / libmemcached / instance.h
index 16d509f02a6f6bd798872edb1d444018f307c3e0..1c81da4447f2c7a34c1220eb44a39b1323c8b5ec 100644 (file)
 #define MEMCACHED_NI_MAXSERV 32
 #endif
 
-struct memcached_instance_st {
+#ifdef __cplusplus
+
+namespace org {
+namespace libmemcached {
+
+struct Instance {
+  in_port_t port() const
+  {
+    return port_;
+  }
+
+  void port(in_port_t arg)
+  {
+    port_= arg;
+  }
+
+  inline void mark_server_as_clean()
+  {
+    server_failure_counter= 0;
+    next_retry= 0;
+  }
+
   struct {
     bool is_allocated:1;
     bool is_initialized:1;
@@ -63,7 +84,7 @@ struct memcached_instance_st {
   } options;
   uint32_t number_of_hosts;
   uint32_t cursor_active;
-  in_port_t port;
+  in_port_t port_;
   memcached_socket_t fd;
   uint32_t io_bytes_sent; /* # bytes sent since last read */
   uint32_t request_id;
@@ -96,3 +117,8 @@ struct memcached_instance_st {
   char write_buffer[MEMCACHED_MAX_BUFFER];
   char hostname[MEMCACHED_NI_MAXHOST];
 };
+
+} // namespace libmemcached
+} // namespace org
+
+#endif