ctdb-client: Rename ctdb_db_travese to ctdb_db_traverse_local
authorAmitay Isaacs <amitay@gmail.com>
Tue, 4 Apr 2017 07:31:11 +0000 (17:31 +1000)
committerMartin Schwenke <martins@samba.org>
Wed, 7 Jun 2017 14:05:26 +0000 (16:05 +0200)
This function only traverses the database on local node.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/client/client.h
ctdb/client/client_db.c
ctdb/tools/ctdb.c

index 312615e2d4f2e6ce89aa20fe4001cd949580d90b..2205112b4f11d246d884a29d9176d4555c6b0b45 100644 (file)
@@ -695,9 +695,9 @@ int ctdb_detach(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
 
 uint32_t ctdb_db_id(struct ctdb_db_context *db);
 
 
 uint32_t ctdb_db_id(struct ctdb_db_context *db);
 
-int ctdb_db_traverse(struct ctdb_db_context *db, bool readonly,
-                    bool extract_header,
-                    ctdb_rec_parser_func_t parser, void *private_data);
+int ctdb_db_traverse_local(struct ctdb_db_context *db, bool readonly,
+                          bool extract_header,
+                          ctdb_rec_parser_func_t parser, void *private_data);
 
 int ctdb_ltdb_fetch(struct ctdb_db_context *db, TDB_DATA key,
                    struct ctdb_ltdb_header *header,
 
 int ctdb_ltdb_fetch(struct ctdb_db_context *db, TDB_DATA key,
                    struct ctdb_ltdb_header *header,
index 888cfbc35925a5f233efb5892055dae5ffe03901..cb3dc44c529c2305b5d7f512207f3a094005ad53 100644 (file)
@@ -624,18 +624,19 @@ uint32_t ctdb_db_id(struct ctdb_db_context *db)
        return db->db_id;
 }
 
        return db->db_id;
 }
 
-struct ctdb_db_traverse_state {
+struct ctdb_db_traverse_local_state {
        ctdb_rec_parser_func_t parser;
        void *private_data;
        bool extract_header;
        int error;
 };
 
        ctdb_rec_parser_func_t parser;
        void *private_data;
        bool extract_header;
        int error;
 };
 
-static int ctdb_db_traverse_handler(struct tdb_context *tdb, TDB_DATA key,
-                                   TDB_DATA data, void *private_data)
+static int ctdb_db_traverse_local_handler(struct tdb_context *tdb,
+                                         TDB_DATA key, TDB_DATA data,
+                                         void *private_data)
 {
 {
-       struct ctdb_db_traverse_state *state =
-               (struct ctdb_db_traverse_state *)private_data;
+       struct ctdb_db_traverse_local_state *state =
+               (struct ctdb_db_traverse_local_state *)private_data;
        int ret;
 
        if (state->extract_header) {
        int ret;
 
        if (state->extract_header) {
@@ -660,11 +661,11 @@ static int ctdb_db_traverse_handler(struct tdb_context *tdb, TDB_DATA key,
        return 0;
 }
 
        return 0;
 }
 
-int ctdb_db_traverse(struct ctdb_db_context *db, bool readonly,
-                    bool extract_header,
-                    ctdb_rec_parser_func_t parser, void *private_data)
+int ctdb_db_traverse_local(struct ctdb_db_context *db, bool readonly,
+                          bool extract_header,
+                          ctdb_rec_parser_func_t parser, void *private_data)
 {
 {
-       struct ctdb_db_traverse_state state;
+       struct ctdb_db_traverse_local_state state;
        int ret;
 
        state.parser = parser;
        int ret;
 
        state.parser = parser;
@@ -674,10 +675,11 @@ int ctdb_db_traverse(struct ctdb_db_context *db, bool readonly,
 
        if (readonly) {
                ret = tdb_traverse_read(db->ltdb->tdb,
 
        if (readonly) {
                ret = tdb_traverse_read(db->ltdb->tdb,
-                                       ctdb_db_traverse_handler, &state);
+                                       ctdb_db_traverse_local_handler,
+                                       &state);
        } else {
                ret = tdb_traverse(db->ltdb->tdb,
        } else {
                ret = tdb_traverse(db->ltdb->tdb,
-                                  ctdb_db_traverse_handler, &state);
+                                  ctdb_db_traverse_local_handler, &state);
        }
 
        if (ret == -1) {
        }
 
        if (ret == -1) {
index 0890992cc3402df9229eeaf40a5cf8cf5bfe5de8..a55812a077ef15c842a6b747046bd4f0b59f7d21 100644 (file)
@@ -2220,7 +2220,7 @@ static int control_cattdb(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,
        }
 
        state.count = 0;
        }
 
        state.count = 0;
-       ret = ctdb_db_traverse(db, true, true, dump_record, &state);
+       ret = ctdb_db_traverse_local(db, true, true, dump_record, &state);
 
        printf("Dumped %u record(s)\n", state.count);
 
 
        printf("Dumped %u record(s)\n", state.count);
 
@@ -4152,7 +4152,7 @@ static int control_backupdb(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,
        state.nbuf = 0;
        state.nrec = 0;
 
        state.nbuf = 0;
        state.nrec = 0;
 
-       ret = ctdb_db_traverse(db, true, false, backup_handler, &state);
+       ret = ctdb_db_traverse_local(db, true, false, backup_handler, &state);
        if (ret != 0) {
                fprintf(stderr, "Failed to collect records from DB %s\n",
                        db_name);
        if (ret != 0) {
                fprintf(stderr, "Failed to collect records from DB %s\n",
                        db_name);