summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-12-08 15:56:35 +0100
committerMichael Adam <obnox@samba.org>2011-12-15 16:00:45 +0100
commit098048a89c4ce14b17a0151dcb64c7cdf06f4152 (patch)
tree88521fdfa4a622ee998256b83653bc3e0cac85cd
parent26fc72921f7b72dfebfe8394baa85b81ef66d26d (diff)
downloadsamba-098048a89c4ce14b17a0151dcb64c7cdf06f4152.tar.gz
samba-098048a89c4ce14b17a0151dcb64c7cdf06f4152.tar.bz2
samba-098048a89c4ce14b17a0151dcb64c7cdf06f4152.zip
s3-dbwrap: Implement db_ctdb_parse_record in terms of db_ctdb_fetch
Signed-off-by: Michael Adam <obnox@samba.org>
-rw-r--r--source3/lib/dbwrap/dbwrap_ctdb.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c
index 7262b873fa..6246829400 100644
--- a/source3/lib/dbwrap/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap/dbwrap_ctdb.c
@@ -1196,6 +1196,24 @@ static NTSTATUS db_ctdb_fetch(struct db_context *db, TALLOC_CTX *mem_ctx,
return status;
}
+static NTSTATUS db_ctdb_parse_record(struct db_context *db, TDB_DATA key,
+ void (*parser)(TDB_DATA key,
+ TDB_DATA data,
+ void *private_data),
+ void *private_data)
+{
+ NTSTATUS status;
+ TDB_DATA data;
+
+ status = db_ctdb_fetch(db, talloc_tos(), key, &data);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+ parser(key, data, private_data);
+ TALLOC_FREE(data.dptr);
+ return NT_STATUS_OK;
+}
+
struct traverse_state {
struct db_context *db;
int (*fn)(struct db_record *rec, void *private_data);
@@ -1491,6 +1509,7 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
result->private_data = (void *)db_ctdb;
result->fetch_locked = db_ctdb_fetch_locked;
result->fetch = db_ctdb_fetch;
+ result->parse_record = db_ctdb_parse_record;
result->traverse = db_ctdb_traverse;
result->traverse_read = db_ctdb_traverse_read;
result->get_seqnum = db_ctdb_get_seqnum;