memcached_return *error);
memcached_return
memcached_fetch_execute(memcached_st *ptr,
- unsigned int (*callback[])(memcached_st *ptr, memcached_result_st *result, void *context),
+ memcached_return (*callback[])(memcached_st *ptr, memcached_result_st *result, void *context),
void *context,
unsigned int number_of_callbacks);
typedef void (*memcached_free_function)(memcached_st *ptr, void *mem);
typedef void *(*memcached_malloc_function)(memcached_st *ptr, const size_t size);
typedef void *(*memcached_realloc_function)(memcached_st *ptr, void *mem, const size_t size);
-typedef unsigned int (*memcached_execute_function)(memcached_st *ptr, memcached_result_st *result, void *context);
+typedef memcached_return (*memcached_execute_function)(memcached_st *ptr, memcached_result_st *result, void *context);
+typedef memcached_return (*memcached_server_function)(memcached_st *ptr, memcached_server_st *server, void *context);
typedef enum {
MEMCACHED_DISTRIBUTION_MODULA,
memcached_callback flag,
memcached_return *error);
+memcached_return memcached_server_cursor(memcached_st *ptr,
+ memcached_server_function *callback,
+ void *context,
+ unsigned int number_of_callbacks);
+
/* Result Struct */
void memcached_result_free(memcached_result_st *result);
memcached_result_st *memcached_result_create(memcached_st *ptr,
memcached_parse.c \
memcached_response.c \
memcached_result.c \
+ memcached_server.c \
memcached_storage.c \
memcached_string.c \
memcached_stats.c \
for (x= 0; x < number_of_callbacks; x++)
{
- unsigned int iferror;
+ memcached_return iferror;
iferror= (*callback[x])(ptr, result, context);
- if (iferror)
+ if (iferror != MEMCACHED_SUCCESS)
continue;
}
}
--- /dev/null
+#include "common.h"
+
+memcached_return memcached_server_cursor(memcached_st *ptr,
+ memcached_server_function *callback,
+ void *context,
+ unsigned int number_of_callbacks)
+{
+ unsigned int y;
+
+ for (y= 0; y < ptr->number_of_hosts; y++)
+ {
+ unsigned int x;
+
+ for (x= 0; x < number_of_callbacks; x++)
+ {
+ unsigned int iferror;
+
+ iferror= (*callback[x])(ptr, &ptr->hosts[y], context);
+
+ if (iferror)
+ continue;
+ }
+ }
+
+ return MEMCACHED_SUCCESS;
+}
return 0;
}
+memcached_return server_function(memcached_st *ptr, memcached_server_st *server, void *context)
+{
+ /* Do Nothing */
+
+ return MEMCACHED_SUCCESS;
+}
+
+uint8_t memcached_server_cursor_test(memcached_st *memc)
+{
+ char *context= "foo bad";
+ memcached_server_function callbacks[1];
+
+ callbacks[0]= server_function;
+ memcached_server_cursor(memc, callbacks, context, 1);
+
+ return 0;
+}
+
uint8_t bad_key_test(memcached_st *memc)
{
memcached_return rc;
rc= memcached_set(memc, key, strlen(key),
value, value_length,
(time_t)0, (uint32_t)0);
- WATCHPOINT_ERROR(rc);
assert(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED);
}
size_t key_length[]= {5, 3, 4};
unsigned int x;
unsigned int counter;
- unsigned int (*callbacks[1])(memcached_st *, memcached_result_st *, void *);
+ memcached_execute_function callbacks[1];
/* We need to empty the server before continueing test */
rc= memcached_flush(memc, 0);
{"callback_test", 0, get_stats_keys },
{"version_string_test", 0, version_string_test},
{"bad_key", 1, bad_key_test },
+ {"memcached_server_cursor", 1, memcached_server_cursor_test },
{0, 0, 0}
};