From: Date: Wed, 20 May 2009 15:58:02 +0000 (-0700) Subject: Cleaned up structures for holes. X-Git-Tag: 0.30~7 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=cb617c6de5535ddbdb21779e02726f395b6a9d8d;p=m6w6%2Flibmemcached Cleaned up structures for holes. --- diff --git a/libmemcached/memcached.h b/libmemcached/memcached.h index 5e57f9ca..37064315 100644 --- a/libmemcached/memcached.h +++ b/libmemcached/memcached.h @@ -45,61 +45,70 @@ struct memcached_continuum_item_st { #define LIBMEMCACHED_VERSION_STRING "0.29" struct memcached_analysis_st { - uint64_t most_used_bytes; - uint64_t least_remaining_bytes; uint32_t average_item_size; uint32_t longest_uptime; uint32_t least_free_server; uint32_t most_consumed_server; uint32_t oldest_server; double pool_hit_ratio; + uint64_t most_used_bytes; + uint64_t least_remaining_bytes; }; struct memcached_stat_st { + uint32_t connection_structures; + uint32_t curr_connections; + uint32_t curr_items; uint32_t pid; - uint32_t uptime; - uint32_t threads; - uint32_t time; uint32_t pointer_size; - uint32_t rusage_user_seconds; - uint32_t rusage_user_microseconds; - uint32_t rusage_system_seconds; uint32_t rusage_system_microseconds; - uint32_t curr_items; - uint32_t total_items; - uint64_t limit_maxbytes; - uint32_t curr_connections; + uint32_t rusage_system_seconds; + uint32_t rusage_user_microseconds; + uint32_t rusage_user_seconds; + uint32_t threads; + uint32_t time; uint32_t total_connections; - uint32_t connection_structures; + uint32_t total_items; + uint32_t uptime; uint64_t bytes; + uint64_t bytes_read; + uint64_t bytes_written; uint64_t cmd_get; uint64_t cmd_set; + uint64_t evictions; uint64_t get_hits; uint64_t get_misses; - uint64_t evictions; - uint64_t bytes_read; - uint64_t bytes_written; + uint64_t limit_maxbytes; char version[MEMCACHED_VERSION_STRING_LENGTH]; }; struct memcached_st { uint8_t purging; bool is_allocated; - memcached_server_st *hosts; + uint32_t continuum_points_counter; + int32_t snd_timeout; + int32_t rcv_timeout; + uint32_t server_failure_limit; + uint32_t io_msg_watermark; + uint32_t io_bytes_watermark; + uint32_t io_key_prefetch; uint32_t number_of_hosts; uint32_t cursor_server; int cached_errno; uint32_t flags; - int send_size; - int recv_size; int32_t poll_timeout; int32_t connect_timeout; int32_t retry_timeout; - memcached_result_st result; + uint32_t continuum_count; memcached_hash hash; - memcached_server_distribution distribution; + int send_size; + int recv_size; + memcached_server_st *hosts; void *user_data; - uint32_t continuum_count; + time_t next_distribution_rebuild; + size_t prefix_key_length; + memcached_result_st result; + memcached_server_distribution distribution; memcached_continuum_item_st *continuum; memcached_clone_func on_clone; memcached_cleanup_func on_cleanup; @@ -109,16 +118,7 @@ struct memcached_st { memcached_trigger_key get_key_failure; memcached_trigger_delete_key delete_trigger; char prefix_key[MEMCACHED_PREFIX_KEY_MAX_SIZE]; - size_t prefix_key_length; memcached_hash hash_continuum; - uint32_t continuum_points_counter; - int32_t snd_timeout; - int32_t rcv_timeout; - uint32_t server_failure_limit; - uint32_t io_msg_watermark; - uint32_t io_bytes_watermark; - uint32_t io_key_prefetch; - time_t next_distribution_rebuild; }; diff --git a/libmemcached/memcached_result.h b/libmemcached/memcached_result.h index 69daaf5e..155a7abb 100644 --- a/libmemcached/memcached_result.h +++ b/libmemcached/memcached_result.h @@ -14,14 +14,14 @@ extern "C" { #endif struct memcached_result_st { + uint32_t flags; bool is_allocated; + time_t expiration; memcached_st *root; - char key[MEMCACHED_MAX_KEY]; size_t key_length; - memcached_string_st value; - uint32_t flags; uint64_t cas; - time_t expiration; + memcached_string_st value; + char key[MEMCACHED_MAX_KEY]; /* Add result callback function */ }; diff --git a/libmemcached/memcached_server.h b/libmemcached/memcached_server.h index ced58313..1d68f24e 100644 --- a/libmemcached/memcached_server.h +++ b/libmemcached/memcached_server.h @@ -15,30 +15,30 @@ extern "C" { struct memcached_server_st { bool is_allocated; - char hostname[MEMCACHED_MAX_HOST_LENGTH]; + bool sockaddr_inited; + uint16_t count; + unsigned int cursor_active; unsigned int port; - int fd; int cached_errno; - unsigned int cursor_active; - char write_buffer[MEMCACHED_MAX_BUFFER]; - size_t write_buffer_offset; - char read_buffer[MEMCACHED_MAX_BUFFER]; - size_t read_data_length; - size_t read_buffer_length; - char *read_ptr; - bool sockaddr_inited; - struct addrinfo *address_info; - memcached_connection type; + int fd; + uint32_t io_bytes_sent; /* # bytes sent since last read */ + uint32_t server_failure_counter; + uint32_t weight; uint8_t major_version; - uint8_t minor_version; uint8_t micro_version; - uint16_t count; + uint8_t minor_version; + memcached_connection type; + char *read_ptr; + size_t read_buffer_length; + size_t read_data_length; + size_t write_buffer_offset; + struct addrinfo *address_info; time_t next_retry; memcached_st *root; uint64_t limit_maxbytes; - uint32_t server_failure_counter; - uint32_t io_bytes_sent; /* # bytes sent since last read */ - uint32_t weight; + char read_buffer[MEMCACHED_MAX_BUFFER]; + char write_buffer[MEMCACHED_MAX_BUFFER]; + char hostname[MEMCACHED_MAX_HOST_LENGTH]; }; #define memcached_server_count(A) (A)->number_of_hosts diff --git a/libmemcached/memcached_string.h b/libmemcached/memcached_string.h index e7e6db4d..58d109d2 100644 --- a/libmemcached/memcached_string.h +++ b/libmemcached/memcached_string.h @@ -15,11 +15,11 @@ extern "C" { struct memcached_string_st { memcached_st *root; - bool is_allocated; char *end; + char *string; size_t current_size; size_t block_size; - char *string; + bool is_allocated; }; #define memcached_string_length(A) (size_t)((A)->end - (A)->string) diff --git a/tests/function.c b/tests/function.c index 9d557b3e..ba3c3219 100644 --- a/tests/function.c +++ b/tests/function.c @@ -3346,12 +3346,12 @@ static test_return noreply_test(memcached_st *memc) uint32_t flags; memcached_result_st results_obj; memcached_result_st *results; - ret=memcached_mget(memc, keys, lengths, 1); + ret= memcached_mget(memc, keys, lengths, 1); assert(ret == MEMCACHED_SUCCESS); - results=memcached_result_create(memc, &results_obj); + results= memcached_result_create(memc, &results_obj); assert(results); - results=memcached_fetch_result(memc, &results_obj, &ret); + results= memcached_fetch_result(memc, &results_obj, &ret); assert(results); assert(ret == MEMCACHED_SUCCESS); uint64_t cas= memcached_result_cas(results);