Merge in conversion to C++.
[awesomized/libmemcached] / libmemcached / memcached.h
index 311d5f26d2f5d6665a4bda0efc349fc53b37e56a..f32fe0e794cf2105a6e5864b1bca5ad8a70c3d2e 100644 (file)
@@ -35,8 +35,7 @@
  *
  */
 
-#ifndef __LIBMEMCACHED_MEMCACHED_H__
-#define __LIBMEMCACHED_MEMCACHED_H__
+#pragma once
 
 #include <inttypes.h>
 #include <stdlib.h>
 #include <libmemcached/configure.h>
 #include <libmemcached/platform.h>
 #include <libmemcached/constants.h>
+#include <libmemcached/return.h>
 #include <libmemcached/types.h>
 #include <libmemcached/string.h>
 #include <libmemcached/array.h>
 #include <libmemcached/error.h>
 #include <libmemcached/stats.h>
 #include <libhashkit/hashkit.h>
+
 // Everything above this line must be in the order specified.
 #include <libmemcached/allocators.h>
 #include <libmemcached/analyze.h>
@@ -101,10 +102,8 @@ struct memcached_st {
     bool no_block:1; // Don't block
     bool no_reply:1;
     bool randomize_replica_read:1;
-    bool reuse_memory:1;
     bool support_cas:1;
     bool tcp_nodelay:1;
-    bool use_cache_lookups:1;
     bool use_sort_hosts:1;
     bool use_udp:1;
     bool verify_key:1;
@@ -129,6 +128,7 @@ struct memcached_st {
   int send_size;
   int recv_size;
   void *user_data;
+  uint64_t query_id;
   uint32_t number_of_replicas;
   hashkit_st distribution_hashkit;
   memcached_result_st result;
@@ -143,13 +143,7 @@ struct memcached_st {
 
   struct memcached_virtual_bucket_t *virtual_bucket;
 
-  struct _allocators_st {
-    memcached_calloc_fn calloc;
-    memcached_free_fn free;
-    memcached_malloc_fn malloc;
-    memcached_realloc_fn realloc;
-    void *context;
-  } allocators;
+  struct memcached_allocator_t allocators;
 
   memcached_clone_fn on_clone;
   memcached_cleanup_fn on_cleanup;
@@ -157,9 +151,12 @@ struct memcached_st {
   memcached_trigger_delete_key_fn delete_trigger;
   memcached_callback_st *callbacks;
   struct memcached_sasl_st sasl;
-  struct memcached_error_st *error_messages;
+  struct memcached_error_t *error_messages;
   struct memcached_array_st *prefix_key;
   struct {
+    uint32_t initial_pool_size;
+    uint32_t max_pool_size;
+    int32_t version; // This is used by pool and others to determine if the memcached_st is out of date.
     struct memcached_array_st *filename;
   } configure;
   struct {
@@ -179,7 +176,7 @@ LIBMEMCACHED_API
 memcached_st *memcached_create(memcached_st *ptr);
 
 LIBMEMCACHED_API
-memcached_st *memcached_create_with_options(const char *string, size_t length);
+memcached_st *memcached(const char *string, size_t string_length);
 
 LIBMEMCACHED_API
 void memcached_free(memcached_st *ptr);
@@ -208,39 +205,9 @@ memcached_server_instance_st memcached_server_instance_by_position(const memcach
 LIBMEMCACHED_API
 uint32_t memcached_server_count(const memcached_st *);
 
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
+LIBMEMCACHED_API
+uint64_t memcached_query_id(const memcached_st *);
 
 #ifdef __cplusplus
-class Memcached : private memcached_st {
-public:
-
-  Memcached()
-  {
-    memcached_create(this);
-  }
-
-  ~Memcached()
-  {
-    memcached_free(this);
-  }
-
-  Memcached(const Memcached& source)
-  {
-    memcached_clone(this, &source);
-  }
-
-  Memcached& operator=(const Memcached& source)
-  {
-    memcached_free(this);
-    memcached_clone(this, &source);
-
-    return *this;
-  }
-};
+} // extern "C"
 #endif
-
-#endif /* __LIBMEMCACHED_MEMCACHED_H__ */
-