int send_length;
send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
"%s %.*s%.*s %" PRIu64 "%s\r\n", verb,
- memcached_print_array(ptr->prefix_key),
+ memcached_print_array(ptr->_namespace),
(int)key_length, key,
offset, no_reply ? " noreply" : "");
if (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE || send_length < 0)
request.message.header.request.magic= PROTOCOL_BINARY_REQ;
request.message.header.request.opcode= cmd;
- 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.extlen= 20;
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.extlen));
+ request.message.header.request.bodylen= htonl((uint32_t)(key_length + memcached_array_size(ptr->_namespace) +request.message.header.request.extlen));
request.message.body.delta= memcached_htonll(offset);
request.message.body.initial= memcached_htonll(initial);
request.message.body.expiration= htonl((uint32_t) expiration);
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 }
};
memcached_literal_param("MEMCACHED_BEHAVIOR_USER_DATA deprecated."));
case MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY:
- ptr->flags.hash_with_prefix_key= bool(data);
+ ptr->flags.hash_with_namespace= bool(data);
break;
case MEMCACHED_BEHAVIOR_NOREPLY:
return 0;
case MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY:
- return ptr->flags.hash_with_prefix_key;
+ return ptr->flags.hash_with_namespace;
case MEMCACHED_BEHAVIOR_NOREPLY:
return ptr->flags.no_reply;
{
case MEMCACHED_CALLBACK_PREFIX_KEY:
{
- if (ptr->prefix_key)
+ if (ptr->_namespace)
{
*error= MEMCACHED_SUCCESS;
- return (void *)memcached_array_string(ptr->prefix_key);
+ return (void *)memcached_array_string(ptr->_namespace);
}
else
{
#include <libmemcached/byteorder.h>
#include <libmemcached/initialize_query.h>
#include <libmemcached/response.h>
-#include <libmemcached/prefix_key.h>
+#include <libmemcached/namespace.h>
/* string value */
struct memcached_continuum_item_st
}
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" :"" );
{
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" :"");
}
{
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.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)
{
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 },
};
struct libmemcached_io_vector_st vector[]=
{
{ get_command_length, get_command },
- { memcached_array_size(ptr->prefix_key), memcached_array_string(ptr->prefix_key) },
+ { memcached_array_size(ptr->_namespace), memcached_array_string(ptr->_namespace) },
{ key_length[x], keys[x] },
{ 1, " " }
};
return vk;
}
- request.message.header.request.keylen= htons((uint16_t)(key_length[x] + memcached_array_size(ptr->prefix_key)));
+ request.message.header.request.keylen= htons((uint16_t)(key_length[x] + memcached_array_size(ptr->_namespace)));
request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
- request.message.header.request.bodylen= htonl((uint32_t)( key_length[x] + memcached_array_size(ptr->prefix_key)));
+ request.message.header.request.bodylen= htonl((uint32_t)( key_length[x] + memcached_array_size(ptr->_namespace)));
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[x], keys[x] }
};
protocol_binary_request_getk request= {};
request.message.header.request.magic= PROTOCOL_BINARY_REQ;
request.message.header.request.opcode= PROTOCOL_BINARY_CMD_GETK;
- request.message.header.request.keylen= htons((uint16_t)(key_length[x] + memcached_array_size(ptr->prefix_key)));
+ request.message.header.request.keylen= htons((uint16_t)(key_length[x] + memcached_array_size(ptr->_namespace)));
request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
- request.message.header.request.bodylen= htonl((uint32_t)(key_length[x] + memcached_array_size(ptr->prefix_key)));
+ request.message.header.request.bodylen= htonl((uint32_t)(key_length[x] + memcached_array_size(ptr->_namespace)));
/*
* We need to disable buffering to actually know that the request was
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[x], keys[x] }
};
if (memcached_server_count(ptr) == 1)
return 0;
- if (ptr->flags.hash_with_prefix_key)
+ if (ptr->flags.hash_with_namespace)
{
- size_t temp_length= memcached_array_size(ptr->prefix_key) + key_length;
+ size_t temp_length= memcached_array_size(ptr->_namespace) + key_length;
char temp[MEMCACHED_MAX_KEY];
if (temp_length > MEMCACHED_MAX_KEY -1)
return 0;
- strncpy(temp, memcached_array_string(ptr->prefix_key), memcached_array_size(ptr->prefix_key));
- strncpy(temp + memcached_array_size(ptr->prefix_key), key, key_length);
+ strncpy(temp, memcached_array_string(ptr->_namespace), memcached_array_size(ptr->_namespace));
+ strncpy(temp + memcached_array_size(ptr->_namespace), key, key_length);
return generate_hash(ptr, temp, temp_length);
}
.auto_eject_hosts= false,
.binary_protocol= false,
.buffer_requests= false,
- .hash_with_prefix_key= false,
+ .hash_with_namespace= false,
.no_block= false,
.no_reply= false,
.randomize_replica_read= false,
self->flags.auto_eject_hosts= false;
self->flags.binary_protocol= false;
self->flags.buffer_requests= false;
- self->flags.hash_with_prefix_key= false;
+ self->flags.hash_with_namespace= false;
self->flags.no_block= false;
self->flags.no_reply= false;
self->flags.randomize_replica_read= false;
self->sasl.is_allocated= false;
self->error_messages= NULL;
- self->prefix_key= NULL;
+ self->_namespace= NULL;
self->configure.initial_pool_size= 1;
self->configure.max_pool_size= 1;
self->configure.version= -1;
libmemcached_free(ptr, ptr->ketama.continuum);
- memcached_array_free(ptr->prefix_key);
- ptr->prefix_key= NULL;
+ memcached_array_free(ptr->_namespace);
+ ptr->_namespace= NULL;
memcached_error_free(*ptr);
}
- new_clone->prefix_key= memcached_array_clone(new_clone, source->prefix_key);
- new_clone->configure.filename= memcached_array_clone(new_clone, source->prefix_key);
+ new_clone->_namespace= memcached_array_clone(new_clone, source->_namespace);
+ new_clone->configure.filename= memcached_array_clone(new_clone, source->_namespace);
#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
if (source->sasl.callbacks)
bool auto_eject_hosts:1;
bool binary_protocol:1;
bool buffer_requests:1;
- bool hash_with_prefix_key:1;
+ bool hash_with_namespace:1;
bool no_block:1; // Don't block
bool no_reply:1;
bool randomize_replica_read:1;
memcached_callback_st *callbacks;
struct memcached_sasl_st sasl;
struct memcached_error_t *error_messages;
- struct memcached_array_st *prefix_key;
+ struct memcached_array_st *_namespace;
struct {
uint32_t initial_pool_size;
uint32_t max_pool_size;
return memcached_set_error(*self, MEMCACHED_KEY_TOO_BIG, MEMCACHED_AT);
}
- memcached_array_free(self->prefix_key);
- self->prefix_key= memcached_strcpy(self, key, key_length);
+ memcached_array_free(self->_namespace);
+ self->_namespace= memcached_strcpy(self, key, key_length);
- if (not self->prefix_key)
+ if (not self->_namespace)
{
return memcached_set_error(*self, MEMCACHED_MEMORY_ALLOCATION_FAILURE, MEMCACHED_AT);
}
}
else
{
- memcached_array_free(self->prefix_key);
- self->prefix_key= NULL;
+ memcached_array_free(self->_namespace);
+ self->_namespace= NULL;
}
return MEMCACHED_SUCCESS;
key= result->item_key;
result->key_length= 0;
- for (prefix_length= memcached_array_size(ptr->root->prefix_key); !(iscntrl(*string_ptr) || isspace(*string_ptr)) ; string_ptr++)
+ for (prefix_length= memcached_array_size(ptr->root->_namespace); !(iscntrl(*string_ptr) || isspace(*string_ptr)) ; string_ptr++)
{
if (prefix_length == 0)
{
// Only bother with doing this if key_length > 0
if (result->key_length)
{
- if (memcached_array_size(ptr->root->prefix_key) and memcached_array_size(ptr->root->prefix_key) >= result->key_length)
+ if (memcached_array_size(ptr->root->_namespace) and memcached_array_size(ptr->root->_namespace) >= result->key_length)
{
return memcached_set_error(*ptr, MEMCACHED_UNKNOWN_READ_FAILURE, MEMCACHED_AT);
}
- if (memcached_array_size(ptr->root->prefix_key))
+ if (memcached_array_size(ptr->root->_namespace))
{
- result->key_length-= memcached_array_size(ptr->root->prefix_key);
- memmove(result->item_key, result->item_key +memcached_array_size(ptr->root->prefix_key), result->key_length);
+ result->key_length-= memcached_array_size(ptr->root->_namespace);
+ memmove(result->item_key, result->item_key +memcached_array_size(ptr->root->_namespace), result->key_length);
}
}
check_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
"%s %.*s%.*s %u %llu %lu %llu%s\r\n",
storage_op_string(verb),
- memcached_print_array(ptr->prefix_key),
+ memcached_print_array(ptr->_namespace),
(int)key_length, key, flags,
(unsigned long long)expiration, (unsigned long)value_length,
(unsigned long long)cas,
memcpy(buffer_ptr, command, strlen(command));
/* Copy in the key prefix, switch to the buffer_ptr */
- buffer_ptr= (char *)memcpy((char *)(buffer_ptr + strlen(command)), (char *)memcached_array_string(ptr->prefix_key), memcached_array_size(ptr->prefix_key));
+ buffer_ptr= (char *)memcpy((char *)(buffer_ptr + strlen(command)), (char *)memcached_array_string(ptr->_namespace), memcached_array_size(ptr->_namespace));
/* Copy in the key, adjust point if a key prefix was used. */
- buffer_ptr= (char *)memcpy(buffer_ptr + memcached_array_size(ptr->prefix_key),
+ buffer_ptr= (char *)memcpy(buffer_ptr + memcached_array_size(ptr->_namespace),
key, key_length);
buffer_ptr+= key_length;
buffer_ptr[0]= ' ';
request.message.header.request.magic= PROTOCOL_BINARY_REQ;
request.message.header.request.opcode= get_com_code(verb, noreply);
- 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;
if (verb == APPEND_OP || verb == PREPEND_OP)
send_length -= 8; /* append & prepend does not contain extras! */
request.message.body.expiration= htonl((uint32_t)expiration);
}
- request.message.header.request.bodylen= htonl((uint32_t) (key_length + memcached_array_size(ptr->prefix_key) + value_length +
+ request.message.header.request.bodylen= htonl((uint32_t) (key_length + memcached_array_size(ptr->_namespace) + value_length +
request.message.header.request.extlen));
if (cas)
struct libmemcached_io_vector_st vector[]=
{
{ send_length, 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 },
{ value_length, value }
};
test_true(memc_clone->flags.verify_key == memc->flags.verify_key);
test_true(memc_clone->ketama.weighted == memc->ketama.weighted);
test_true(memc_clone->flags.binary_protocol == memc->flags.binary_protocol);
- test_true(memc_clone->flags.hash_with_prefix_key == memc->flags.hash_with_prefix_key);
+ test_true(memc_clone->flags.hash_with_namespace == memc->flags.hash_with_namespace);
test_true(memc_clone->flags.no_reply == memc->flags.no_reply);
test_true(memc_clone->flags.use_udp == memc->flags.use_udp);
test_true(memc_clone->flags.auto_eject_hosts == memc->flags.auto_eject_hosts);
{
test_true(return_value);
test_compare(MEMCACHED_SUCCESS, rc);
- if (not memc->prefix_key)
+ if (not memc->_namespace)
{
test_compare(return_key_length, return_value_length);
test_memcmp(return_value, return_key, return_value_length);