summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/dbwrap.h3
-rw-r--r--source3/lib/dbwrap_ctdb.c10
-rw-r--r--source3/lib/dbwrap_rbt.c11
-rw-r--r--source3/lib/dbwrap_tdb.c24
4 files changed, 48 insertions, 0 deletions
diff --git a/source3/include/dbwrap.h b/source3/include/dbwrap.h
index 4eb174fef1..5c824750d1 100644
--- a/source3/include/dbwrap.h
+++ b/source3/include/dbwrap.h
@@ -42,6 +42,9 @@ struct db_context {
void *private_data),
void *private_data);
int (*get_seqnum)(struct db_context *db);
+ int (*transaction_start)(struct db_context *db);
+ int (*transaction_commit)(struct db_context *db);
+ int (*transaction_cancel)(struct db_context *db);
void *private_data;
bool persistent;
};
diff --git a/source3/lib/dbwrap_ctdb.c b/source3/lib/dbwrap_ctdb.c
index f497f871d2..a66ea7ceb5 100644
--- a/source3/lib/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap_ctdb.c
@@ -441,6 +441,13 @@ static int db_ctdb_get_seqnum(struct db_context *db)
return tdb_get_seqnum(ctx->wtdb->tdb);
}
+static int db_ctdb_trans_dummy(struct db_context *db)
+{
+ /*
+ * Not implemented yet, just return ok
+ */
+ return 0;
+}
struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
const char *name,
@@ -495,6 +502,9 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
result->traverse = db_ctdb_traverse;
result->traverse_read = db_ctdb_traverse_read;
result->get_seqnum = db_ctdb_get_seqnum;
+ result->transaction_start = db_ctdb_trans_dummy;
+ result->transaction_commit = db_ctdb_trans_dummy;
+ result->transaction_cancel = db_ctdb_trans_dummy;
DEBUG(3,("db_open_ctdb: opened database '%s' with dbid 0x%x\n",
name, db_ctdb->db_id));
diff --git a/source3/lib/dbwrap_rbt.c b/source3/lib/dbwrap_rbt.c
index 633b695b52..46459c86da 100644
--- a/source3/lib/dbwrap_rbt.c
+++ b/source3/lib/dbwrap_rbt.c
@@ -351,6 +351,14 @@ static int db_rbt_get_seqnum(struct db_context *db)
return 0;
}
+static int db_rbt_trans_dummy(struct db_context *db)
+{
+ /*
+ * Transactions are pretty pointless in-memory, just return success.
+ */
+ return 0;
+}
+
struct db_context *db_open_rbt(TALLOC_CTX *mem_ctx)
{
struct db_context *result;
@@ -373,6 +381,9 @@ struct db_context *db_open_rbt(TALLOC_CTX *mem_ctx)
result->traverse = db_rbt_traverse;
result->traverse_read = db_rbt_traverse;
result->get_seqnum = db_rbt_get_seqnum;
+ result->transaction_start = db_rbt_trans_dummy;
+ result->transaction_commit = db_rbt_trans_dummy;
+ result->transaction_cancel = db_rbt_trans_dummy;
return result;
}
diff --git a/source3/lib/dbwrap_tdb.c b/source3/lib/dbwrap_tdb.c
index da55049e52..7bdadd3770 100644
--- a/source3/lib/dbwrap_tdb.c
+++ b/source3/lib/dbwrap_tdb.c
@@ -291,6 +291,27 @@ static int db_tdb_get_seqnum(struct db_context *db)
return tdb_get_seqnum(db_ctx->wtdb->tdb);
}
+static int db_tdb_transaction_start(struct db_context *db)
+{
+ struct db_tdb_ctx *db_ctx =
+ talloc_get_type_abort(db->private_data, struct db_tdb_ctx);
+ return tdb_transaction_start(db_ctx->wtdb->tdb);
+}
+
+static int db_tdb_transaction_commit(struct db_context *db)
+{
+ struct db_tdb_ctx *db_ctx =
+ talloc_get_type_abort(db->private_data, struct db_tdb_ctx);
+ return tdb_transaction_commit(db_ctx->wtdb->tdb);
+}
+
+static int db_tdb_transaction_cancel(struct db_context *db)
+{
+ struct db_tdb_ctx *db_ctx =
+ talloc_get_type_abort(db->private_data, struct db_tdb_ctx);
+ return tdb_transaction_cancel(db_ctx->wtdb->tdb);
+}
+
struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
const char *name,
int hash_size, int tdb_flags,
@@ -324,6 +345,9 @@ struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
result->traverse_read = db_tdb_traverse_read;
result->get_seqnum = db_tdb_get_seqnum;
result->persistent = ((tdb_flags & TDB_CLEAR_IF_FIRST) == 0);
+ result->transaction_start = db_tdb_transaction_start;
+ result->transaction_commit = db_tdb_transaction_commit;
+ result->transaction_cancel = db_tdb_transaction_cancel;
return result;
fail: