Removing all of the multi-set bits (aka the buffer code is faster, so why
author <brian@gir.tangent.org> <>
Tue, 8 Jan 2008 19:12:56 +0000 (11:12 -0800)
committer <brian@gir.tangent.org> <>
Tue, 8 Jan 2008 19:12:56 +0000 (11:12 -0800)
bother).

lib/Makefile.am
lib/memcached_delete.c
lib/memcached_multistorage.c [deleted file]
tests/function.c

index 38c6e8f4e255fc6cd2378602b7495722b0a6cfe2..d63ef5839872761a1e4a783aa94b8208a4681f91 100644 (file)
@@ -41,7 +41,6 @@ libmemcached_la_SOURCES = crc.c \
                          memcached_hosts.c \
                          memcached_io.c \
                          md5.c \
-                         memcached_multistorage.c \
                          memcached_quit.c \
                          memcached_parse.c \
                          memcached_response.c \
index a7298141ab5f907df46b22711f2a228ccbf5a347..f0ff9ba6f06bef6a369511622f5c59e5ff034174 100644 (file)
@@ -63,57 +63,3 @@ error:
   LIBMEMCACHED_MEMCACHED_DELETE_END();
   return rc;
 }
-
-memcached_return memcached_mdelete(memcached_st *ptr, 
-                                   char **key, size_t *key_length,
-                                   unsigned int number_of_keys,
-                                   time_t expiration)
-{
-  return memcached_mdelete_by_key(ptr, NULL, 0,
-                                   key, key_length,
-                                   number_of_keys, expiration);
-
-}
-
-memcached_return memcached_mdelete_by_key(memcached_st *ptr, 
-                                          char *master_key, size_t master_key_length,
-                                          char **key, size_t *key_length,
-                                          unsigned int number_of_keys,
-                                          time_t expiration)
-{
-  size_t send_length;
-  memcached_return rc= MEMCACHED_SUCCESS;
-  char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
-  unsigned int master_server_key= 0;
-  unsigned int x;
-
-  LIBMEMCACHED_MEMCACHED_DELETE_START();
-
-  if (ptr->hosts == NULL || ptr->number_of_hosts == 0)
-    return MEMCACHED_NO_SERVERS;
-
-  if (master_key && master_key_length)
-    master_server_key= memcached_generate_hash(ptr, master_key, master_key_length);
-
-  for (x= 0; x < number_of_keys; x++)
-  {
-    unsigned int server_key;
-
-    if (master_key && master_key_length)
-      server_key= master_server_key;
-    else
-      server_key= memcached_generate_hash(ptr, key[x], key_length[x]);
-
-    if (expiration)
-      send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, 
-                            "delete %.*s %llu\r\n", (int)(key_length[x]), key[x], 
-                            (unsigned long long)expiration);
-    else
-      send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, 
-                            "delete %.*s\r\n", (int)(key_length[x]), key[x]);
-
-    (void)memcached_do(ptr, server_key, buffer, send_length, 0);
-  }
-
-  return MEMCACHED_BUFFERED;
-}
diff --git a/lib/memcached_multistorage.c b/lib/memcached_multistorage.c
deleted file mode 100644 (file)
index da093c9..0000000
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
-  Memcached library
-
-  memcached_set()
-  memcached_replace()
-  memcached_add()
-
-*/
-
-#include "common.h"
-#include "memcached_io.h"
-
-typedef enum {
-  SET_OP,
-  REPLACE_OP,
-  ADD_OP,
-  PREPEND_OP,
-  APPEND_OP,
-  CAS_OP,
-} memcached_storage_action;
-
-/* Inline this */
-static char *storage_op_string(memcached_storage_action verb)
-{
-  switch (verb)
-  {
-  case SET_OP:
-    return "set";
-  case REPLACE_OP:
-    return "replace";
-  case ADD_OP:
-    return "add";
-  case PREPEND_OP:
-    return "prepend";
-  case APPEND_OP:
-    return "append";
-  case CAS_OP:
-    return "cas";
-  };
-
-  return SET_OP;
-}
-
-static memcached_return memcached_msend(memcached_st *ptr, 
-                                        char *master_key, size_t master_key_length, 
-                                        char **key, size_t *key_length, 
-                                        char **value, size_t *value_length, 
-                                        unsigned int number_of_keys,
-                                        time_t expiration,
-                                        uint32_t flags,
-                                        uint64_t cas,
-                                        memcached_storage_action verb)
-{
-  size_t write_length;
-  ssize_t sent_length;
-  char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
-  unsigned int x;
-  unsigned int master_server_key= 0;
-  memcached_return rc= MEMCACHED_SUCCESS;
-
-  WATCHPOINT_ASSERT(key && key_length && value && value_length);
-
-  if (key_length == 0)
-    return MEMCACHED_NO_KEY_PROVIDED;
-
-  if (ptr->number_of_hosts == 0)
-    return MEMCACHED_NO_SERVERS;
-
-  if (master_key && master_key_length)
-    master_server_key= memcached_generate_hash(ptr, master_key, master_key_length);
-
-  for (x= 0; x < number_of_keys; x++)
-  {
-    unsigned int server_key;
-    memcached_return tried;
-
-    if (master_server_key)
-      server_key= master_server_key;
-    else
-      server_key= memcached_generate_hash(ptr, key[x], key_length[x]);
-
-
-    if (cas)
-      write_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, 
-                             "%s %.*s %u %llu %zu %llu\r\n", storage_op_string(verb),
-                             (int)key_length[x], key[x], flags, 
-                             (unsigned long long)expiration, value_length[x], 
-                             (unsigned long long)cas);
-    else
-      write_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, 
-                             "%s %.*s %u %llu %zu\r\n", storage_op_string(verb),
-                             (int)key_length[x], key[x], flags, 
-                             (unsigned long long)expiration, value_length[x]);
-
-    if (write_length >= MEMCACHED_DEFAULT_COMMAND_SIZE)
-      goto error;
-
-    tried=  memcached_do(ptr, server_key, buffer, write_length, 0);
-    if (tried != MEMCACHED_SUCCESS)
-      goto error;
-
-    if ((sent_length= memcached_io_write(ptr, server_key, value[x], value_length[x], 0)) == -1)
-      goto error;
-
-    if ((sent_length= memcached_io_write(ptr, server_key, "\r\n", 2, 0)) == -1)
-      goto error;
-
-    continue;
-
-error:
-    memcached_quit_server(ptr, server_key, 1);
-    continue;
-  }
-
-  for (x= 0; x < ptr->number_of_hosts; x++)
-  {
-    if (memcached_server_response_count(ptr, x))
-    {
-      /* We need to do something about non-connnected hosts in the future */
-      if ((memcached_io_write(ptr, x, NULL, 0, 1)) == -1)
-      {
-        rc= MEMCACHED_SOME_ERRORS;
-      }
-    }
-  }
-
-  return rc;
-}
-
-memcached_return memcached_mset(memcached_st *ptr, 
-                                char **key, size_t *key_length, 
-                                char **value, size_t *value_length, 
-                                unsigned int number_of_keys,
-                                time_t expiration,
-                                uint32_t flags)
-{
-  memcached_return rc;
-  LIBMEMCACHED_MEMCACHED_SET_START();
-  rc= memcached_msend(ptr, NULL, 0, 
-                      key, key_length, value, value_length,
-                      number_of_keys,
-                      expiration, flags, 0, SET_OP);
-  LIBMEMCACHED_MEMCACHED_SET_END();
-  return rc;
-}
-
-memcached_return memcached_madd(memcached_st *ptr, 
-                                char **key, size_t *key_length,
-                                char **value, size_t *value_length, 
-                                unsigned int number_of_keys,
-                                time_t expiration,
-                                uint32_t flags)
-{
-  memcached_return rc;
-  LIBMEMCACHED_MEMCACHED_ADD_START();
-  rc= memcached_msend(ptr, NULL, 0, 
-                      key, key_length, value, value_length,
-                      number_of_keys,
-                      expiration, flags, 0, ADD_OP);
-  LIBMEMCACHED_MEMCACHED_ADD_END();
-  return rc;
-}
-
-memcached_return memcached_mreplace(memcached_st *ptr, 
-                                    char **key, size_t *key_length,
-                                    char **value, size_t *value_length, 
-                                    unsigned int number_of_keys,
-                                    time_t expiration,
-                                    uint32_t flags)
-{
-  memcached_return rc;
-  LIBMEMCACHED_MEMCACHED_REPLACE_START();
-  rc= memcached_msend(ptr, NULL, 0, 
-                      key, key_length, value, value_length,
-                      number_of_keys,
-                      expiration, flags, 0, REPLACE_OP);
-  LIBMEMCACHED_MEMCACHED_REPLACE_END();
-  return rc;
-}
-
-memcached_return memcached_mprepend(memcached_st *ptr, 
-                                    char **key, size_t *key_length,
-                                    char **value, size_t *value_length, 
-                                    unsigned int number_of_keys,
-                                    time_t expiration,
-                                    uint32_t flags)
-{
-  memcached_return rc;
-  rc= memcached_msend(ptr, NULL, 0, 
-                      key, key_length, value, value_length,
-                      number_of_keys,
-                      expiration, flags, 0, PREPEND_OP);
-  return rc;
-}
-
-memcached_return memcached_mappend(memcached_st *ptr, 
-                                   char **key, size_t *key_length,
-                                   char **value, size_t *value_length, 
-                                   unsigned int number_of_keys,
-                                   time_t expiration,
-                                   uint32_t flags)
-{
-  memcached_return rc;
-  rc= memcached_msend(ptr, NULL, 0, 
-                      key, key_length, value, value_length,
-                      number_of_keys,
-                      expiration, flags, 0, APPEND_OP);
-  return rc;
-}
-
-memcached_return memcached_mcas(memcached_st *ptr, 
-                                char **key, size_t *key_length,
-                                char **value, size_t *value_length, 
-                                unsigned int number_of_keys,
-                                time_t expiration,
-                                uint32_t flags,
-                                uint64_t cas)
-{
-  memcached_return rc;
-  rc= memcached_msend(ptr, NULL, 0, 
-                      key, key_length, value, value_length,
-                      number_of_keys,
-                      expiration, flags, cas, APPEND_OP);
-  return rc;
-}
-
-memcached_return memcached_mset_by_key(memcached_st *ptr, 
-                                       char *master_key, size_t master_key_length, 
-                                       char **key, size_t *key_length, 
-                                       char **value, size_t *value_length, 
-                                       unsigned int number_of_keys,
-                                       time_t expiration,
-                                       uint32_t flags)
-{
-  memcached_return rc;
-  LIBMEMCACHED_MEMCACHED_SET_START();
-  rc= memcached_msend(ptr, master_key, master_key_length, 
-                      key, key_length, value, value_length,
-                      number_of_keys,
-                      expiration, flags, 0, SET_OP);
-  LIBMEMCACHED_MEMCACHED_SET_END();
-  return rc;
-}
-
-memcached_return memcached_madd_by_key(memcached_st *ptr, 
-                                       char *master_key, size_t master_key_length,
-                                       char **key, size_t *key_length,
-                                       char **value, size_t *value_length, 
-                                       unsigned int number_of_keys,
-                                       time_t expiration,
-                                       uint32_t flags)
-{
-  memcached_return rc;
-  LIBMEMCACHED_MEMCACHED_ADD_START();
-  rc= memcached_msend(ptr, master_key, master_key_length, 
-                      key, key_length, value, value_length,
-                      number_of_keys,
-                      expiration, flags, 0, ADD_OP);
-  LIBMEMCACHED_MEMCACHED_ADD_END();
-  return rc;
-}
-
-memcached_return memcached_mreplace_by_key(memcached_st *ptr, 
-                                           char *master_key, size_t master_key_length,
-                                           char **key, size_t *key_length,
-                                           char **value, size_t *value_length, 
-                                           unsigned int number_of_keys,
-                                           time_t expiration,
-                                           uint32_t flags)
-{
-  memcached_return rc;
-  LIBMEMCACHED_MEMCACHED_REPLACE_START();
-  rc= memcached_msend(ptr, master_key, master_key_length, 
-                      key, key_length, value, value_length,
-                      number_of_keys,
-                      expiration, flags, 0, REPLACE_OP);
-  LIBMEMCACHED_MEMCACHED_REPLACE_END();
-  return rc;
-}
-
-memcached_return memcached_mprepend_by_key(memcached_st *ptr, 
-                                           char *master_key, size_t master_key_length,
-                                           char **key, size_t *key_length,
-                                           char **value, size_t *value_length, 
-                                           unsigned int number_of_keys,
-                                           time_t expiration,
-                                           uint32_t flags)
-{
-  memcached_return rc;
-  rc= memcached_msend(ptr, master_key, master_key_length, 
-                      key, key_length, value, value_length,
-                      number_of_keys,
-                      expiration, flags, 0, PREPEND_OP);
-  return rc;
-}
-
-memcached_return memcached_mappend_by_key(memcached_st *ptr, 
-                                          char *master_key, size_t master_key_length,
-                                          char **key, size_t *key_length,
-                                          char **value, size_t *value_length, 
-                                          unsigned int number_of_keys,
-                                          time_t expiration,
-                                          uint32_t flags)
-{
-  memcached_return rc;
-  rc= memcached_msend(ptr, master_key, master_key_length, 
-                      key, key_length, value, value_length,
-                      number_of_keys,
-                      expiration, flags, 0, APPEND_OP);
-  return rc;
-}
-
-memcached_return memcached_mcas_by_key(memcached_st *ptr, 
-                                       char *master_key, size_t master_key_length,
-                                       char **key, size_t *key_length,
-                                       char **value, size_t *value_length, 
-                                       unsigned int number_of_keys,
-                                       time_t expiration,
-                                       uint32_t flags,
-                                       uint64_t cas)
-{
-  memcached_return rc;
-  rc= memcached_msend(ptr, master_key, master_key_length, 
-                      key, key_length, value, value_length,
-                      number_of_keys,
-                      expiration, flags, cas, APPEND_OP);
-  return rc;
-}
index 5343ab761edb4d41bc99f6b5d2cdaf2c39430e0f..0ecd7b1401f5a6258dad730a54fef60a4ca3e828 100644 (file)
@@ -29,8 +29,6 @@
 static pairs_st *global_pairs;
 static char *global_keys[GLOBAL_COUNT];
 static size_t global_keys_length[GLOBAL_COUNT];
