]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-dict: remove dict_append()
authorBaofeng Wang <baofeng.wang@dovecot.fi>
Wed, 20 Apr 2016 14:24:51 +0000 (17:24 +0300)
committerBaofeng Wang <baofeng.wang@dovecot.fi>
Thu, 21 Apr 2016 06:18:48 +0000 (09:18 +0300)
Remove all *_dict_append and redis_append functions and corresponding
command from lib-dict.

src/dict/dict-commands.c
src/lib-dict/dict-client.c
src/lib-dict/dict-file.c
src/lib-dict/dict-ldap.c
src/lib-dict/dict-memcached-ascii.c
src/lib-dict/dict-private.h
src/lib-dict/dict-redis.c
src/lib-dict/dict-sql.c
src/lib-dict/dict.c
src/lib-dict/dict.h

index 9742a5ead742813f122bdae63fb695d5ba4510b9..f38e1976bf96d57f7eb4d6a059adf91aff7a8e71 100644 (file)
@@ -367,25 +367,6 @@ static int cmd_unset(struct dict_connection_cmd *cmd, const char *line)
        return 0;
 }
 
-static int cmd_append(struct dict_connection_cmd *cmd, const char *line)
-{
-       struct dict_connection_transaction *trans;
-       const char *const *args;
-
-       /* <id> <key> <value> */
-       args = t_strsplit_tabescaped(line);
-       if (str_array_length(args) != 3) {
-               i_error("dict client: APPEND: broken input");
-               return -1;
-       }
-
-       if (dict_connection_transaction_lookup_parse(cmd->conn, args[0], &trans) < 0)
-               return -1;
-
-        dict_append(trans->ctx, args[1], args[2]);
-       return 0;
-}
-
 static int cmd_atomic_inc(struct dict_connection_cmd *cmd, const char *line)
 {
        struct dict_connection_transaction *trans;
@@ -416,7 +397,6 @@ static const struct dict_cmd_func cmds[] = {
        { DICT_PROTOCOL_CMD_ROLLBACK, cmd_rollback },
        { DICT_PROTOCOL_CMD_SET, cmd_set },
        { DICT_PROTOCOL_CMD_UNSET, cmd_unset },
-       { DICT_PROTOCOL_CMD_APPEND, cmd_append },
        { DICT_PROTOCOL_CMD_ATOMIC_INC, cmd_atomic_inc },
 
        { 0, NULL }
index 5eed547a4de249d3c9eb07bd1edcd0b6c84d7661..b902c89ed3cd619afa773956031fc215d3dcd369 100644 (file)
@@ -874,23 +874,6 @@ static void client_dict_unset(struct dict_transaction_context *_ctx,
        } T_END;
 }
 
-static void client_dict_append(struct dict_transaction_context *_ctx,
-                              const char *key, const char *value)
-{
-       struct client_dict_transaction_context *ctx =
-               (struct client_dict_transaction_context *)_ctx;
-
-       T_BEGIN {
-               const char *query;
-
-               query = t_strdup_printf("%c%u\t%s\t%s\n",
-                                       DICT_PROTOCOL_CMD_APPEND, ctx->id,
-                                       dict_client_escape(key),
-                                       dict_client_escape(value));
-               client_dict_send_transaction_query(ctx, query);
-       } T_END;
-}
-
 static void client_dict_atomic_inc(struct dict_transaction_context *_ctx,
                                   const char *key, long long diff)
 {
@@ -922,7 +905,6 @@ struct dict dict_driver_client = {
                client_dict_transaction_rollback,
                client_dict_set,
                client_dict_unset,
-               client_dict_append,
                client_dict_atomic_inc,
                NULL
        }
index b6d9f1750646bfd279b221e13b1bccc90fc79776..01ee71e9525c95528204fde569c4fdbaf994ffa5 100644 (file)
@@ -661,7 +661,6 @@ struct dict dict_driver_file = {
                dict_transaction_memory_rollback,
                dict_transaction_memory_set,
                dict_transaction_memory_unset,
-               dict_transaction_memory_append,
                dict_transaction_memory_atomic_inc,
                NULL
        }
index 5ea12daa6d1a6d0ae0400ff5f6b31be100dd1f83..a908f00b03d47fbba049dbda4502c6354ad0aa2b 100644 (file)
@@ -378,9 +378,6 @@ static
 void ldap_dict_unset(struct dict_transaction_context *ctx,
                      const char *key);
 static
-void ldap_dict_append(struct dict_transaction_context *ctx,
-                      const char *key, const char *value);
-static
 void ldap_dict_atomic_inc(struct dict_transaction_context *ctx,
                           const char *key, long long diff);
 */
@@ -442,7 +439,6 @@ struct dict dict_driver_ldap = {
                NULL, /*ldap_transaction_rollback,*/
                NULL, /*ldap_set,*/
                NULL, /*ldap_unset,*/
-               NULL, /*ldap_append,*/
                NULL, /*ldap_atomic_inc,*/
                ldap_dict_lookup_async
        }
index 7245a0229fb3888cd43ec786dd1fce14c99a1ad9..3fbfb61b92404d5c6771c0001922c0c47120f2fb 100644 (file)
@@ -662,7 +662,6 @@ struct dict dict_driver_memcached_ascii = {
                dict_transaction_memory_rollback,
                dict_transaction_memory_set,
                dict_transaction_memory_unset,
-               dict_transaction_memory_append,
                dict_transaction_memory_atomic_inc,
                NULL
        }
index 7fc0f00d2cfccc81cab80070427b5e89e5fff146..b790bc853e53a8dff4cc3223b8e80e20c4f95f5f 100644 (file)
@@ -31,8 +31,6 @@ struct dict_vfuncs {
                    const char *key, const char *value);
        void (*unset)(struct dict_transaction_context *ctx,
                      const char *key);
-       void (*append)(struct dict_transaction_context *ctx,
-                      const char *key, const char *value);
        void (*atomic_inc)(struct dict_transaction_context *ctx,
                           const char *key, long long diff);
 
index 6aa38247f1f621be2c3bf86ec0690e227b3c1a27..205b3fb85985ca310ea1b79802a01f9e336cf11d 100644 (file)
@@ -739,27 +739,6 @@ static void redis_unset(struct dict_transaction_context *_ctx,
        ctx->cmd_count++;
 }
 
-static void redis_append(struct dict_transaction_context *_ctx,
-                        const char *key, const char *value)
-{
-       struct redis_dict_transaction_context *ctx =
-               (struct redis_dict_transaction_context *)_ctx;
-       struct redis_dict *dict = (struct redis_dict *)_ctx->dict;
-       const char *cmd;
-
-       if (redis_check_transaction(ctx) < 0)
-               return;
-
-       key = redis_dict_get_full_key(dict, key);
-       cmd = t_strdup_printf("*3\r\n$6\r\nAPPEND\r\n$%u\r\n%s\r\n$%u\r\n%s\r\n",
-                             (unsigned int)strlen(key), key,
-                             (unsigned int)strlen(value), value);
-       if (o_stream_send_str(dict->conn.conn.output, cmd) < 0)
-               ctx->failed = TRUE;
-       redis_input_state_add(dict, REDIS_INPUT_STATE_MULTI);
-       ctx->cmd_count++;
-}
-
 static void redis_atomic_inc(struct dict_transaction_context *_ctx,
                             const char *key, long long diff)
 {
@@ -800,7 +779,6 @@ struct dict dict_driver_redis = {
                redis_transaction_rollback,
                redis_set,
                redis_unset,
-               redis_append,
                redis_atomic_inc,
                NULL
        }
index 6af83ece99b7fde6cf1531c3ae4981aa2c779b98..ee9e94d6edaaa2f00284f5cb32126f6f5226f067 100644 (file)
@@ -1071,17 +1071,6 @@ static void sql_dict_unset(struct dict_transaction_context *_ctx,
        } T_END;
 }
 
-static void
-sql_dict_append(struct dict_transaction_context *_ctx,
-               const char *key ATTR_UNUSED, const char *value ATTR_UNUSED)
-{
-       struct sql_dict_transaction_context *ctx =
-               (struct sql_dict_transaction_context *)_ctx;
-
-       i_error("sql dict: Append command not implemented currently");
-       ctx->failed = TRUE;
-}
-
 static unsigned int *
 sql_dict_next_inc_row(struct sql_dict_transaction_context *ctx)
 {
@@ -1254,7 +1243,6 @@ static struct dict sql_dict = {
                sql_dict_transaction_rollback,
                sql_dict_set,
                sql_dict_unset,
-               sql_dict_append,
                sql_dict_atomic_inc,
                sql_dict_lookup_async
        }
index e3d1deb2f5d4e9f001587450d1732468c9d36ee1..491d4149d17c10b2a56a7a048f53868d5457b538 100644 (file)
@@ -242,15 +242,6 @@ void dict_unset(struct dict_transaction_context *ctx,
        ctx->changed = TRUE;
 }
 
-void dict_append(struct dict_transaction_context *ctx,
-                const char *key, const char *value)
-{
-       i_assert(dict_key_prefix_is_valid(key));
-
-       ctx->dict->v.append(ctx, key, value);
-       ctx->changed = TRUE;
-}
-
 void dict_atomic_inc(struct dict_transaction_context *ctx,
                     const char *key, long long diff)
 {
index ed661a9ac1920f014dea440e84012a7e2eb2e532..2d27df6bf929c1ca0a6d60bb59c6af9f53c008af 100644 (file)
@@ -123,9 +123,6 @@ void dict_set(struct dict_transaction_context *ctx,
 /* Unset a record in dictionary, identified by key*/
 void dict_unset(struct dict_transaction_context *ctx,
                const char *key);
-/* Append to an existing key in dictionary. Preferably an atomic operation. */
-void dict_append(struct dict_transaction_context *ctx,
-                const char *key, const char *value);
 /* Increase/decrease a numeric value in dictionary. Note that the value is
    changed when transaction is being committed, so you can't know beforehand
    what the value will become. The value is updated only if it already exists,