}
fs_file_deinit(&file);
break;
- case DICT_CHANGE_TYPE_APPEND:
case DICT_CHANGE_TYPE_INC:
i_unreached();
}
DICT_PROTOCOL_CMD_SET = 'S', /* <id> <key> <value> */
DICT_PROTOCOL_CMD_UNSET = 'U', /* <id> <key> */
- DICT_PROTOCOL_CMD_APPEND = 'P', /* <id> <key> <value> */
DICT_PROTOCOL_CMD_ATOMIC_INC = 'A' /* <id> <key> <diff> */
};
}
hash_table_update(dict->hash, key, value);
break;
- case DICT_CHANGE_TYPE_APPEND:
- if (key == NULL)
- key = p_strdup(dict->hash_pool, change->key);
- if (old_value == NULL) {
- value = p_strdup(dict->hash_pool,
- change->value.str);
- } else {
- value = p_strconcat(dict->hash_pool, old_value,
- change->value.str, NULL);
- }
- hash_table_update(dict->hash, key, value);
- break;
case DICT_CHANGE_TYPE_UNSET:
if (old_value != NULL)
hash_table_remove(dict->hash, key);
enum memcached_ascii_input_state {
/* GET: expecting VALUE or END */
MEMCACHED_INPUT_STATE_GET,
- /* SET/(APPEND+ADD): expecting STORED / NOT_STORED */
+ /* SET: expecting STORED / NOT_STORED */
MEMCACHED_INPUT_STATE_STORED,
/* DELETE: expecting DELETED */
MEMCACHED_INPUT_STATE_DELETED,
state = MEMCACHED_INPUT_STATE_DELETED;
str_printfa(ctx->str, "delete %s\r\n", key);
break;
- case DICT_CHANGE_TYPE_APPEND:
- state = MEMCACHED_INPUT_STATE_STORED;
- str_printfa(ctx->str, "append %s 0 0 %"PRIuSIZE_T"\r\n%s\r\n",
- key, strlen(change->value.str), change->value.str);
- array_append(&ctx->dict->input_states, &state, 1);
- /* we'd preferably want an append that always works, but
- this kludge works for that too.. */
- str_printfa(ctx->str, "add %s 0 0 %"PRIuSIZE_T"\r\n%s\r\n",
- key, strlen(change->value.str), change->value.str);
- break;
case DICT_CHANGE_TYPE_INC:
state = MEMCACHED_INPUT_STATE_INCRDECR;
if (change->value.diff > 0) {
change->key = p_strdup(ctx->pool, key);
}
-void dict_transaction_memory_append(struct dict_transaction_context *_ctx,
- const char *key, const char *value)
-{
- struct dict_transaction_memory_context *ctx =
- (struct dict_transaction_memory_context *)_ctx;
- struct dict_transaction_memory_change *change;
-
- change = array_append_space(&ctx->changes);
- change->type = DICT_CHANGE_TYPE_APPEND;
- change->key = p_strdup(ctx->pool, key);
- change->value.str = p_strdup(ctx->pool, value);
-}
-
void dict_transaction_memory_atomic_inc(struct dict_transaction_context *_ctx,
const char *key, long long diff)
{
enum dict_change_type {
DICT_CHANGE_TYPE_SET,
DICT_CHANGE_TYPE_UNSET,
- DICT_CHANGE_TYPE_APPEND,
DICT_CHANGE_TYPE_INC
};
const char *key, const char *value);
void dict_transaction_memory_unset(struct dict_transaction_context *ctx,
const char *key);
-void dict_transaction_memory_append(struct dict_transaction_context *_ctx,
- const char *key, const char *value);
void dict_transaction_memory_atomic_inc(struct dict_transaction_context *ctx,
const char *key, long long diff);