-static char *global_values[GLOBAL_COUNT];
-static size_t global_values_length[GLOBAL_COUNT];
 
 uint8_t init_test(memcached_st *not_used)
 {
@@ -363,6 +361,7 @@ uint8_t add_test(memcached_st *memc)
   rc= memcached_add(memc, key, strlen(key), 
                     value, strlen(value),
                     (time_t)0, (uint32_t)0);
+  WATCHPOINT_ERROR(rc);
   assert(rc == MEMCACHED_NOTSTORED);
 
   return 0;
@@ -1835,16 +1834,6 @@ uint8_t delete_buffer_generate(memcached_st *memc)
   return 0;
 }
 
-uint8_t mdelete_generate(memcached_st *memc)
-{
-  memcached_return rc;
-
-  rc= memcached_mdelete(memc, global_keys, global_keys_length, GLOBAL_COUNT, 0);
-
-  return 0;
-}
-
-
 uint8_t free_data(memcached_st *memc)
 {
   pairs_free(global_pairs);
@@ -2147,7 +2136,6 @@ test_st generate_tests[] ={
   {"mget_read", 0, mget_read },
   {"mget_read_result", 0, mget_read_result },
   {"mget_read_function", 0, mget_read_function },
-  {"mdelete_generate", 0, mdelete_generate },
   {"cleanup", 1, cleanup_pairs },
   {0, 0, 0}
 };