Author: tridge Date: 2007-04-04 06:06:52 +0000 (Wed, 04 Apr 2007) New Revision: 22072
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=22072 Log: 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 :-) Modified: branches/SAMBA_4_0/source/cluster/ctdb/include/ctdb.h Changeset: Modified: branches/SAMBA_4_0/source/cluster/ctdb/include/ctdb.h =================================================================== --- branches/SAMBA_4_0/source/cluster/ctdb/include/ctdb.h 2007-04-04 06:03:54 UTC (rev 22071) +++ branches/SAMBA_4_0/source/cluster/ctdb/include/ctdb.h 2007-04-04 06:06:52 UTC (rev 22072) @@ -148,4 +148,19 @@ 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
