From: Brian Aker Date: Fri, 8 Jan 2010 23:24:33 +0000 (-0800) Subject: Updated docs for server_cursor() API. X-Git-Tag: 0.37~14 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=2d95fdb425ede1d1cade2853bc8a1fb6016f0cb9;p=m6w6%2Flibmemcached Updated docs for server_cursor() API. --- diff --git a/ChangeLog b/ChangeLog index b1a7f9d1..76e5006b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,8 @@ 0.37 * Fixed build for libhashkit. - * Fixed install path regression. - * Modified RPM to strict check install. + * Fixed install path regression. + * Modified RPM to strict check install. + * Added documentation for memcached_server_cursor(); 0.36 Wed Jan 6 18:23:50 PST 2010 * Merged in new memslap utility. diff --git a/docs/Makefile.am b/docs/Makefile.am index 33073dca..1dac6ade 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -14,26 +14,26 @@ BUILT_SOURCES= EXTRA_DIST= make_index.pl AUTO_PAGES= \ - memcached_increment.pop \ - memcached_increment_with_initial.pop \ - memcached_decrement.pop \ - memcached_decrement_with_initial.pop + memcached_increment.pop \ + memcached_increment_with_initial.pop \ + memcached_decrement.pop \ + memcached_decrement_with_initial.pop BUILT_SOURCES += ${AUTO_PAGES} BEHAVIOR_PAGES= \ - memcached_behavior_get.pop \ - memcached_behavior_set.pop + memcached_behavior_get.pop \ + memcached_behavior_set.pop BUILT_SOURCES += ${BEHAVIOR_PAGES} CALLBACK_PAGES= \ - memcached_callback_get.pop \ - memcached_callback_set.pop + memcached_callback_get.pop \ + memcached_callback_set.pop BUILT_SOURCES += ${CALLBACK_PAGES} CREATE_PAGES= \ - memcached_create.pop \ - memcached_free.pop \ - memcached_clone.pop + memcached_create.pop \ + memcached_free.pop \ + memcached_clone.pop BUILT_SOURCES += ${CREATE_PAGES} DELETE_PAGES= \ @@ -42,26 +42,26 @@ DELETE_PAGES= \ BUILT_SOURCES += ${DELETE_PAGES} GENERIC_PAGES= \ - libmemcached.pop \ - libmemcached_examples.pop \ - libmemcachedutil.pop \ - memcached_analyze.pop \ - memcached_dump.pop \ - memcached_flush.pop \ - memcached_flush_buffers.pop \ - memcached_generate_hash_value.pop \ - memcached_quit.pop \ - memcached_strerror.pop \ - memcached_verbosity.pop \ - memcapable.pop \ - memcat.pop \ - memcp.pop \ - memdump.pop \ - memerror.pop \ - memflush.pop \ - memrm.pop \ - memslap.pop \ - memstat.pop + libmemcached.pop \ + libmemcached_examples.pop \ + libmemcachedutil.pop \ + memcached_analyze.pop \ + memcached_dump.pop \ + memcached_flush.pop \ + memcached_flush_buffers.pop \ + memcached_generate_hash_value.pop \ + memcached_quit.pop \ + memcached_strerror.pop \ + memcached_verbosity.pop \ + memcapable.pop \ + memcat.pop \ + memcp.pop \ + memdump.pop \ + memerror.pop \ + memflush.pop \ + memrm.pop \ + memslap.pop \ + memstat.pop BUILT_SOURCES += ${GENERIC_PAGES} GET_PAGES= \ @@ -82,12 +82,12 @@ MEMORY_ALLOCATORS_PAGES= \ BUILT_SOURCES += ${MEMORY_ALLOCATORS_PAGES} POOL_PAGES= \ - memcached_pool_behavior_get.pop \ - memcached_pool_behavior_set.pop \ - memcached_pool_create.pop \ - memcached_pool_destroy.pop \ - memcached_pool_pop.pop \ - memcached_pool_push.pop + memcached_pool_behavior_get.pop \ + memcached_pool_behavior_set.pop \ + memcached_pool_create.pop \ + memcached_pool_destroy.pop \ + memcached_pool_pop.pop \ + memcached_pool_push.pop BUILT_SOURCES += ${POOL_PAGES} RESULT_PAGES= \ @@ -105,6 +105,7 @@ BUILT_SOURCES += ${RESULT_PAGES} SERVER_PAGES= \ memcached_server_count.pop \ + memcached_server_cursor.pop \ memcached_server_list.pop \ memcached_server_add.pop \ memcached_server_add_unix_socket.pop \ @@ -134,10 +135,10 @@ SET_PAGES= \ BUILT_SOURCES += ${SET_PAGES} STATS_PAGES= \ - memcached_stat.pop \ - memcached_stat_get_keys.pop .pop\ - memcached_stat_get_value.pop \ - memcached_stat_servername.pop + memcached_stat.pop \ + memcached_stat_get_keys.pop .pop\ + memcached_stat_get_value.pop \ + memcached_stat_servername.pop BUILT_SOURCES += ${STATS_PAGES} USER_DATA_PAGES= \ @@ -155,27 +156,27 @@ BUILT_SOURCES += ${VERSION_PAGES} # These are for libhashkit # HASHKIT_CREATE_PAGES= \ - hashkit_is_allocated.pop \ - hashkit_create.pop \ - hashkit_clone.pop \ - hashkit_free.pop + hashkit_is_allocated.pop \ + hashkit_create.pop \ + hashkit_clone.pop \ + hashkit_free.pop BUILT_SOURCES += ${HASHKIT_CREATE_PAGES} HASHKIT_FUNCTIONS_PAGES= \ - hashkit_crc32.pop \ - hashkit_fnv1_32.pop \ - hashkit_fnv1_64.pop \ - hashkit_fnv1a_32.pop \ - hashkit_fnv1a_64.pop \ - hashkit_functions.pop \ - hashkit_hsieh.pop \ - hashkit_jenkins.pop \ - hashkit_md5.pop \ - hashkit_murmur.pop + hashkit_crc32.pop \ + hashkit_fnv1_32.pop \ + hashkit_fnv1_64.pop \ + hashkit_fnv1a_32.pop \ + hashkit_fnv1a_64.pop \ + hashkit_functions.pop \ + hashkit_hsieh.pop \ + hashkit_jenkins.pop \ + hashkit_md5.pop \ + hashkit_murmur.pop BUILT_SOURCES += ${HASHKIT_FUNCTIONS_PAGES} HASHKIT_ST_PAGES= \ - hashkit_value.pop + hashkit_value.pop BUILT_SOURCES += ${HASHKIT_ST_PAGES} @@ -257,6 +258,7 @@ HTML_FILES= \ memcached_server_add.html \ memcached_server_add_unix_socket.html \ memcached_server_count.html \ + memcached_server_cursor.html \ memcached_server_list_append.html \ memcached_server_list_count.html \ memcached_server_list_free.html \ @@ -384,6 +386,7 @@ man_MANS = \ memcached_replace_by_key.3 \ memcached_server_add.3 \ memcached_server_count.3 \ + memcached_server_cursor.3 \ memcached_server_list.3 \ memcached_server_list_append.3 \ memcached_server_list_count.3 \ diff --git a/docs/memcached_servers.pod b/docs/memcached_servers.pod index 3cd5da9e..05b50a29 100644 --- a/docs/memcached_servers.pod +++ b/docs/memcached_servers.pod @@ -1,6 +1,6 @@ =head1 NAME -memcached_server_count, memcached_server_list, memcached_server_add, memcached_server_push, memcached_server_get_last_disconnect - Manage server list +memcached_server_count, memcached_server_list, memcached_server_add, memcached_server_push, memcached_server_get_last_disconnect, memcached_server_cursor - Manage server list =head1 LIBRARY @@ -41,6 +41,12 @@ C Client Library for memcached (libmemcached, -lmemcached) memcached_server_st * memcached_server_get_last_disconnect (memcached_st *ptr) + memcached_return_t + memcached_server_cursor(memcached_st *ptr, + memcached_server_fn *callback, + void *context, + uint32_t number_of_callbacks); + =head1 DESCRIPTION @@ -90,6 +96,13 @@ for which there was a connection problem. It does not mean this particular server is currently dead but if the library is reporting a server is, the returned server is a very good candidate. +memcached_server_cursor() takes a memcached_st and loops through the +list of hosts currently in the cursor calling the list of callback +functions provided. You can optionally pass in a value via +context which will be provided to each callback function. An error +return from any callback will terminate the loop. memcached_server_cursor() +is passed the original caller memcached_st in its current state. + =head1 RETURN Varies, see particular functions. diff --git a/libmemcached/server.c b/libmemcached/server.c index 42abda2d..d0ce3f74 100644 --- a/libmemcached/server.c +++ b/libmemcached/server.c @@ -113,11 +113,11 @@ memcached_return_t memcached_server_cursor(memcached_st *ptr, void *context, uint32_t number_of_callbacks) { - unsigned int y; + uint32_t y; for (y= 0; y < ptr->number_of_hosts; y++) { - unsigned int x; + uint32_t x; for (x= 0; x < number_of_callbacks; x++) {