diff options
author | Alexander Bokovoy <ab@samba.org> | 2008-01-16 18:53:16 +0300 |
---|---|---|
committer | Alexander Bokovoy <ab@samba.org> | 2008-01-16 18:53:16 +0300 |
commit | 02680bd75d803c1b54b39e95af5224fb98d1b723 (patch) | |
tree | 43516dab9b60fa5e5aadc79ee5c54c64687aadb8 /source3/lib/ctdbd_conn.c | |
parent | 587a2dbf8d000640109c2b36a924cd4c2694897f (diff) | |
parent | 024741500abd30ac74adfdfa88694026792ba284 (diff) | |
download | samba-02680bd75d803c1b54b39e95af5224fb98d1b723.tar.gz samba-02680bd75d803c1b54b39e95af5224fb98d1b723.tar.bz2 samba-02680bd75d803c1b54b39e95af5224fb98d1b723.zip |
Merge branch 'ctdb-merge' into v3-2-test
(This used to be commit 175662b5bbb5c8ecd81a60539f5846a938c26a3a)
Diffstat (limited to 'source3/lib/ctdbd_conn.c')
-rw-r--r-- | source3/lib/ctdbd_conn.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c index 899bbcfcce..18e9879601 100644 --- a/source3/lib/ctdbd_conn.c +++ b/source3/lib/ctdbd_conn.c @@ -1203,6 +1203,42 @@ NTSTATUS ctdbd_register_reconfigure(struct ctdbd_connection *conn) return register_with_ctdbd(conn, CTDB_SRVID_RECONFIGURE); } +/* + persstent store. Used when we update a record in a persistent database + */ +NTSTATUS ctdbd_persistent_store(struct ctdbd_connection *conn, uint32_t db_id, TDB_DATA key, TDB_DATA data) +{ + int cstatus=0; + struct ctdb_rec_data *rec; + TDB_DATA recdata; + size_t length; + NTSTATUS status; + + length = offsetof(struct ctdb_rec_data, data) + key.dsize + data.dsize; + + rec = (struct ctdb_rec_data *)talloc_size(conn, length); + NT_STATUS_HAVE_NO_MEMORY(rec); + + rec->length = length; + rec->reqid = db_id; + rec->keylen = key.dsize; + rec->datalen= data.dsize; + memcpy(&rec->data[0], key.dptr, key.dsize); + memcpy(&rec->data[key.dsize], data.dptr, data.dsize); + + recdata.dptr = (uint8_t *)rec; + recdata.dsize = length; + + status = ctdbd_control(conn, CTDB_CURRENT_NODE, + CTDB_CONTROL_PERSISTENT_STORE, + 0, recdata, NULL, NULL, &cstatus); + if (cstatus != 0) { + return NT_STATUS_INTERNAL_DB_CORRUPTION; + } + return status; +} + + #else NTSTATUS ctdbd_init_connection(TALLOC_CTX *mem_ctx, |