summaryrefslogtreecommitdiff
path: root/source4/cluster/ctdb
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-04-04 06:06:52 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:49:47 -0500
commitb03d49bced3435f708a42ed809e56bd174dd466e (patch)
treeaa544a6cb2ce950ab9bfc82e1d71a1c9cb86f7d7 /source4/cluster/ctdb
parenta78be2150ba06738f4c7e85ca2980200d4a3c533 (diff)
downloadsamba-b03d49bced3435f708a42ed809e56bd174dd466e.tar.gz
samba-b03d49bced3435f708a42ed809e56bd174dd466e.tar.bz2
samba-b03d49bced3435f708a42ed809e56bd174dd466e.zip
r22072: in order to implement the opendb ctdb backend, I've found that the
existing ctdb_call() mechanism isn't sufficient. The main problem is that the operations on the record need to be done with a lock held while a local posix file operation is happening. We can't use a ctdb_call callback function to do the actual file opens, renames, unlinks etc as the callback would run on the wrong node. So this commit adds the prototypes for two new ctdb API functions which will make a opendb backend easier. Volker will probably recognise these functions as they are basically the same as what he did in his earlier Samba clustering code :-) (This used to be commit d9a997fd390e4162c015435d1c703fb3a4978f2f)
Diffstat (limited to 'source4/cluster/ctdb')
-rw-r--r--source4/cluster/ctdb/include/ctdb.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/source4/cluster/ctdb/include/ctdb.h b/source4/cluster/ctdb/include/ctdb.h
index c5b6dbc782..51eeaebedb 100644
--- a/source4/cluster/ctdb/include/ctdb.h
+++ b/source4/cluster/ctdb/include/ctdb.h
@@ -148,4 +148,19 @@ int ctdb_set_message_handler(struct ctdb_context *ctdb, ctdb_message_fn_t handle
int ctdb_send_message(struct ctdb_context *ctdb, uint32_t vnn,
uint32_t srvid, TDB_DATA data);
+/*
+ fetch and lock a ctdb record. Underneath this will force the
+ dmaster for the record to be moved to the local node.
+
+ The lock is released when is talloc_free() is called on the
+ returned ctdb_record_handle.
+*/
+struct ctdb_record_handle *ctdb_fetch_lock(struct ctdb_db_context *ctdb_db, TDB_DATA key, TDB_DATA *data);
+
+/*
+ change the data in a record held with a ctdb_record_handle
+ if the new data is zero length, this implies a delete of the record
+ */
+int ctdb_record_store(struct ctdb_record_handle *rec, TDB_DATA data);
+
#endif