1.0.17
-*
+* Remove c++ namespace that was being exposed (the API should be plug
+compatible)..
1.0.16 Thu Jan 31 19:14:32 EST 2013
* Added support to do two part shutdown of socket.
};
-static memcached_return_t stat_printer(memcached_server_instance_st instance,
+static memcached_return_t stat_printer(const memcached_instance_st * instance,
const char *key, size_t key_length,
const char *value, size_t value_length,
void *context)
{
- static memcached_server_instance_st last= NULL;
+ static const memcached_instance_st * last= NULL;
(void)context;
if (last != instance)
}
static memcached_return_t server_print_callback(const memcached_st *,
- memcached_server_instance_st instance,
+ const memcached_instance_st * instance,
void *)
{
std::cerr << memcached_server_name(instance) << ":" << memcached_server_port(instance) <<
for (uint32_t x= 0; x < server_count; x++)
{
- memcached_server_instance_st instance=
+ const memcached_instance_st * instance=
memcached_server_instance_by_position(memc, x);
if ((servers[x]= memcached_create(NULL)) == NULL)
for (uint32_t x= 0; x < server_count; x++)
{
- memcached_server_instance_st instance=
+ const memcached_instance_st * instance=
memcached_server_instance_by_position(memc, x);
gettimeofday(&start_time, NULL);
if (server_count > 1 && slowest_time > 0)
{
- memcached_server_instance_st slowest=
+ const memcached_instance_st * slowest=
memcached_server_instance_by_position(memc, slowest_server);
printf("---\n");
{
uint32_t server_count= memcached_server_count(memc);
- memcached_server_instance_st most_consumed_server= memcached_server_instance_by_position(memc, report->most_consumed_server);
- memcached_server_instance_st least_free_server= memcached_server_instance_by_position(memc, report->least_free_server);
- memcached_server_instance_st oldest_server= memcached_server_instance_by_position(memc, report->oldest_server);
+ const memcached_instance_st * most_consumed_server= memcached_server_instance_by_position(memc, report->most_consumed_server);
+ const memcached_instance_st * least_free_server= memcached_server_instance_by_position(memc, report->least_free_server);
+ const memcached_instance_st * oldest_server= memcached_server_instance_by_position(memc, report->oldest_server);
printf("Memcached Cluster Analysis Report\n\n");
#include <libmemcached/memcached.h>
-.. c:type:: memcached_server_instance_st
+.. c:type:: const memcached_instance_st *
.. c:type:: memcached_server_list_st
.. c:type:: memcached_server_st
-.. c:function:: const memcached_server_instance_st memcached_server_list (memcached_st *ptr)
+.. c:function:: const const memcached_instance_st * memcached_server_list (memcached_st *ptr)
.. c:function:: void memcached_server_list_free (memcached_server_list_st list)
.. c:function:: uint32_t memcached_server_list_count (memcached_server_list_st list)
-.. c:function:: const char *memcached_server_error (memcached_server_instance_st instance)
+.. c:function:: const char *memcached_server_error (const memcached_instance_st * instance)
-.. c:function:: void memcached_server_error_reset (memcached_server_instance_st list)
+.. c:function:: void memcached_server_error_reset (const memcached_instance_st * list)
.. deprecated:: 0.39
.. c:function:: void memcached_servers_parse ()
.. c:function:: memcached_return_t memcached_server_push (memcached_st *ptr, const memcached_server_st *list)
-.. c:function:: memcached_server_instance_st memcached_server_by_key (memcached_st *ptr, const char *key, size_t key_length, memcached_return_t *error)
+.. c:function:: const memcached_instance_st * memcached_server_by_key (memcached_st *ptr, const char *key, size_t key_length, memcached_return_t *error)
-.. c:function:: memcached_server_instance_st memcached_server_get_last_disconnect (const memcached_st *ptr)
+.. c:function:: const memcached_instance_st * memcached_server_get_last_disconnect (const memcached_st *ptr)
.. c:function:: memcached_return_t memcached_server_cursor(const memcached_st *ptr, const memcached_server_fn *callback, void *context, uint32_t number_of_callbacks)
.. c:type:: memcached_stat_st
-.. c:type:: memcached_return_t (*memcached_stat_fn)(memcached_server_instance_st server, const char *key, size_t key_length, const char *value, size_t value_length, void *context)
+.. c:type:: memcached_return_t (*memcached_stat_fn)(const memcached_instance_st * server, const char *key, size_t key_length, const char *value, size_t value_length, void *context)
.. c:function:: memcached_stat_st *memcached_stat (memcached_st *ptr, char *args, memcached_return_t *error)
#endif
typedef memcached_return_t (*memcached_execute_fn)(const memcached_st *ptr, memcached_result_st *result, void *context);
-typedef memcached_return_t (*memcached_server_fn)(const memcached_st *ptr, memcached_server_instance_st server, void *context);
-typedef memcached_return_t (*memcached_stat_fn)(memcached_server_instance_st server,
+typedef memcached_return_t (*memcached_server_fn)(const memcached_st *ptr, const memcached_instance_st * server, void *context);
+typedef memcached_return_t (*memcached_stat_fn)(const memcached_instance_st * server,
const char *key, size_t key_length,
const char *value, size_t value_length,
void *context);
int memcached_last_error_errno(const memcached_st *);
LIBMEMCACHED_API
- const char *memcached_server_error(const memcached_server_instance_st ptr);
+ const char *memcached_server_error(const memcached_instance_st * ptr);
LIBMEMCACHED_API
- memcached_return_t memcached_server_error_return(const memcached_server_instance_st ptr);
+ memcached_return_t memcached_server_error_return(const memcached_instance_st * ptr);
#ifdef __cplusplus
} // extern "C"
memcached_return_t memcached_push(memcached_st *destination, const memcached_st *source);
LIBMEMCACHED_API
-memcached_server_instance_st memcached_server_instance_by_position(const memcached_st *ptr, uint32_t server_key);
+const memcached_instance_st * memcached_server_instance_by_position(const memcached_st *ptr, uint32_t server_key);
LIBMEMCACHED_API
uint32_t memcached_server_count(const memcached_st *);
*/
for (uint32_t x= 0; x < server_count; x++)
{
- memcached_server_instance_st instance= memcached_server_instance_by_position(memc_, x);
+ const memcached_instance_st * instance= memcached_server_instance_by_position(memc_, x);
std::ostringstream strstm;
std::string server_name(memcached_server_name(instance));
server_name.append(":");
uint32_t number_of_callbacks);
LIBMEMCACHED_API
- memcached_server_instance_st memcached_server_by_key(memcached_st *ptr,
+ const memcached_instance_st * memcached_server_by_key(memcached_st *ptr,
const char *key,
size_t key_length,
memcached_return_t *error);
void memcached_server_free(memcached_server_st *ptr);
LIBMEMCACHED_API
-memcached_server_instance_st memcached_server_get_last_disconnect(const memcached_st *ptr);
+const memcached_instance_st * memcached_server_get_last_disconnect(const memcached_st *ptr);
LIBMEMCACHED_API
Operations on Single Servers.
*/
LIBMEMCACHED_API
-uint32_t memcached_server_response_count(const memcached_server_instance_st self);
+uint32_t memcached_server_response_count(const memcached_instance_st * self);
LIBMEMCACHED_API
-const char *memcached_server_name(const memcached_server_instance_st self);
+const char *memcached_server_name(const memcached_instance_st * self);
LIBMEMCACHED_API
-in_port_t memcached_server_port(const memcached_server_instance_st self);
+in_port_t memcached_server_port(const memcached_instance_st * self);
LIBMEMCACHED_API
-void memcached_instance_next_retry(memcached_server_instance_st self, const time_t absolute_time);
+void memcached_instance_next_retry(const memcached_instance_st * self, const time_t absolute_time);
LIBMEMCACHED_API
-const char *memcached_server_type(const memcached_server_instance_st ptr);
+const char *memcached_server_type(const memcached_instance_st * ptr);
LIBMEMCACHED_API
-uint8_t memcached_server_major_version(const memcached_server_instance_st ptr);
+uint8_t memcached_server_major_version(const memcached_instance_st * ptr);
LIBMEMCACHED_API
-uint8_t memcached_server_minor_version(const memcached_server_instance_st ptr);
+uint8_t memcached_server_minor_version(const memcached_instance_st * ptr);
LIBMEMCACHED_API
-uint8_t memcached_server_micro_version(const memcached_server_instance_st ptr);
+uint8_t memcached_server_micro_version(const memcached_instance_st * ptr);
#ifdef __cplusplus
} // extern "C"
unsigned int version;
} server_info;
uint32_t number_of_hosts;
-#ifdef __cplusplus
- org::libmemcached::Instance* servers;
- org::libmemcached::Instance* last_disconnected_server;
-#else
- void *servers;
- void *last_disconnected_server;
-#endif
+ memcached_instance_st *servers;
+ memcached_instance_st *last_disconnected_server;
int32_t snd_timeout;
int32_t rcv_timeout;
uint32_t server_failure_limit;
#ifdef __cplusplus
-namespace org { namespace libmemcached { struct Instance; } }
-
struct memcached_st;
struct memcached_stat_st;
struct memcached_analysis_st;
// All of the flavors of memcache_server_st
struct memcached_server_st;
struct memcached_instance_st;
-typedef const org::libmemcached::Instance* memcached_server_instance_st;
+typedef struct memcached_instance_st memcached_instance_st;
typedef struct memcached_server_st *memcached_server_list_st;
struct memcached_callback_st;
// All of the flavors of memcache_server_st
typedef struct memcached_server_st memcached_server_st;
-typedef const void *memcached_server_instance_st;
+typedef struct memcached_instance_st memcached_instance_st;
typedef struct memcached_server_st *memcached_server_list_st;
typedef struct memcached_callback_st memcached_callback_st;
#include <libmemcached/common.h>
-static void auto_response(org::libmemcached::Instance* instance, const bool reply, memcached_return_t& rc, uint64_t* value)
+static void auto_response(memcached_instance_st* instance, const bool reply, memcached_return_t& rc, uint64_t* value)
{
// If the message was successfully sent, then get the response, otherwise
// fail.
}
}
-static memcached_return_t text_incr_decr(org::libmemcached::Instance* instance,
+static memcached_return_t text_incr_decr(memcached_instance_st* instance,
const bool is_incr,
const char *key, size_t key_length,
const uint64_t offset,
return memcached_vdo(instance, vector, 7, true);
}
-static memcached_return_t binary_incr_decr(org::libmemcached::Instance* instance,
+static memcached_return_t binary_incr_decr(memcached_instance_st* instance,
protocol_binary_command cmd,
const char *key, const size_t key_length,
const uint64_t offset,
}
uint32_t server_key= memcached_generate_hash_with_redistribution(memc, group_key, group_key_length);
- org::libmemcached::Instance* instance= memcached_instance_fetch(memc, server_key);
+ memcached_instance_st* instance= memcached_instance_fetch(memc, server_key);
bool reply= memcached_is_replying(instance->root);
}
uint32_t server_key= memcached_generate_hash_with_redistribution(memc, group_key, group_key_length);
- org::libmemcached::Instance* instance= memcached_instance_fetch(memc, server_key);
+ memcached_instance_st* instance= memcached_instance_fetch(memc, server_key);
bool reply= memcached_is_replying(instance->root);
return (uint64_t) ptr->send_size;
}
- org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, 0);
+ memcached_instance_st* instance= memcached_instance_fetch(ptr, 0);
if (instance) // If we have an instance we test, otherwise we just set and pray
{
if (ptr->recv_size != -1) // If value is -1 then we are using the default
return (uint64_t) ptr->recv_size;
- org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, 0);
+ memcached_instance_st* instance= memcached_instance_fetch(ptr, 0);
/**
@note REFACTOR
#endif
#ifdef __cplusplus
-org::libmemcached::Instance* memcached_instance_fetch(memcached_st *ptr, uint32_t server_key);
+memcached_instance_st* memcached_instance_fetch(memcached_st *ptr, uint32_t server_key);
#endif
/* These are private not to be installed headers */
memcached_return_t run_distribution(memcached_st *ptr);
#ifdef __cplusplus
-static inline void memcached_server_response_increment(org::libmemcached::Instance* instance)
+static inline void memcached_server_response_increment(memcached_instance_st* instance)
{
instance->events(POLLIN);
instance->cursor_active_++;
#endif
#ifdef __cplusplus
-bool memcached_purge(org::libmemcached::Instance*);
-org::libmemcached::Instance* memcached_instance_by_position(const memcached_st *ptr, uint32_t server_key);
+bool memcached_purge(memcached_instance_st*);
+memcached_instance_st* memcached_instance_by_position(const memcached_st *ptr, uint32_t server_key);
#endif
# define TCP_KEEPIDLE 0
#endif
-static memcached_return_t connect_poll(org::libmemcached::Instance* server, const int connection_error)
+static memcached_return_t connect_poll(memcached_instance_st* server, const int connection_error)
{
struct pollfd fds[1];
fds[0].fd= server->fd;
return memcached_set_errno(*server, connection_error, MEMCACHED_AT, memcached_literal_param("connect_poll() was exhausted"));
}
-static memcached_return_t set_hostinfo(org::libmemcached::Instance* server)
+static memcached_return_t set_hostinfo(memcached_instance_st* server)
{
assert(server->type != MEMCACHED_CONNECTION_UNIX_SOCKET);
server->clear_addrinfo();
return MEMCACHED_SUCCESS;
}
-static inline void set_socket_nonblocking(org::libmemcached::Instance* server)
+static inline void set_socket_nonblocking(memcached_instance_st* server)
{
#if defined(_WIN32)
u_long arg= 1;
#endif
}
-static bool set_socket_options(org::libmemcached::Instance* server)
+static bool set_socket_options(memcached_instance_st* server)
{
assert_msg(server->fd != INVALID_SOCKET, "invalid socket was passed to set_socket_options()");
return true;
}
-static memcached_return_t unix_socket_connect(org::libmemcached::Instance* server)
+static memcached_return_t unix_socket_connect(memcached_instance_st* server)
{
#ifndef _WIN32
WATCHPOINT_ASSERT(server->fd == INVALID_SOCKET);
#endif
}
-static memcached_return_t network_connect(org::libmemcached::Instance* server)
+static memcached_return_t network_connect(memcached_instance_st* server)
{
bool timeout_error_occured= false;
Based on time/failure count fail the connect without trying. This prevents waiting in a state where
we get caught spending cycles just waiting.
*/
-static memcached_return_t backoff_handling(org::libmemcached::Instance* server, bool& in_timeout)
+static memcached_return_t backoff_handling(memcached_instance_st* server, bool& in_timeout)
{
struct timeval curr_time;
bool _gettime_success= (gettimeofday(&curr_time, NULL) == 0);
return MEMCACHED_SUCCESS;
}
-static memcached_return_t _memcached_connect(org::libmemcached::Instance* server, const bool set_last_disconnected)
+static memcached_return_t _memcached_connect(memcached_instance_st* server, const bool set_last_disconnected)
{
assert(server);
if (server->fd != INVALID_SOCKET)
return rc;
}
-memcached_return_t memcached_connect(org::libmemcached::Instance* server)
+memcached_return_t memcached_connect(memcached_instance_st* server)
{
return _memcached_connect(server, true);
}
#pragma once
-memcached_return_t memcached_connect(org::libmemcached::Instance*);
+memcached_return_t memcached_connect(memcached_instance_st*);
return memcached_delete_by_key(shell, key, key_length, key, key_length, expiration);
}
-static inline memcached_return_t ascii_delete(org::libmemcached::Instance* instance,
+static inline memcached_return_t ascii_delete(memcached_instance_st* instance,
uint32_t ,
const char *key,
const size_t key_length,
return memcached_vdo(instance, vector, 6, is_buffering ? false : true);
}
-static inline memcached_return_t binary_delete(org::libmemcached::Instance* instance,
+static inline memcached_return_t binary_delete(memcached_instance_st* instance,
uint32_t server_key,
const char *key,
const size_t key_length,
server_key= 0;
}
- org::libmemcached::Instance* replica= memcached_instance_fetch(instance->root, server_key);
+ memcached_instance_st* replica= memcached_instance_fetch(instance->root, server_key);
if (memcached_fatal(memcached_vdo(replica, vector, 4, should_flush)))
{
}
uint32_t server_key= memcached_generate_hash_with_redistribution(memc, group_key, group_key_length);
- org::libmemcached::Instance* instance= memcached_instance_fetch(memc, server_key);
+ memcached_instance_st* instance= memcached_instance_fetch(memc, server_key);
bool is_buffering= memcached_is_buffering(instance->root);
bool is_replying= memcached_is_replying(instance->root);
#include <libmemcached/common.h>
-static memcached_return_t _vdo_udp(org::libmemcached::Instance* instance,
+static memcached_return_t _vdo_udp(memcached_instance_st* instance,
libmemcached_io_vector_st vector[],
const size_t count)
{
#endif
}
-memcached_return_t memcached_vdo(org::libmemcached::Instance* instance,
+memcached_return_t memcached_vdo(memcached_instance_st* instance,
libmemcached_io_vector_st vector[],
const size_t count,
const bool with_flush)
*
* Libmemcached library
*
- * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2011-2013 Data Differential, http://datadifferential.com/
* Copyright (C) 2006-2009 Brian Aker All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#pragma once
-memcached_return_t memcached_vdo(org::libmemcached::Instance* ptr,
+memcached_return_t memcached_vdo(memcached_instance_st*,
libmemcached_io_vector_st vector[],
const size_t count,
const bool with_flush);
// Send message to all servers
for (uint32_t server_key= 0; server_key < memcached_server_count(memc); server_key++)
{
- org::libmemcached::Instance* instance= memcached_instance_fetch(memc, server_key);
+ memcached_instance_st* instance= memcached_instance_fetch(memc, server_key);
memcached_return_t vdo_rc;
if (memcached_success((vdo_rc= memcached_vdo(instance, vector, 3, true))))
}
// Collect the returned items
- org::libmemcached::Instance* instance;
+ memcached_instance_st* instance;
memcached_return_t read_ret= MEMCACHED_SUCCESS;
while ((instance= memcached_io_get_readable_server(memc, read_ret)))
{
char message[MAX_ERROR_LENGTH];
};
-static void _set(org::libmemcached::Instance& server, Memcached& memc)
+static void _set(memcached_instance_st& server, Memcached& memc)
{
if (server.error_messages and server.error_messages->query_id != server.root->query_id)
{
return memcached_set_error(memc, rc, at, tmp);
}
-memcached_return_t memcached_set_error(org::libmemcached::Instance& self, memcached_return_t rc, const char *at, const char *str, size_t length)
+memcached_return_t memcached_set_error(memcached_instance_st& self, memcached_return_t rc, const char *at, const char *str, size_t length)
{
assert_msg(rc != MEMCACHED_ERRNO, "Programmer error, MEMCACHED_ERRNO was set to be returned to client");
assert_msg(rc != MEMCACHED_SOME_ERRORS, "Programmer error, MEMCACHED_SOME_ERRORS was about to be set on a Instance");
return memcached_set_error(memc, MEMCACHED_PARSE_ERROR, at, buffer, length);
}
-static inline size_t append_host_to_string(org::libmemcached::Instance& self, char* buffer, const size_t buffer_length)
+static inline size_t append_host_to_string(memcached_instance_st& self, char* buffer, const size_t buffer_length)
{
size_t size= 0;
switch (self.type)
return size;
}
-memcached_return_t memcached_set_error(org::libmemcached::Instance& self, memcached_return_t rc, const char *at, memcached_string_t& str)
+memcached_return_t memcached_set_error(memcached_instance_st& self, memcached_return_t rc, const char *at, memcached_string_t& str)
{
assert_msg(rc != MEMCACHED_ERRNO, "Programmer error, MEMCACHED_ERRNO was set to be returned to client");
- assert_msg(rc != MEMCACHED_SOME_ERRORS, "Programmer error, MEMCACHED_SOME_ERRORS was about to be set on a org::libmemcached::Instance");
+ assert_msg(rc != MEMCACHED_SOME_ERRORS, "Programmer error, MEMCACHED_SOME_ERRORS was about to be set on a memcached_instance_st");
if (memcached_fatal(rc) == false and rc != MEMCACHED_CLIENT_ERROR)
{
return rc;
return rc;
}
-memcached_return_t memcached_set_error(org::libmemcached::Instance& self, memcached_return_t rc, const char *at)
+memcached_return_t memcached_set_error(memcached_instance_st& self, memcached_return_t rc, const char *at)
{
- assert_msg(rc != MEMCACHED_SOME_ERRORS, "Programmer error, MEMCACHED_SOME_ERRORS was about to be set on a org::libmemcached::Instance");
+ assert_msg(rc != MEMCACHED_SOME_ERRORS, "Programmer error, MEMCACHED_SOME_ERRORS was about to be set on a memcached_instance_st");
if (memcached_fatal(rc) == false)
{
return rc;
return memcached_set_errno(self, local_errno, at, tmp);
}
-memcached_return_t memcached_set_errno(org::libmemcached::Instance& self, int local_errno, const char *at, const char *str, size_t length)
+memcached_return_t memcached_set_errno(memcached_instance_st& self, int local_errno, const char *at, const char *str, size_t length)
{
memcached_string_t tmp= { str, length };
return memcached_set_errno(self, local_errno, at, tmp);
return rc;
}
-memcached_return_t memcached_set_errno(org::libmemcached::Instance& self, int local_errno, const char *at, memcached_string_t& str)
+memcached_return_t memcached_set_errno(memcached_instance_st& self, int local_errno, const char *at, memcached_string_t& str)
{
if (local_errno == 0)
{
return rc;
}
-memcached_return_t memcached_set_errno(org::libmemcached::Instance& self, int local_errno, const char *at)
+memcached_return_t memcached_set_errno(memcached_instance_st& self, int local_errno, const char *at)
{
if (local_errno == 0)
{
for (uint32_t x= 0; x < memcached_server_count(self); x++)
{
- org::libmemcached::Instance* instance= memcached_instance_by_position(self, x);
+ memcached_instance_st* instance= memcached_instance_by_position(self, x);
_error_print(instance->error_messages);
}
self.error_messages= NULL;
}
-void memcached_error_free(org::libmemcached::Instance& self)
+void memcached_error_free(memcached_instance_st& self)
{
_error_free(self.error_messages);
self.error_messages= NULL;
return false;
}
-bool memcached_has_current_error(org::libmemcached::Instance& server)
+bool memcached_has_current_error(memcached_instance_st& server)
{
return memcached_has_current_error(*(server.root));
}
return memc->error_messages->local_errno;
}
-const char *memcached_server_error(const memcached_server_instance_st server)
+const char *memcached_server_error(const memcached_instance_st * server)
{
if (server == NULL)
{
}
-memcached_error_t *memcached_error_copy(const org::libmemcached::Instance& server)
+memcached_error_t *memcached_error_copy(const memcached_instance_st& server)
{
if (server.error_messages == NULL)
{
return error;
}
-memcached_return_t memcached_server_error_return(memcached_server_instance_st ptr)
+memcached_return_t memcached_server_error_return(const memcached_instance_st * ptr)
{
if (ptr == NULL)
{
return MEMCACHED_SUCCESS;
}
-memcached_return_t memcached_instance_error_return(org::libmemcached::Instance* instance)
+memcached_return_t memcached_instance_error_return(memcached_instance_st* instance)
{
if (instance == NULL)
{
memcached_return_t memcached_set_error(Memcached&, memcached_return_t rc, const char *at);
-memcached_return_t memcached_set_error(org::libmemcached::Instance&, memcached_return_t rc, const char *at);
+memcached_return_t memcached_set_error(memcached_instance_st&, memcached_return_t rc, const char *at);
memcached_return_t memcached_set_error(Memcached&, memcached_return_t rc, const char *at, const char *str, size_t length);
-memcached_return_t memcached_set_error(org::libmemcached::Instance&, memcached_return_t rc, const char *at, const char *str, size_t length);
+memcached_return_t memcached_set_error(memcached_instance_st&, memcached_return_t rc, const char *at, const char *str, size_t length);
memcached_return_t memcached_set_error(Memcached& memc, memcached_return_t rc, const char *at, memcached_string_t& str);
-memcached_return_t memcached_set_error(org::libmemcached::Instance&, memcached_return_t rc, const char *at, memcached_string_t& str);
+memcached_return_t memcached_set_error(memcached_instance_st&, memcached_return_t rc, const char *at, memcached_string_t& str);
memcached_return_t memcached_set_errno(Memcached& memc, int local_errno, const char *at, memcached_string_t& str);
-memcached_return_t memcached_set_errno(org::libmemcached::Instance&, int local_errno, const char *at, memcached_string_t& str);
+memcached_return_t memcached_set_errno(memcached_instance_st&, int local_errno, const char *at, memcached_string_t& str);
memcached_return_t memcached_set_errno(Memcached& memc, int local_errno, const char *at, const char *str, size_t length);
-memcached_return_t memcached_set_errno(org::libmemcached::Instance&, int local_errno, const char *at, const char *str, size_t length);
+memcached_return_t memcached_set_errno(memcached_instance_st&, int local_errno, const char *at, const char *str, size_t length);
memcached_return_t memcached_set_errno(Memcached& memc, int local_errno, const char *at);
-memcached_return_t memcached_set_errno(org::libmemcached::Instance&, int local_errno, const char *at);
+memcached_return_t memcached_set_errno(memcached_instance_st&, int local_errno, const char *at);
bool memcached_has_current_error(Memcached&);
-bool memcached_has_current_error(org::libmemcached::Instance&);
+bool memcached_has_current_error(memcached_instance_st&);
void memcached_error_free(Memcached&);
void memcached_error_free(memcached_server_st&);
-void memcached_error_free(org::libmemcached::Instance& self);
+void memcached_error_free(memcached_instance_st& self);
-memcached_error_t *memcached_error_copy(const org::libmemcached::Instance&);
+memcached_error_t *memcached_error_copy(const memcached_instance_st&);
-memcached_return_t memcached_instance_error_return(org::libmemcached::Instance*);
+memcached_return_t memcached_instance_error_return(memcached_instance_st*);
#endif
#include <libmemcached/common.h>
-static memcached_return_t ascii_exist(Memcached *memc, org::libmemcached::Instance* instance, const char *key, size_t key_length)
+static memcached_return_t ascii_exist(Memcached *memc, memcached_instance_st* instance, const char *key, size_t key_length)
{
libmemcached_io_vector_st vector[]=
{
return rc;
}
-static memcached_return_t binary_exist(Memcached *memc, org::libmemcached::Instance* instance, const char *key, size_t key_length)
+static memcached_return_t binary_exist(Memcached *memc, memcached_instance_st* instance, const char *key, size_t key_length)
{
protocol_binary_request_set request= {};
size_t send_length= sizeof(request.bytes);
}
uint32_t server_key= memcached_generate_hash_with_redistribution(memc, group_key, group_key_length);
- org::libmemcached::Instance* instance= memcached_instance_fetch(memc, server_key);
+ memcached_instance_st* instance= memcached_instance_fetch(memc, server_key);
if (memcached_is_binary(memc))
{
}
*error= MEMCACHED_MAXIMUM_RETURN; // We use this to see if we ever go into the loop
- org::libmemcached::Instance *server;
+ memcached_instance_st *server;
memcached_return_t read_ret= MEMCACHED_SUCCESS;
while ((server= memcached_io_get_readable_server(ptr, read_ret)))
{
for (uint32_t x= 0; x < memcached_server_count(ptr); x++)
{
- org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, x);
+ memcached_instance_st* instance= memcached_instance_fetch(ptr, x);
initialize_binary_request(instance, request.message.header);
if (reply)
for (uint32_t x= 0; x < memcached_server_count(ptr); x++)
{
- org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, x);
+ memcached_instance_st* instance= memcached_instance_fetch(ptr, x);
if (instance->response_count() > 0)
{
memcached_return_t rc= MEMCACHED_SUCCESS;
for (uint32_t x= 0; x < memcached_server_count(ptr); x++)
{
- org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, x);
+ memcached_instance_st* instance= memcached_instance_fetch(ptr, x);
libmemcached_io_vector_st vector[]=
{
for (uint32_t x= 0; x < memcached_server_count(memc); ++x)
{
- org::libmemcached::Instance* instance= memcached_instance_fetch(memc, x);
+ memcached_instance_st* instance= memcached_instance_fetch(memc, x);
if (instance->write_buffer_offset != 0)
{
*/
for (uint32_t x= 0; x < memcached_server_count(ptr); x++)
{
- org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, x);
+ memcached_instance_st* instance= memcached_instance_fetch(ptr, x);
if (instance->response_count())
{
server_key= memcached_generate_hash_with_redistribution(ptr, keys[x], key_length[x]);
}
- org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, server_key);
+ memcached_instance_st* instance= memcached_instance_fetch(ptr, server_key);
libmemcached_io_vector_st vector[]=
{
bool success_happened= false;
for (uint32_t x= 0; x < memcached_server_count(ptr); x++)
{
- org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, x);
+ memcached_instance_st* instance= memcached_instance_fetch(ptr, x);
if (instance->response_count())
{
server_key= memcached_generate_hash_with_redistribution(ptr, keys[x], key_length[x]);
}
- org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, server_key);
+ memcached_instance_st* instance= memcached_instance_fetch(ptr, server_key);
if (instance->response_count() == 0)
{
for (uint32_t x= 0; x < memcached_server_count(ptr); ++x)
{
- org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, x);
+ memcached_instance_st* instance= memcached_instance_fetch(ptr, x);
if (instance->response_count())
{
continue;
}
- org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, server);
+ memcached_instance_st* instance= memcached_instance_fetch(ptr, server);
if (instance->response_count() == 0)
{
static int compare_servers(const void *p1, const void *p2)
{
- memcached_server_instance_st a= (memcached_server_instance_st)p1;
- memcached_server_instance_st b= (memcached_server_instance_st)p2;
+ const memcached_instance_st * a= (const memcached_instance_st *)p1;
+ const memcached_instance_st * b= (const memcached_instance_st *)p2;
int return_value= strcmp(a->_hostname, b->_hostname);
{
if (memcached_server_count(ptr))
{
- qsort(memcached_instance_list(ptr), memcached_server_count(ptr), sizeof(org::libmemcached::Instance), compare_servers);
+ qsort(memcached_instance_list(ptr), memcached_server_count(ptr), sizeof(memcached_instance_st), compare_servers);
}
}
return memcached_set_errno(*ptr, errno, MEMCACHED_AT);
}
- org::libmemcached::Instance* list= memcached_instance_list(ptr);
+ memcached_instance_st* list= memcached_instance_list(ptr);
/* count live servers (those without a retry delay set) */
bool is_auto_ejecting= _is_auto_eject_host(ptr);
}
uint32_t host_list_size= memc->number_of_hosts +1;
- org::libmemcached::Instance* new_host_list= libmemcached_xrealloc(memc, memcached_instance_list(memc), host_list_size, org::libmemcached::Instance);
+ memcached_instance_st* new_host_list= libmemcached_xrealloc(memc, memcached_instance_list(memc), host_list_size, memcached_instance_st);
if (new_host_list == NULL)
{
assert(memc->number_of_hosts == host_list_size);
/* TODO: Check return type */
- org::libmemcached::Instance* instance= memcached_instance_fetch(memc, memcached_server_count(memc) -1);
+ memcached_instance_st* instance= memcached_instance_fetch(memc, memcached_server_count(memc) -1);
if (__instance_create_with(memc, instance, hostname, port, weight, type) == NULL)
{
uint32_t count= memcached_server_list_count(list);
uint32_t host_list_size= count +original_host_size;
- org::libmemcached::Instance* new_host_list= libmemcached_xrealloc(ptr, memcached_instance_list(ptr), host_list_size, org::libmemcached::Instance);
+ memcached_instance_st* new_host_list= libmemcached_xrealloc(ptr, memcached_instance_list(ptr), host_list_size, memcached_instance_st);
if (new_host_list == NULL)
{
WATCHPOINT_ASSERT(list[x].hostname[0] != 0);
// We have extended the array, and now we will find it, and use it.
- org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, original_host_size);
+ memcached_instance_st* instance= memcached_instance_fetch(ptr, original_host_size);
WATCHPOINT_ASSERT(instance);
memcached_string_t hostname= { memcached_string_make_from_cstr(list[x].hostname) };
return MEMCACHED_INVALID_ARGUMENTS;
}
-memcached_return_t memcached_instance_push(memcached_st *ptr, const struct org::libmemcached::Instance* list, uint32_t number_of_hosts)
+memcached_return_t memcached_instance_push(memcached_st *ptr, const struct memcached_instance_st* list, uint32_t number_of_hosts)
{
if (list == NULL)
{
uint32_t original_host_size= memcached_server_count(ptr);
uint32_t host_list_size= number_of_hosts +original_host_size;
- org::libmemcached::Instance* new_host_list= libmemcached_xrealloc(ptr, memcached_instance_list(ptr), host_list_size, org::libmemcached::Instance);
+ memcached_instance_st* new_host_list= libmemcached_xrealloc(ptr, memcached_instance_list(ptr), host_list_size, memcached_instance_st);
if (new_host_list == NULL)
{
WATCHPOINT_ASSERT(list[x]._hostname[0] != 0);
// We have extended the array, and now we will find it, and use it.
- org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, original_host_size);
+ memcached_instance_st* instance= memcached_instance_fetch(ptr, original_host_size);
WATCHPOINT_ASSERT(instance);
memcached_string_t hostname= { memcached_string_make_from_cstr(list[x]._hostname) };
#include <libmemcached/common.h>
-static inline void _server_init(org::libmemcached::Instance* self, Memcached *root,
+static inline void _server_init(memcached_instance_st* self, Memcached *root,
const memcached_string_t& hostname,
in_port_t port,
uint32_t weight, memcached_connection_t type)
self->hostname(hostname);
}
-static org::libmemcached::Instance* _server_create(org::libmemcached::Instance* self, const memcached_st *memc)
+static memcached_instance_st* _server_create(memcached_instance_st* self, const memcached_st *memc)
{
if (self == NULL)
{
- self= libmemcached_xmalloc(memc, org::libmemcached::Instance);
+ self= libmemcached_xmalloc(memc, memcached_instance_st);
if (self == NULL)
{
return self;
}
-void org::libmemcached::Instance::events(short arg)
+void memcached_instance_st::events(short arg)
{
if ((_events | arg) == _events)
{
_events|= arg;
}
-void org::libmemcached::Instance::revents(short arg)
+void memcached_instance_st::revents(short arg)
{
if (arg)
{
_events&= short(~arg);
}
-org::libmemcached::Instance* __instance_create_with(memcached_st *memc,
- org::libmemcached::Instance* self,
+memcached_instance_st* __instance_create_with(memcached_st *memc,
+ memcached_instance_st* self,
const memcached_string_t& hostname,
const in_port_t port,
uint32_t weight,
return self;
}
-void __instance_free(org::libmemcached::Instance* self)
+void __instance_free(memcached_instance_st* self)
{
memcached_quit_server(self, false);
}
}
-void memcached_instance_free(org::libmemcached::Instance* self)
+void memcached_instance_free(memcached_instance_st* self)
{
if (self)
{
size_t errors= 0;
for (uint32_t x= 0; x < memcached_instance_list_count(memc); x++)
{
- org::libmemcached::Instance* instance= memcached_instance_by_position(memc, x);
+ memcached_instance_st* instance= memcached_instance_by_position(memc, x);
for (uint32_t y= 0; y < number_of_callbacks; y++)
{
bool some_errors= false;;
for (uint32_t x= 0; x < memcached_instance_list_count(memc); x++)
{
- org::libmemcached::Instance* instance= memcached_instance_fetch(memc, x);
+ memcached_instance_st* instance= memcached_instance_fetch(memc, x);
memcached_return_t rc= (*callback)(memc, instance, context);
if (rc == MEMCACHED_INVALID_ARGUMENTS)
return MEMCACHED_SUCCESS;
}
-memcached_server_instance_st memcached_server_by_key(memcached_st *shell,
+const memcached_instance_st * memcached_server_by_key(memcached_st *shell,
const char *key,
size_t key_length,
memcached_return_t *error)
/*
If we do not have a valid object to clone from, we toss an error.
*/
-static org::libmemcached::Instance* memcached_instance_clone(org::libmemcached::Instance* source)
+static memcached_instance_st* memcached_instance_clone(memcached_instance_st* source)
{
/* We just do a normal create if source is missing */
if (source == NULL)
source->type);
}
-void set_last_disconnected_host(org::libmemcached::Instance* self)
+void set_last_disconnected_host(memcached_instance_st* self)
{
assert(self->root);
if (self->root)
// const_cast
memcached_st *root= (memcached_st *)self->root;
- memcached_instance_free((org::libmemcached::Instance*)(root->last_disconnected_server));
+ memcached_instance_free((memcached_instance_st*)(root->last_disconnected_server));
// We set is_parsing so that no lookup happens
root->state.is_parsing= true;
root->last_disconnected_server= memcached_instance_clone(self);
root->state.is_parsing= false;
- ((org::libmemcached::Instance*)memcached_server_get_last_disconnect(root))->version= self->version;
+ ((memcached_instance_st*)memcached_server_get_last_disconnect(root))->version= self->version;
}
}
-memcached_server_instance_st memcached_server_get_last_disconnect(const memcached_st *shell)
+const memcached_instance_st * memcached_server_get_last_disconnect(const memcached_st *shell)
{
const Memcached* self= memcached2Memcached(shell);
if (self)
{
- return (memcached_server_instance_st)self->last_disconnected_server;
+ return (const memcached_instance_st *)self->last_disconnected_server;
}
return 0;
}
-void memcached_instance_next_retry(memcached_server_instance_st self, const time_t absolute_time)
+void memcached_instance_next_retry(const memcached_instance_st * self, const time_t absolute_time)
{
WATCHPOINT_ASSERT(self);
if (self)
{
- ((org::libmemcached::Instance*)self)->next_retry= absolute_time;
+ ((memcached_instance_st*)self)->next_retry= absolute_time;
}
}
-namespace org {
-namespace libmemcached {
-
- bool Instance::valid() const
+bool memcached_instance_st::valid() const
+{
+ if (fd == INVALID_SOCKET)
{
- if (fd == INVALID_SOCKET)
- {
- return false;
- }
-
- return true;
+ return false;
}
- bool Instance::is_shutting_down() const
- {
- return options.is_shutting_down;
- }
+ return true;
+}
-} // namespace libmemcached
-} // namespace org
+bool memcached_instance_st::is_shutting_down() const
+{
+ return options.is_shutting_down;
+}
#include "libmemcached/string.hpp"
-namespace org {
-namespace libmemcached {
-
// @todo Complete class transformation
-struct Instance {
+struct memcached_instance_st {
in_port_t port() const
{
return port_;
}
};
-} // namespace libmemcached
-} // namespace org
-
-org::libmemcached::Instance* __instance_create_with(memcached_st *memc,
- org::libmemcached::Instance* self,
- const memcached_string_t& _hostname,
- const in_port_t port,
- uint32_t weight,
- const memcached_connection_t type);
+memcached_instance_st* __instance_create_with(memcached_st *memc,
+ memcached_instance_st* self,
+ const memcached_string_t& _hostname,
+ const in_port_t port,
+ uint32_t weight,
+ const memcached_connection_t type);
-memcached_return_t memcached_instance_push(memcached_st *ptr, const org::libmemcached::Instance*, uint32_t);
+memcached_return_t memcached_instance_push(memcached_st *ptr, const memcached_instance_st*, uint32_t);
-void __instance_free(org::libmemcached::Instance *);
+void __instance_free(memcached_instance_st *);
# include <sys/socket.h>
#endif
-void initialize_binary_request(org::libmemcached::Instance* server, protocol_binary_request_header& header)
+void initialize_binary_request(memcached_instance_st* server, protocol_binary_request_header& header)
{
server->request_id++;
header.request.magic= PROTOCOL_BINARY_REQ;
*
* @param instance the server to pack
*/
-static bool repack_input_buffer(org::libmemcached::Instance* instance)
+static bool repack_input_buffer(memcached_instance_st* instance)
{
if (instance->read_ptr != instance->read_buffer)
{
* @param instance the server to star processing iput messages for
* @return true if we processed anything, false otherwise
*/
-static bool process_input_buffer(org::libmemcached::Instance* instance)
+static bool process_input_buffer(memcached_instance_st* instance)
{
/*
** We might be able to process some of the response messages if we
return false;
}
-static memcached_return_t io_wait(org::libmemcached::Instance* instance,
+static memcached_return_t io_wait(memcached_instance_st* instance,
const memc_read_or_write read_or_write)
{
/*
memcached_literal_param("number of attempts to call io_wait() failed"));
}
-static bool io_flush(org::libmemcached::Instance* instance,
+static bool io_flush(memcached_instance_st* instance,
const bool with_flush,
memcached_return_t& error)
{
return true;
}
-memcached_return_t memcached_io_wait_for_write(org::libmemcached::Instance* instance)
+memcached_return_t memcached_io_wait_for_write(memcached_instance_st* instance)
{
return io_wait(instance, MEM_WRITE);
}
-static memcached_return_t _io_fill(org::libmemcached::Instance* instance)
+static memcached_return_t _io_fill(memcached_instance_st* instance)
{
ssize_t data_read;
do
return MEMCACHED_SUCCESS;
}
-memcached_return_t memcached_io_read(org::libmemcached::Instance* instance,
+memcached_return_t memcached_io_read(memcached_instance_st* instance,
void *buffer, size_t length, ssize_t& nread)
{
assert(memcached_is_udp(instance->root) == false);
return MEMCACHED_SUCCESS;
}
-memcached_return_t memcached_io_slurp(org::libmemcached::Instance* instance)
+memcached_return_t memcached_io_slurp(memcached_instance_st* instance)
{
assert_msg(instance, "Programmer error, invalid Instance");
assert(memcached_is_udp(instance->root) == false);
return MEMCACHED_CONNECTION_FAILURE;
}
-static bool _io_write(org::libmemcached::Instance* instance,
+static bool _io_write(memcached_instance_st* instance,
const void *buffer, size_t length, bool with_flush,
size_t& written)
{
return true;
}
-bool memcached_io_write(org::libmemcached::Instance* instance)
+bool memcached_io_write(memcached_instance_st* instance)
{
size_t written;
return _io_write(instance, NULL, 0, true, written);
}
-ssize_t memcached_io_write(org::libmemcached::Instance* instance,
+ssize_t memcached_io_write(memcached_instance_st* instance,
const void *buffer, const size_t length, const bool with_flush)
{
size_t written;
return ssize_t(written);
}
-bool memcached_io_writev(org::libmemcached::Instance* instance,
+bool memcached_io_writev(memcached_instance_st* instance,
libmemcached_io_vector_st vector[],
const size_t number_of, const bool with_flush)
{
return (complete_total == total);
}
-void org::libmemcached::Instance::start_close_socket()
+void memcached_instance_st::start_close_socket()
{
if (fd != INVALID_SOCKET)
{
}
}
-void org::libmemcached::Instance::reset_socket()
+void memcached_instance_st::reset_socket()
{
if (fd != INVALID_SOCKET)
{
}
}
-void org::libmemcached::Instance::close_socket()
+void memcached_instance_st::close_socket()
{
if (fd != INVALID_SOCKET)
{
major_version= minor_version= micro_version= UINT8_MAX;
}
-org::libmemcached::Instance* memcached_io_get_readable_server(Memcached *memc, memcached_return_t&)
+memcached_instance_st* memcached_io_get_readable_server(Memcached *memc, memcached_return_t&)
{
#define MAX_SERVERS_TO_POLL 100
struct pollfd fds[MAX_SERVERS_TO_POLL];
for (uint32_t x= 0; x < memcached_server_count(memc) and host_index < MAX_SERVERS_TO_POLL; ++x)
{
- org::libmemcached::Instance* instance= memcached_instance_fetch(memc, x);
+ memcached_instance_st* instance= memcached_instance_fetch(memc, x);
if (instance->read_buffer_length > 0) /* I have data in the buffer */
{
/* We have 0 or 1 server with pending events.. */
for (uint32_t x= 0; x< memcached_server_count(memc); ++x)
{
- org::libmemcached::Instance* instance= memcached_instance_fetch(memc, x);
+ memcached_instance_st* instance= memcached_instance_fetch(memc, x);
if (instance->response_count() > 0)
{
{
for (uint32_t y= 0; y < memcached_server_count(memc); ++y)
{
- org::libmemcached::Instance* instance= memcached_instance_fetch(memc, y);
+ memcached_instance_st* instance= memcached_instance_fetch(memc, y);
if (instance->fd == fds[x].fd)
{
/*
Eventually we will just kill off the server with the problem.
*/
-void memcached_io_reset(org::libmemcached::Instance* instance)
+void memcached_io_reset(memcached_instance_st* instance)
{
memcached_quit_server(instance, true);
}
* Read a given number of bytes from the server and place it into a specific
* buffer. Reset the IO channel on this server if an error occurs.
*/
-memcached_return_t memcached_safe_read(org::libmemcached::Instance* instance,
+memcached_return_t memcached_safe_read(memcached_instance_st* instance,
void *dta,
const size_t size)
{
return MEMCACHED_SUCCESS;
}
-memcached_return_t memcached_io_readline(org::libmemcached::Instance* instance,
+memcached_return_t memcached_io_readline(memcached_instance_st* instance,
char *buffer_ptr,
size_t size,
size_t& total_nr)
#pragma once
-void initialize_binary_request(org::libmemcached::Instance* server, protocol_binary_request_header&);
+void initialize_binary_request(memcached_instance_st* server, protocol_binary_request_header&);
-bool memcached_io_write(org::libmemcached::Instance* ptr);
+bool memcached_io_write(memcached_instance_st* ptr);
-ssize_t memcached_io_write(org::libmemcached::Instance* ptr,
+ssize_t memcached_io_write(memcached_instance_st* ptr,
const void *buffer, size_t length, bool with_flush);
-bool memcached_io_writev(org::libmemcached::Instance* ptr,
+bool memcached_io_writev(memcached_instance_st* ptr,
libmemcached_io_vector_st vector[],
const size_t number_of, const bool with_flush);
-memcached_return_t memcached_io_wait_for_write(org::libmemcached::Instance* ptr);
+memcached_return_t memcached_io_wait_for_write(memcached_instance_st* ptr);
-void memcached_io_reset(org::libmemcached::Instance* ptr);
+void memcached_io_reset(memcached_instance_st* ptr);
-memcached_return_t memcached_io_read(org::libmemcached::Instance* ptr,
+memcached_return_t memcached_io_read(memcached_instance_st* ptr,
void *buffer, size_t length, ssize_t& nread);
/* Read a line (terminated by '\n') into the buffer */
-memcached_return_t memcached_io_readline(org::libmemcached::Instance* ptr,
+memcached_return_t memcached_io_readline(memcached_instance_st* ptr,
char *buffer_ptr,
size_t size,
size_t& total);
/* Read n bytes of data from the server and store them in dta */
-memcached_return_t memcached_safe_read(org::libmemcached::Instance* ptr,
+memcached_return_t memcached_safe_read(memcached_instance_st* ptr,
void *dta,
const size_t size);
-org::libmemcached::Instance* memcached_io_get_readable_server(memcached_st *memc, memcached_return_t&);
+memcached_instance_st* memcached_io_get_readable_server(memcached_st *memc, memcached_return_t&);
-memcached_return_t memcached_io_slurp(org::libmemcached::Instance* ptr);
+memcached_return_t memcached_io_slurp(memcached_instance_st* ptr);
memcached_virtual_bucket_free(ptr);
- memcached_instance_free((org::libmemcached::Instance*)ptr->last_disconnected_server);
+ memcached_instance_free((memcached_instance_st*)ptr->last_disconnected_server);
if (ptr->on_cleanup)
{
Memcached* self= memcached2Memcached(shell);
if (self)
{
- memcached_instance_free((org::libmemcached::Instance*)self->last_disconnected_server);
+ memcached_instance_free((memcached_instance_st*)self->last_disconnected_server);
self->last_disconnected_server= NULL;
}
}
memcached_return_t memcached_push(memcached_st *destination, const memcached_st *source)
{
- return memcached_instance_push(destination, (org::libmemcached::Instance*)source->servers, source->number_of_hosts);
+ return memcached_instance_push(destination, (memcached_instance_st*)source->servers, source->number_of_hosts);
}
-org::libmemcached::Instance* memcached_instance_fetch(Memcached *ptr, uint32_t server_key)
+memcached_instance_st* memcached_instance_fetch(Memcached *ptr, uint32_t server_key)
{
if (ptr == NULL)
{
return &ptr->servers[server_key];
}
-memcached_server_instance_st memcached_server_instance_by_position(const memcached_st *shell, uint32_t server_key)
+const memcached_instance_st * memcached_server_instance_by_position(const memcached_st *shell, uint32_t server_key)
{
const Memcached* memc= memcached2Memcached(shell);
if (memc)
return NULL;
}
-org::libmemcached::Instance* memcached_instance_by_position(const memcached_st *shell, uint32_t server_key)
+memcached_instance_st* memcached_instance_by_position(const memcached_st *shell, uint32_t server_key)
{
const Memcached* memc= memcached2Memcached(shell);
if (memc)
return 0;
}
-org::libmemcached::Instance* memcached_instance_list(const memcached_st *shell)
+memcached_instance_st* memcached_instance_list(const memcached_st *shell)
{
const Memcached* memc= memcached2Memcached(shell);
if (memc)
{
- return (org::libmemcached::Instance*)memc->servers;
+ return (memcached_instance_st*)memc->servers;
}
return NULL;
int32_t& _origin;
};
-bool memcached_purge(org::libmemcached::Instance* ptr)
+bool memcached_purge(memcached_instance_st* ptr)
{
Memcached *root= (Memcached *)ptr->root;
#include <libmemcached/common.h>
namespace {
- memcached_return_t send_quit_message(org::libmemcached::Instance* instance)
+ memcached_return_t send_quit_message(memcached_instance_st* instance)
{
memcached_return_t rc;
if (instance->root->flags.binary_protocol)
return rc;
}
- void drain_instance(org::libmemcached::Instance* instance)
+ void drain_instance(memcached_instance_st* instance)
{
/* read until socket is closed, or there is an error
* closing the socket before all data is read
will force data to be completed.
*/
-void memcached_quit_server(org::libmemcached::Instance* instance, bool io_death)
+void memcached_quit_server(memcached_instance_st* instance, bool io_death)
{
if (instance->valid())
{
{
for (uint32_t x= 0; x < memcached_server_count(memc); x++)
{
- org::libmemcached::Instance* instance= memcached_instance_fetch(memc, x);
+ memcached_instance_st* instance= memcached_instance_fetch(memc, x);
memcached_quit_server(instance, false);
}
#pragma once
-void memcached_quit_server(org::libmemcached::Instance* ptr, bool io_death);
+void memcached_quit_server(memcached_instance_st* ptr, bool io_death);
void send_quit(memcached_st *ptr);
#include <libmemcached/common.h>
#include <libmemcached/string.hpp>
-static memcached_return_t textual_value_fetch(org::libmemcached::Instance* instance,
+static memcached_return_t textual_value_fetch(memcached_instance_st* instance,
char *buffer,
memcached_result_st *result)
{
return MEMCACHED_PARTIAL_READ;
}
-static memcached_return_t textual_read_one_response(org::libmemcached::Instance* instance,
+static memcached_return_t textual_read_one_response(memcached_instance_st* instance,
char *buffer, const size_t buffer_length,
memcached_result_st *result)
{
buffer, total_read);
}
-static memcached_return_t binary_read_one_response(org::libmemcached::Instance* instance,
+static memcached_return_t binary_read_one_response(memcached_instance_st* instance,
char *buffer, const size_t buffer_length,
memcached_result_st *result)
{
return rc;
}
-static memcached_return_t _read_one_response(org::libmemcached::Instance* instance,
+static memcached_return_t _read_one_response(memcached_instance_st* instance,
char *buffer, const size_t buffer_length,
memcached_result_st *result)
{
return rc;
}
-memcached_return_t memcached_read_one_response(org::libmemcached::Instance* instance,
+memcached_return_t memcached_read_one_response(memcached_instance_st* instance,
memcached_result_st *result)
{
char buffer[SMALL_STRING_LEN];
return _read_one_response(instance, buffer, sizeof(buffer), result);
}
-memcached_return_t memcached_response(org::libmemcached::Instance* instance,
+memcached_return_t memcached_response(memcached_instance_st* instance,
memcached_result_st *result)
{
char buffer[1024];
return memcached_response(instance, buffer, sizeof(buffer), result);
}
-memcached_return_t memcached_response(org::libmemcached::Instance* instance,
+memcached_return_t memcached_response(memcached_instance_st* instance,
char *buffer, size_t buffer_length,
memcached_result_st *result)
{
#pragma once
/* Read a single response from the server */
-memcached_return_t memcached_read_one_response(org::libmemcached::Instance* ptr,
+memcached_return_t memcached_read_one_response(memcached_instance_st* ptr,
memcached_result_st *result);
-memcached_return_t memcached_response(org::libmemcached::Instance* ptr,
+memcached_return_t memcached_response(memcached_instance_st* ptr,
memcached_result_st *result);
-memcached_return_t memcached_response(org::libmemcached::Instance* ptr,
+memcached_return_t memcached_response(memcached_instance_st* ptr,
char *buffer, size_t buffer_length,
memcached_result_st *result);
* @param raddr remote address (out)
* @return true on success false otherwise (errno contains more info)
*/
-static memcached_return_t resolve_names(org::libmemcached::Instance& server, char *laddr, size_t laddr_length, char *raddr, size_t raddr_length)
+static memcached_return_t resolve_names(memcached_instance_st& server, char *laddr, size_t laddr_length, char *raddr, size_t raddr_length)
{
char host[MEMCACHED_NI_MAXHOST];
char port[MEMCACHED_NI_MAXSERV];
} // extern "C"
-memcached_return_t memcached_sasl_authenticate_connection(org::libmemcached::Instance* server)
+memcached_return_t memcached_sasl_authenticate_connection(memcached_instance_st* server)
{
if (LIBMEMCACHED_WITH_SASL_SUPPORT == 0)
{
memcached_return_t memcached_clone_sasl(memcached_st *clone, const memcached_st *source);
-memcached_return_t memcached_sasl_authenticate_connection(org::libmemcached::Instance* server);
+memcached_return_t memcached_sasl_authenticate_connection(memcached_instance_st* server);
return self->number_of_hosts;
}
-const char *memcached_server_name(const memcached_server_instance_st self)
+const char *memcached_server_name(const memcached_instance_st * self)
{
WATCHPOINT_ASSERT(self);
if (self)
return NULL;
}
-in_port_t memcached_server_port(const memcached_server_instance_st self)
+in_port_t memcached_server_port(const memcached_instance_st * self)
{
WATCHPOINT_ASSERT(self);
if (self == NULL)
return self->port();
}
-uint32_t memcached_server_response_count(const memcached_server_instance_st self)
+uint32_t memcached_server_response_count(const memcached_instance_st * self)
{
WATCHPOINT_ASSERT(self);
if (self == NULL)
return self->cursor_active_;
}
-const char *memcached_server_type(const memcached_server_instance_st ptr)
+const char *memcached_server_type(const memcached_instance_st * ptr)
{
if (ptr)
{
return "UNKNOWN";
}
-uint8_t memcached_server_major_version(const memcached_server_instance_st instance)
+uint8_t memcached_server_major_version(const memcached_instance_st * instance)
{
if (instance)
{
return UINT8_MAX;
}
-uint8_t memcached_server_minor_version(const memcached_server_instance_st instance)
+uint8_t memcached_server_minor_version(const memcached_instance_st * instance)
{
if (instance)
{
return UINT8_MAX;
}
-uint8_t memcached_server_micro_version(const memcached_server_instance_st instance)
+uint8_t memcached_server_micro_version(const memcached_instance_st * instance)
{
if (instance)
{
return arg.c_str != NULL and arg.size > 0 and arg.size < MEMCACHED_NI_MAXHOST;
}
-void memcached_instance_free(org::libmemcached::Instance *);
+void memcached_instance_free(memcached_instance_st *);
-void set_last_disconnected_host(org::libmemcached::Instance* self);
+void set_last_disconnected_host(memcached_instance_st* self);
-static inline void memcached_mark_server_for_timeout(org::libmemcached::Instance* server)
+static inline void memcached_mark_server_for_timeout(memcached_instance_st* server)
{
if (server->state != MEMCACHED_SERVER_STATE_IN_TIMEOUT)
{
#pragma once
#ifdef __cplusplus
-namespace org { namespace libmemcached { struct Instance; } }
-typedef struct org::libmemcached::Instance* memcached_server_write_instance_st;
+typedef struct memcached_instance_st* memcached_server_write_instance_st;
#else
typedef void* memcached_server_write_instance_st;
#endif
: self->number_of_hosts;
}
-void memcached_instance_set(memcached_st* memc, org::libmemcached::Instance* list, const uint32_t host_list_size)
+void memcached_instance_set(memcached_st* memc, memcached_instance_st* list, const uint32_t host_list_size)
{
assert(memc);
memc->servers= list;
}
}
-void memcached_instance_list_free(org::libmemcached::Instance* self, uint32_t instance_count)
+void memcached_instance_list_free(memcached_instance_st* self, uint32_t instance_count)
{
if (self)
{
#pragma once
-org::libmemcached::Instance* memcached_instance_list(const memcached_st *);
+memcached_instance_st* memcached_instance_list(const memcached_st *);
uint32_t memcached_instance_list_count(const memcached_st*);
uint32_t memcached_servers_set_count(memcached_server_list_st servers, uint32_t count);
-void memcached_instance_list_free(org::libmemcached::Instance* self, uint32_t count);
+void memcached_instance_list_free(memcached_instance_st* self, uint32_t count);
-void memcached_instance_set(memcached_st*, org::libmemcached::Instance*, const uint32_t host_list_size);
+void memcached_instance_set(memcached_st*, memcached_instance_st*, const uint32_t host_list_size);
static memcached_return_t binary_stats_fetch(memcached_stat_st *memc_stat,
const char *args,
const size_t args_length,
- org::libmemcached::Instance* instance,
+ memcached_instance_st* instance,
struct local_context *check)
{
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
static memcached_return_t ascii_stats_fetch(memcached_stat_st *memc_stat,
const char *args,
const size_t args_length,
- org::libmemcached::Instance* instance,
+ memcached_instance_st* instance,
struct local_context *check)
{
libmemcached_io_vector_st vector[]=
stat_instance->pid= -1;
stat_instance->root= self;
- org::libmemcached::Instance* instance= memcached_instance_fetch(self, x);
+ memcached_instance_st* instance= memcached_instance_fetch(self, x);
memcached_return_t temp_return;
if (memcached_is_binary(self))
if (memcached_success(rc))
{
- org::libmemcached::Instance* instance= memcached_instance_fetch(memc_ptr, 0);
+ memcached_instance_st* instance= memcached_instance_fetch(memc_ptr, 0);
if (memc.flags.binary_protocol)
{
rc= binary_stats_fetch(memc_stat, args, args_length, instance, NULL);
}
static memcached_return_t call_stat_fn(memcached_st *memc,
- org::libmemcached::Instance* instance,
+ memcached_instance_st* instance,
void *context)
{
if (memc)
}
static memcached_return_t memcached_send_binary(Memcached *ptr,
- org::libmemcached::Instance* server,
+ memcached_instance_st* server,
uint32_t server_key,
const char *key,
const size_t key_length,
server_key= 0;
}
- org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, server_key);
+ memcached_instance_st* instance= memcached_instance_fetch(ptr, server_key);
if (memcached_vdo(instance, vector, 5, false) != MEMCACHED_SUCCESS)
{
}
static memcached_return_t memcached_send_ascii(Memcached *ptr,
- org::libmemcached::Instance* instance,
+ memcached_instance_st* instance,
const char *key,
const size_t key_length,
const char *value,
}
uint32_t server_key= memcached_generate_hash_with_redistribution(ptr, group_key, group_key_length);
- org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, server_key);
+ memcached_instance_st* instance= memcached_instance_fetch(ptr, server_key);
WATCHPOINT_SET(instance->io_wait_count.read= 0);
WATCHPOINT_SET(instance->io_wait_count.write= 0);
#include <libmemcached/common.h>
#include <libmemcached/memcached/protocol_binary.h>
-static memcached_return_t ascii_touch(org::libmemcached::Instance* instance,
+static memcached_return_t ascii_touch(memcached_instance_st* instance,
const char *key, size_t key_length,
time_t expiration)
{
return rc;
}
-static memcached_return_t binary_touch(org::libmemcached::Instance* instance,
+static memcached_return_t binary_touch(memcached_instance_st* instance,
const char *key, size_t key_length,
time_t expiration)
{
}
uint32_t server_key= memcached_generate_hash_with_redistribution(ptr, group_key, group_key_length);
- org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, server_key);
+ memcached_instance_st* instance= memcached_instance_fetch(ptr, server_key);
if (ptr->flags.binary_protocol)
{
* extracts the message number from message_id, increments it and then
* writes the new value back into the header
*/
-void increment_udp_message_id(org::libmemcached::Instance* ptr)
+void increment_udp_message_id(memcached_instance_st* ptr)
{
struct udp_datagram_header_st *header= (struct udp_datagram_header_st *)ptr->write_buffer;
uint16_t cur_req= get_udp_datagram_request_id(header);
header->request_id= htons((uint16_t) (thread_id | msg_num));
}
-bool memcached_io_init_udp_header(org::libmemcached::Instance* ptr, const uint16_t thread_id)
+bool memcached_io_init_udp_header(memcached_instance_st* ptr, const uint16_t thread_id)
{
if (thread_id > UDP_REQUEST_ID_MAX_THREAD_ID)
{
uint16_t reserved;
};
-bool memcached_io_init_udp_header(org::libmemcached::Instance*, const uint16_t thread_id);
-void increment_udp_message_id(org::libmemcached::Instance*);
+bool memcached_io_init_udp_header(memcached_instance_st*, const uint16_t thread_id);
+void increment_udp_message_id(memcached_instance_st*);
};
static memcached_return_t _set_verbosity(const Memcached *,
- const memcached_server_instance_st server,
+ const memcached_instance_st * server,
void *context)
{
libmemcached_io_vector_st *vector= (libmemcached_io_vector_st *)context;
if (rc == MEMCACHED_SUCCESS)
{
- org::libmemcached::Instance* instance= memcached_instance_fetch(memc_ptr, 0);
+ memcached_instance_st* instance= memcached_instance_fetch(memc_ptr, 0);
rc= memcached_vdo(instance, vector, 4, true);
bool errors_happened= false;
for (uint32_t x= 0; x < memcached_server_count(memc); x++)
{
- org::libmemcached::Instance* instance= memcached_instance_fetch(memc, x);
+ memcached_instance_st* instance= memcached_instance_fetch(memc, x);
// Optimization, we only fetch version once.
if (instance->major_version != UINT8_MAX)
if (success)
{
// Collect the returned items
- org::libmemcached::Instance* instance;
+ memcached_instance_st* instance;
memcached_return_t readable_error;
while ((instance= memcached_io_get_readable_server(memc, readable_error)))
{
bool errors_happened= false;
for (uint32_t x= 0; x < memcached_server_count(memc); x++)
{
- org::libmemcached::Instance* instance= memcached_instance_fetch(memc, x);
+ memcached_instance_st* instance= memcached_instance_fetch(memc, x);
initialize_binary_request(instance, request.message.header);
if (success)
{
// Collect the returned items
- org::libmemcached::Instance* instance;
+ memcached_instance_st* instance;
memcached_return_t readable_error;
while ((instance= memcached_io_get_readable_server(memc, readable_error)))
{
return errors_happened ? MEMCACHED_SOME_ERRORS : MEMCACHED_SUCCESS;
}
-static inline void version_ascii_instance(org::libmemcached::Instance* instance)
+static inline void version_ascii_instance(memcached_instance_st* instance)
{
if (instance->major_version != UINT8_MAX)
{
}
}
-static inline void version_binary_instance(org::libmemcached::Instance* instance)
+static inline void version_binary_instance(memcached_instance_st* instance)
{
if (instance->major_version != UINT8_MAX)
{
}
}
-void memcached_version_instance(org::libmemcached::Instance* instance)
+void memcached_version_instance(memcached_instance_st* instance)
{
if (instance)
{
#pragma once
-void memcached_version_instance(org::libmemcached::Instance*);
+void memcached_version_instance(memcached_instance_st*);
}
else if (rc == MEMCACHED_SOME_ERRORS) // Generic answer, we will now find the specific reason (if one exists)
{
- memcached_server_instance_st instance= memcached_server_instance_by_position(memc_ptr, 0);
+ const memcached_instance_st * instance= memcached_server_instance_by_position(memc_ptr, 0);
assert_msg(instance and memcached_server_error(instance), " ");
if (instance and memcached_server_error(instance))
}
else if (rc == MEMCACHED_SOME_ERRORS) // Generic answer, we will now find the specific reason (if one exists)
{
- memcached_server_instance_st instance=
+ const memcached_instance_st * instance=
memcached_server_instance_by_position(memc_ptr, 0);
#if 0
if (memcached_failed(rc) and rc == MEMCACHED_SOME_ERRORS)
{
- memcached_server_instance_st instance=
+ const memcached_instance_st * instance=
memcached_server_instance_by_position(memc_ptr, 0);
assert_msg(instance and memcached_server_error(instance), " ");
if (memcached_failed(rc) and rc == MEMCACHED_SOME_ERRORS)
{
- memcached_server_instance_st instance=
+ const memcached_instance_st * instance=
memcached_server_instance_by_position(memc_ptr, 0);
assert_msg(instance and memcached_server_error(instance), " ");
};
static memcached_return_t check_server_version(const memcached_st *,
- memcached_server_instance_st instance,
+ const memcached_instance_st * instance,
void *context)
{
/* Do Nothing */
}
static memcached_return_t server_wrapper_for_dump_callback(const memcached_st *,
- memcached_server_instance_st server,
+ const memcached_instance_st * server,
void *)
{
memcached_st *memc= memcached_create(NULL);
return MEMCACHED_SUCCESS;
}
-static memcached_return_t item_counter(memcached_server_instance_st ,
+static memcached_return_t item_counter(const memcached_instance_st * ,
const char *key, size_t key_length,
const char *value, size_t, // value_length,
void *context)
/* This test was changes so that "make test" would work properlly */
if (DEBUG)
{
- memcached_server_instance_st instance=
+ const memcached_instance_st * instance=
memcached_server_instance_by_position(memc, host_index);
printf("\nserver %u|%s|%u bytes: %llu\n",
for (uint32_t x= 0; x < 99; x++)
{
uint32_t server_idx = memcached_generate_hash(memc, ketama_test_cases[x].key, strlen(ketama_test_cases[x].key));
- memcached_server_instance_st instance=
+ const memcached_instance_st * instance=
memcached_server_instance_by_position(memc, server_idx);
const char *hostname = memcached_server_name(instance);
{
uint32_t server_idx = memcached_generate_hash(memc, ketama_test_cases[x].key, strlen(ketama_test_cases[x].key));
- memcached_server_instance_st instance=
+ const memcached_instance_st * instance=
memcached_server_instance_by_position(memc, server_idx);
const char *hostname = memcached_server_name(instance);
test_true(server_pool[7].port == 11211);
test_true(server_pool[7].weight == 100);
- memcached_server_instance_st instance= memcached_server_instance_by_position(memc, 2);
+ const memcached_instance_st * instance= memcached_server_instance_by_position(memc, 2);
memcached_instance_next_retry(instance, time(NULL) +15);
memc->ketama.next_distribution_rebuild= time(NULL) - 1;
{
uint32_t server_idx= memcached_generate_hash(memc, ketama_test_cases_spy[x].key, strlen(ketama_test_cases_spy[x].key));
- memcached_server_instance_st instance=
+ const memcached_instance_st * instance=
memcached_server_instance_by_position(memc, server_idx);
const char *hostname= memcached_server_name(instance);
* I only want to hit _one_ server so I know the number of requests I'm
* sending in the pipeline.
*/
- memcached_server_instance_st instance= memcached_server_instance_by_position(original_memc, 0);
+ const memcached_instance_st * instance= memcached_server_instance_by_position(original_memc, 0);
char server_string[1024];
int server_string_length;
in_port_t test_ports[TEST_PORT_COUNT];
static memcached_return_t server_display_function(const memcached_st *ptr,
- memcached_server_instance_st server,
+ const memcached_instance_st * server,
void *context)
{
/* Do Nothing */
}
static memcached_return_t dump_server_information(const memcached_st *ptr,
- memcached_server_instance_st instance,
+ const memcached_instance_st * instance,
void *context)
{
/* Do Nothing */
size_t bigger= 0; /* Prime the value for the test_true in server_display_function */
memcached_server_fn callbacks[1];
memcached_st *local_memc;
- memcached_server_instance_st instance;
+ const memcached_instance_st * instance;
(void)ptr;
local_memc= memcached_create(NULL);
}
static memcached_return_t server_display_unsort_function(const memcached_st*,
- memcached_server_instance_st server,
+ const memcached_instance_st * server,
void *context)
{
/* Do Nothing */
}
static memcached_return_t server_function(const memcached_st *,
- memcached_server_instance_st,
+ const memcached_instance_st *,
void *)
{
/* Do Nothing */
test_return_t stats_servername_test(memcached_st *memc)
{
memcached_stat_st memc_stat;
- memcached_server_instance_st instance=
+ const memcached_instance_st * instance=
memcached_server_instance_by_position(memc, 0);
if (LIBMEMCACHED_WITH_SASL_SUPPORT and memcached_get_sasl_callbacks(memc))
memcached_server_list_free(list);
test_compare(status, MEMCACHED_SUCCESS);
- memcached_server_instance_st server= memcached_server_by_key(memc, test_literal_param(__func__), &status);
+ const memcached_instance_st * server= memcached_server_by_key(memc, test_literal_param(__func__), &status);
test_true(server);
test_compare(status, MEMCACHED_SUCCESS);
memcached_st *memc= memcached(test_literal_param("--server=localhost:11311/?100 --server=localhost:11312/?100"));
- memcached_server_instance_st server= memcached_server_by_key(memc, "a", 1, &res);
+ const memcached_instance_st * server= memcached_server_by_key(memc, "a", 1, &res);
test_true(server);
memcached_free(memc);
char *hostname = memc->hosts[server_idx].hostname;
in_port_t port = memc->hosts[server_idx].port;
fprintf(fp, "key %s is on host /%s:%u\n", key, hostname, port);
- memcached_server_instance_st instance=
+ const memcached_instance_st * instance=
memcached_server_instance_by_position(memc, host_index);
}
fclose(fp);
{
memcached_version(memc);
- memcached_server_instance_st instance=
+ const memcached_instance_st * instance=
memcached_server_instance_by_position(memc, 0);
if ((instance->major_version >= 1 && (instance->minor_version == 2 && instance->micro_version >= 4))
int no_msg=0;
for (uint32_t x= 0; x < memcached_server_count(memc); ++x)
{
- memcached_server_instance_st instance=
+ const memcached_instance_st * instance=
memcached_server_instance_by_position(memc, x);
no_msg+=(int)(instance->cursor_active);
}
}
test_true(if_successful == false);
- memcached_server_instance_st instance=
+ const memcached_instance_st * instance=
memcached_server_instance_by_position(memc, 0);
memcached_version(memc);
{
test_skip(memc->servers[0].type, MEMCACHED_CONNECTION_TCP);
memcached_return_t rc;
- memcached_server_instance_st instance=
+ const memcached_instance_st * instance=
memcached_server_instance_by_position(memc, 0);
// Test both the version that returns a code, and the one that does not.
test_return_t getpid_test(memcached_st *memc)
{
memcached_return_t rc;
- memcached_server_instance_st instance=
+ const memcached_instance_st * instance=
memcached_server_instance_by_position(memc, 0);
// Test both the version that returns a code, and the one that does not.
}
static memcached_return_t ping_each_server(const memcached_st*,
- memcached_server_instance_st instance,
+ const memcached_instance_st * instance,
void*)
{
// Test both the version that returns a code, and the one that does not.
* This is to verify correct behavior in the library. Fake that two servers
* are dead..
*/
- memcached_server_instance_st instance_one= memcached_server_instance_by_position(memc, 0);
- memcached_server_instance_st instance_two= memcached_server_instance_by_position(memc, 2);
+ const memcached_instance_st * instance_one= memcached_server_instance_by_position(memc, 0);
+ const memcached_instance_st * instance_two= memcached_server_instance_by_position(memc, 2);
in_port_t port0= instance_one->port();
in_port_t port2= instance_two->port();
test_true(memc_clone);
test_true(memcached_version(memc_clone) == MEMCACHED_SUCCESS);
- memcached_server_instance_st instance=
+ const memcached_instance_st * instance=
memcached_server_instance_by_position(memc_clone, 0);
if (instance->major_version > 1 ||
test_return_t test_get_last_disconnect(memcached_st *memc)
{
memcached_return_t rc;
- memcached_server_instance_st disconnected_server;
+ const memcached_instance_st * disconnected_server;
/* With the working set of server */
const char *key= "marmotte";
memcached_return_t ret= memcached_set(memc, msg, strlen(msg), NULL, 0, (time_t)0, (uint32_t)0);
test_true_got((ret == MEMCACHED_CONNECTION_FAILURE or ret == MEMCACHED_SERVER_TEMPORARILY_DISABLED), memcached_last_error_message(memc));
- memcached_server_instance_st disconnected_server= memcached_server_get_last_disconnect(memc);
+ const memcached_instance_st * disconnected_server= memcached_server_get_last_disconnect(memc);
test_true(disconnected_server);
test_strcmp("localhost", memcached_server_name(disconnected_server));
test_true(memcached_server_port(disconnected_server) >= 8888 and memcached_server_port(disconnected_server) <= 8892);
}
-static memcached_return_t stat_printer(memcached_server_instance_st server,
+static memcached_return_t stat_printer(const memcached_instance_st * server,
const char *key, size_t key_length,
const char *value, size_t value_length,
void *context)
test_true(rc == MEMCACHED_SUCCESS or rc == MEMCACHED_BUFFERED);
- memcached_server_instance_st instance= memcached_server_instance_by_position(memc, 0);
+ const memcached_instance_st * instance= memcached_server_instance_by_position(memc, 0);
/* The test is to see that the memcached_quit doesn't increase the
* the server failure conter, so let's ensure that it is zero
memcached_st *memc= create_single_instance_memcached(original_memc, 0);
test_true(memc);
- memcached_server_instance_st instance= memcached_server_instance_by_position(memc, 0);
+ const memcached_instance_st * instance= memcached_server_instance_by_position(memc, 0);
pid_t pid;
test_true((pid= libmemcached_util_getpid(memcached_server_name(instance),
// Check and make sure the first host is what we expect it to be
static test_return_t __check_host(memcached_st *memc, const scanner_string_st &hostname)
{
- memcached_server_instance_st instance=
+ const memcached_instance_st * instance=
memcached_server_instance_by_position(memc, 0);
test_true(instance);
}
static memcached_return_t dump_server_information(const memcached_st *,
- memcached_server_instance_st instance,
+ const memcached_instance_st * instance,
void *)
{
if (strcmp(memcached_server_name(instance), "localhost"))
};
static memcached_return_t dump_socket_information(const memcached_st *,
- memcached_server_instance_st instance,
+ const memcached_instance_st * instance,
void *context)
{
socket_weight_t *check= (socket_weight_t *)context;
{
// Check to see everything is setup internally even when a host is specified
// on creation.
- memcached_server_instance_st instance= memcached_server_instance_by_position(original, 0);
+ const memcached_instance_st* instance= memcached_server_instance_by_position(original, 0);
Memcache memc(memcached_server_name(instance), memcached_server_port(instance));
test_false(memc.increment(__func__, 0, NULL));
* I only want to hit _one_ server so I know the number of requests I'm
* sending in the pipeline.
*/
- memcached_server_instance_st instance= memcached_server_instance_by_position(original_memc, 0);
+ const memcached_instance_st * instance= memcached_server_instance_by_position(original_memc, 0);
char server_string[1024];
int server_string_length;
#include "tests/print.h"
memcached_return_t server_print_callback(const memcached_st*,
- memcached_server_instance_st server,
+ const memcached_instance_st * server,
void *context)
{
if (context)
return MEMCACHED_SUCCESS;
}
-const char * print_version(memcached_st *memc)
-{
- memcached_server_fn callbacks[1];
- callbacks[0]= server_print_version_callback;
- memcached_server_cursor(memc, callbacks, NULL, 1);
-
- return "print_version()";
-}
-
-
memcached_return_t server_print_version_callback(const memcached_st *,
- memcached_server_instance_st server,
+ const memcached_instance_st * server,
void *)
{
std::cerr << "Server: " << memcached_server_name(server) << ":" << memcached_server_port(server) << " "
return MEMCACHED_SUCCESS;
}
+
+const char * print_version(memcached_st *memc)
+{
+ memcached_server_fn callbacks[1];
+ callbacks[0]= server_print_version_callback;
+ memcached_server_cursor(memc, callbacks, NULL, 1);
+
+ return "print_version()";
+}
for (uint32_t host= 0; host < memcached_server_count(memc); ++host)
{
memcached_st *memc_clone= memcached_clone(NULL, memc);
- org::libmemcached::Instance* instance= (org::libmemcached::Instance*)memcached_server_instance_by_position(memc_clone, host);
+ memcached_instance_st* instance= (memcached_instance_st*)memcached_server_instance_by_position(memc_clone, host);
instance->port(0);
for (uint32_t host= 0; host < memcached_server_count(memc_clone); host++)
{
memcached_st *new_clone= memcached_clone(NULL, memc);
- memcached_server_instance_st instance= memcached_server_instance_by_position(new_clone, host);
+ const memcached_instance_st * instance= memcached_server_instance_by_position(new_clone, host);
((memcached_server_write_instance_st)instance)->port(0);
for (int x= 'a'; x <= 'z'; ++x)
#include "tests/libmemcached-1.0/stat.h"
-static memcached_return_t item_counter(memcached_server_instance_st ,
+static memcached_return_t item_counter(const memcached_instance_st * ,
const char *key, size_t key_length,
const char *value, size_t, // value_length,
void *context)
{
for (uint32_t x= 0; x < memcached_server_count(memc); x++)
{
- memcached_server_instance_st instance= memcached_server_instance_by_position(memc, x);
+ const memcached_instance_st * instance= memcached_server_instance_by_position(memc, x);
- ids.push_back(get_udp_datagram_request_id((struct udp_datagram_header_st *) ((memcached_server_instance_st )instance)->write_buffer));
+ ids.push_back(get_udp_datagram_request_id((struct udp_datagram_header_st *) ((const memcached_instance_st * )instance)->write_buffer));
}
}
(void)memc;
#if 0
memcached_server_st server;
- memcached_server_instance_st instance=
+ const memcached_instance_st * instance=
memcached_server_instance_by_position(memc, 0);
memcached_server_clone(&server, &memc->hosts[0]);
test_true(memcached_server_remove(&(memc->hosts[0])) == MEMCACHED_SUCCESS);
(void)memc;
#if 0
memcached_server_st server;
- memcached_server_instance_st instance=
+ const memcached_instance_st * instance=
memcached_server_instance_by_position(memc, 0);
memcached_server_clone(&server, &memc->hosts[0]);
test_true(memcached_server_remove(&(memc->hosts[0])) == MEMCACHED_SUCCESS);
get_udp_request_ids(memc, expected_ids);
unsigned int server_key= memcached_generate_hash(memc, test_literal_param("foo"));
test_true(server_key < memcached_server_count(memc));
- memcached_server_instance_st instance= memcached_server_instance_by_position(memc, server_key);
+ const memcached_instance_st * instance= memcached_server_instance_by_position(memc, server_key);
size_t init_offset= instance->write_buffer_offset;
test_compare_hint(MEMCACHED_SUCCESS,
get_udp_request_ids(memc, expected_ids);
unsigned int server_key= memcached_generate_hash(memc, test_literal_param("foo"));
- memcached_server_instance_st instance= memcached_server_instance_by_position(memc, server_key);
+ const memcached_instance_st * instance= memcached_server_instance_by_position(memc, server_key);
size_t init_offset= instance->write_buffer_offset;
test_compare(MEMCACHED_SUCCESS,
#pragma once
memcached_return_t server_print_callback(const memcached_st *ptr,
- memcached_server_instance_st server,
+ const memcached_instance_st *server,
void *context);
memcached_return_t server_print_version_callback(const memcached_st *ptr,
- memcached_server_instance_st server,
+ const memcached_server_st *server,
void *context);
const char * print_version(memcached_st *memc);