projects
/
awesomized
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Rolloup of all of the current build.
[awesomized/libmemcached]
/
libmemcached
/
delete.cc
diff --git
a/libmemcached/delete.cc
b/libmemcached/delete.cc
index 1ae891a7bea073a4b1dda5763de5b6126faf6011..669d8ae130e5c5f7b118fae59e66ef311734da49 100644
(file)
--- a/
libmemcached/delete.cc
+++ b/
libmemcached/delete.cc
@@
-56,31
+56,29
@@
memcached_return_t memcached_delete_by_key(memcached_st *ptr,
const char *key, size_t key_length,
time_t expiration)
{
const char *key, size_t key_length,
time_t expiration)
{
- bool to_write;
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
- uint32_t server_key;
memcached_server_write_instance_st instance;
LIBMEMCACHED_MEMCACHED_DELETE_START();
memcached_return_t rc;
memcached_server_write_instance_st instance;
LIBMEMCACHED_MEMCACHED_DELETE_START();
memcached_return_t rc;
- if (
(rc= initialize_query(ptr)) != MEMCACHED_SUCCESS
)
+ if (
memcached_failed(rc= initialize_query(ptr))
)
{
return rc;
}
rc= memcached_validate_key_length(key_length,
ptr->flags.binary_protocol);
{
return rc;
}
rc= memcached_validate_key_length(key_length,
ptr->flags.binary_protocol);
- unlikely (rc != MEMCACHED_SUCCESS)
- return rc;
- unlikely (memcached_server_count(ptr) == 0)
- return MEMCACHED_NO_SERVERS;
+ if (memcached_failed(rc))
+ {
+ return rc;
+ }
- server_key= memcached_generate_hash_with_redistribution(ptr, group_key, group_key_length);
+
uint32_t
server_key= memcached_generate_hash_with_redistribution(ptr, group_key, group_key_length);
instance= memcached_server_instance_fetch(ptr, server_key);
instance= memcached_server_instance_fetch(ptr, server_key);
- to_write= (ptr->flags.buffer_requests) ? false : true;
+
bool
to_write= (ptr->flags.buffer_requests) ? false : true;
bool no_reply= (ptr->flags.no_reply);
bool no_reply= (ptr->flags.no_reply);
@@
-120,7
+118,7
@@
memcached_return_t memcached_delete_by_key(memcached_st *ptr,
if (instance->minor_version == 0)
{
if (instance->minor_version == 0)
{
- if (no_reply
|| ! to_writ
e)
+ if (no_reply
or to_write == fals
e)
{
/* We might get out of sync with the server if we
* send this command to a server newer than 1.2.x..
{
/* We might get out of sync with the server if we
* send this command to a server newer than 1.2.x..
@@
-134,7
+132,7
@@
memcached_return_t memcached_delete_by_key(memcached_st *ptr,
}
send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
"delete %.*s%.*s %u%s\r\n",
}
send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
"delete %.*s%.*s %u%s\r\n",
- memcached_print_array(ptr->
prefix_key
),
+ memcached_print_array(ptr->
_namespace
),
(int) key_length, key,
(uint32_t)expiration,
no_reply ? " noreply" :"" );
(int) key_length, key,
(uint32_t)expiration,
no_reply ? " noreply" :"" );
@@
-144,44
+142,53
@@
memcached_return_t memcached_delete_by_key(memcached_st *ptr,
{
send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
"delete %.*s%.*s%s\r\n",
{
send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
"delete %.*s%.*s%s\r\n",
- memcached_print_array(ptr->
prefix_key
),
+ memcached_print_array(ptr->
_namespace
),
(int)key_length, key, no_reply ? " noreply" :"");
}
if (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE || send_length < 0)
{
(int)key_length, key, no_reply ? " noreply" :"");
}
if (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE || send_length < 0)
{
- rc= MEMCACHED_WRITE_FAILURE;
+ rc= memcached_set_error(*ptr, MEMCACHED_MEMORY_ALLOCATION_FAILURE, MEMCACHED_AT,
+ memcached_literal_param("snprintf(MEMCACHED_DEFAULT_COMMAND_SIZE)"));
goto error;
}
goto error;
}
- if (ptr->flags.use_udp
&& ! to_writ
e)
+ if (ptr->flags.use_udp
and to_write == fals
e)
{
if (send_length > MAX_UDP_DATAGRAM_LENGTH - UDP_DATAGRAM_HEADER_LENGTH)
return MEMCACHED_WRITE_FAILURE;
if (send_length + instance->write_buffer_offset > MAX_UDP_DATAGRAM_LENGTH)
{
if (send_length > MAX_UDP_DATAGRAM_LENGTH - UDP_DATAGRAM_HEADER_LENGTH)
return MEMCACHED_WRITE_FAILURE;
if (send_length + instance->write_buffer_offset > MAX_UDP_DATAGRAM_LENGTH)
+ {
memcached_io_write(instance, NULL, 0, true);
memcached_io_write(instance, NULL, 0, true);
+ }
}
rc= memcached_do(instance, buffer, (size_t)send_length, to_write);
}
if (rc != MEMCACHED_SUCCESS)
}
rc= memcached_do(instance, buffer, (size_t)send_length, to_write);
}
if (rc != MEMCACHED_SUCCESS)
+ {
goto error;
goto error;
+ }
- if (
! to_writ
e)
+ if (
to_write == fals
e)
{
rc= MEMCACHED_BUFFERED;
}
{
rc= MEMCACHED_BUFFERED;
}
- else if (
!no_reply
)
+ else if (
no_reply == false
)
{
rc= memcached_response(instance, buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, NULL);
if (rc == MEMCACHED_DELETED)
{
rc= memcached_response(instance, buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, NULL);
if (rc == MEMCACHED_DELETED)
+ {
rc= MEMCACHED_SUCCESS;
rc= MEMCACHED_SUCCESS;
+ }
}
}
- if (rc == MEMCACHED_SUCCESS && ptr->delete_trigger)
+ if (rc == MEMCACHED_SUCCESS and ptr->delete_trigger)
+ {
ptr->delete_trigger(ptr, key, key_length);
ptr->delete_trigger(ptr, key, key_length);
+ }
error:
LIBMEMCACHED_MEMCACHED_DELETE_END();
error:
LIBMEMCACHED_MEMCACHED_DELETE_END();
@@
-208,9
+215,9
@@
static inline memcached_return_t binary_delete(memcached_st *ptr,
{
request.message.header.request.opcode= PROTOCOL_BINARY_CMD_DELETE;
}
{
request.message.header.request.opcode= PROTOCOL_BINARY_CMD_DELETE;
}
- request.message.header.request.keylen= htons((uint16_t)(key_length + memcached_array_size(ptr->
prefix_key
)));
+ request.message.header.request.keylen= htons((uint16_t)(key_length + memcached_array_size(ptr->
_namespace
)));
request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
- request.message.header.request.bodylen= htonl((uint32_t)(key_length + memcached_array_size(ptr->
prefix_key
)));
+ request.message.header.request.bodylen= htonl((uint32_t)(key_length + memcached_array_size(ptr->
_namespace
)));
if (ptr->flags.use_udp && ! flush)
{
if (ptr->flags.use_udp && ! flush)
{
@@
-225,7
+232,7
@@
static inline memcached_return_t binary_delete(memcached_st *ptr,
struct libmemcached_io_vector_st vector[]=
{
{ sizeof(request.bytes), request.bytes},
struct libmemcached_io_vector_st vector[]=
{
{ sizeof(request.bytes), request.bytes},
- { memcached_array_size(ptr->
prefix_key), memcached_array_string(ptr->prefix_key
) },
+ { memcached_array_size(ptr->
_namespace), memcached_array_string(ptr->_namespace
) },
{ key_length, key },
};
{ key_length, key },
};
@@
-234,7
+241,6
@@
static inline memcached_return_t binary_delete(memcached_st *ptr,
if ((rc= memcached_vdo(instance, vector, 3, flush)) != MEMCACHED_SUCCESS)
{
memcached_io_reset(instance);
if ((rc= memcached_vdo(instance, vector, 3, flush)) != MEMCACHED_SUCCESS)
{
memcached_io_reset(instance);
- rc= (rc == MEMCACHED_SUCCESS) ? MEMCACHED_WRITE_FAILURE : rc;
}
unlikely (ptr->number_of_replicas > 0)
}
unlikely (ptr->number_of_replicas > 0)