]> git.ozlabs.org Git - ccan/blob - ccan/tdb2/tdb1.h
tdb2: unify tdb1_chainlock et al. into tdb_chainlock
[ccan] / ccan / tdb2 / tdb1.h
1 #ifndef TDB1_H
2 #define TDB1_H
3
4 /*
5    Unix SMB/CIFS implementation.
6
7    trivial database library (version 1 compat functions)
8
9    Copyright (C) Andrew Tridgell 1999-2004
10    Copyright (C) Rusty Russell 2011
11
12      ** NOTE! The following LGPL license applies to the tdb
13      ** library. This does NOT imply that all of Samba is released
14      ** under the LGPL
15
16    This library is free software; you can redistribute it and/or
17    modify it under the terms of the GNU Lesser General Public
18    License as published by the Free Software Foundation; either
19    version 3 of the License, or (at your option) any later version.
20
21    This library is distributed in the hope that it will be useful,
22    but WITHOUT ANY WARRANTY; without even the implied warranty of
23    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
24    Lesser General Public License for more details.
25
26    You should have received a copy of the GNU Lesser General Public
27    License along with this library; if not, see <http://www.gnu.org/licenses/>.
28 */
29 #include "tdb2.h"
30
31 #ifndef _SAMBA_BUILD_
32 /* For mode_t */
33 #include <sys/types.h>
34 /* For O_* flags. */
35 #include <sys/stat.h>
36 #endif
37
38
39 void tdb1_set_max_dead(struct tdb_context *tdb, int max_dead);
40
41 int tdb1_parse_record(struct tdb_context *tdb, TDB_DATA key,
42                               int (*parser)(TDB_DATA key, TDB_DATA data,
43                                             void *private_data),
44                               void *private_data);
45
46 TDB_DATA tdb1_firstkey(struct tdb_context *tdb);
47
48 TDB_DATA tdb1_nextkey(struct tdb_context *tdb, TDB_DATA key);
49
50 int tdb1_transaction_start(struct tdb_context *tdb);
51
52 int tdb1_transaction_prepare_commit(struct tdb_context *tdb);
53
54 int tdb1_transaction_commit(struct tdb_context *tdb);
55
56 int tdb1_get_seqnum(struct tdb_context *tdb);
57
58 void tdb1_increment_seqnum_nonblock(struct tdb_context *tdb);
59
60 uint64_t tdb1_incompatible_hash(const void *key, size_t len, uint64_t seed, void *);
61
62 int tdb1_check(struct tdb_context *tdb,
63               int (*check) (TDB_DATA key, TDB_DATA data, void *private_data),
64               void *private_data);
65
66 /* @} ******************************************************************/
67
68 /* wipe and repack */
69 int tdb1_wipe_all(struct tdb_context *tdb);
70 int tdb1_repack(struct tdb_context *tdb);
71
72 /* Debug functions. Not used in production. */
73 char *tdb1_summary(struct tdb_context *tdb);
74
75 extern TDB_DATA tdb1_null;
76
77 #endif /* tdb1.h */