]> git.ozlabs.org Git - ccan/blob - ccan/tdb2/tdb2.h
4f5be81950d069fa9dbe5bb8492f0086ed50f708
[ccan] / ccan / tdb2 / tdb2.h
1 #ifndef CCAN_TDB2_H
2 #define CCAN_TDB2_H
3
4 /*
5    TDB version 2: trivial database library
6
7    Copyright (C) Andrew Tridgell 1999-2004
8    Copyright (C) Rusty Russell 2010-2011
9
10      ** NOTE! The following LGPL license applies to the tdb
11      ** library. This does NOT imply that all of Samba is released
12      ** under the LGPL
13
14    This library is free software; you can redistribute it and/or
15    modify it under the terms of the GNU Lesser General Public
16    License as published by the Free Software Foundation; either
17    version 3 of the License, or (at your option) any later version.
18
19    This library is distributed in the hope that it will be useful,
20    but WITHOUT ANY WARRANTY; without even the implied warranty of
21    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22    Lesser General Public License for more details.
23
24    You should have received a copy of the GNU Lesser General Public
25    License along with this library; if not, see <http://www.gnu.org/licenses/>.
26 */
27
28 #ifdef  __cplusplus
29 extern "C" {
30 #endif
31
32 #ifndef _SAMBA_BUILD_
33 /* For mode_t */
34 #include <sys/types.h>
35 /* For O_* flags. */
36 #include <sys/stat.h>
37 /* For sig_atomic_t. */
38 #include <signal.h>
39 /* For uint64_t */
40 #include <stdint.h>
41 /* For bool */
42 #include <stdbool.h>
43 /* For memcmp */
44 #include <string.h>
45 #endif
46 #include <ccan/compiler/compiler.h>
47 #include <ccan/typesafe_cb/typesafe_cb.h>
48
49 union tdb_attribute;
50 struct tdb_context;
51
52 /**
53  * tdb_open - open a database file
54  * @name: the file name (can be NULL if flags contains TDB_INTERNAL)
55  * @tdb_flags: options for this database
56  * @open_flags: flags argument for tdb's open() call.
57  * @mode: mode argument for tdb's open() call.
58  * @attributes: linked list of extra attributes for this tdb.
59  *
60  * This call opens (and potentially creates) a database file.
61  * Multiple processes can have the TDB file open at once.
62  *
63  * On failure it will return NULL, and set errno: it may also call
64  * any log attribute found in @attributes.
65  *
66  * See also:
67  *      union tdb_attribute
68  */
69 struct tdb_context *tdb_open(const char *name, int tdb_flags,
70                              int open_flags, mode_t mode,
71                              union tdb_attribute *attributes);
72
73
74 /* flags for tdb_open() */
75 #define TDB_DEFAULT 0 /* just a readability place holder */
76 #define TDB_INTERNAL 2 /* don't store on disk */
77 #define TDB_NOLOCK   4 /* don't do any locking */
78 #define TDB_NOMMAP   8 /* don't use mmap */
79 #define TDB_CONVERT 16 /* convert endian */
80 #define TDB_NOSYNC   64 /* don't use synchronous transactions */
81 #define TDB_SEQNUM   128 /* maintain a sequence number */
82
83 /**
84  * tdb_close - close and free a tdb.
85  * @tdb: the tdb context returned from tdb_open()
86  *
87  * This always succeeds, in that @tdb is unusable after this call.  But if
88  * some unexpected error occurred while closing, it will return non-zero
89  * (the only clue as to cause will be via the log attribute).
90  */
91 int tdb_close(struct tdb_context *tdb);
92
93 /**
94  * struct tdb_data - representation of keys or values.
95  * @dptr: the data pointer
96  * @dsize: the size of the data pointed to by dptr.
97  *
98  * This is the "blob" representation of keys and data used by TDB.
99  */
100 typedef struct tdb_data {
101         unsigned char *dptr;
102         size_t dsize;
103 } TDB_DATA;
104
105 /**
106  * enum TDB_ERROR - error returns for TDB
107  *
108  * See Also:
109  *      tdb_errorstr()
110  */
111 enum TDB_ERROR {
112         TDB_SUCCESS     = 0,    /* No error. */
113         TDB_ERR_CORRUPT = -1,   /* We read the db, and it was bogus. */
114         TDB_ERR_IO      = -2,   /* We couldn't read/write the db. */
115         TDB_ERR_LOCK    = -3,   /* Locking failed. */
116         TDB_ERR_OOM     = -4,   /* Out of Memory. */
117         TDB_ERR_EXISTS  = -5,   /* The key already exists. */
118         TDB_ERR_NOEXIST = -6,   /* The key does not exist. */
119         TDB_ERR_EINVAL  = -7,   /* You're using it wrong. */
120         TDB_ERR_RDONLY  = -8,   /* The database is read-only. */
121         TDB_ERR_LAST = TDB_ERR_RDONLY
122 };
123
124 /**
125  * tdb_store - store a key/value pair in a tdb.
126  * @tdb: the tdb context returned from tdb_open()
127  * @key: the key
128  * @dbuf: the data to associate with the key.
129  * @flag: TDB_REPLACE, TDB_INSERT or TDB_MODIFY.
130  *
131  * This inserts (or overwrites) a key/value pair in the TDB.  If flag
132  * is TDB_REPLACE, it doesn't matter whether the key exists or not;
133  * TDB_INSERT means it must not exist (returns TDB_ERR_EXISTS otherwise),
134  * and TDB_MODIFY means it must exist (returns TDB_ERR_NOEXIST otherwise).
135  *
136  * On success, this returns TDB_SUCCESS.
137  *
138  * See also:
139  *      tdb_fetch, tdb_transaction_start, tdb_append, tdb_delete.
140  */
141 enum TDB_ERROR tdb_store(struct tdb_context *tdb,
142                          struct tdb_data key,
143                          struct tdb_data dbuf,
144                          int flag);
145
146 /* flags to tdb_store() */
147 #define TDB_REPLACE 1           /* A readability place holder */
148 #define TDB_INSERT 2            /* Don't overwrite an existing entry */
149 #define TDB_MODIFY 3            /* Don't create an existing entry    */
150
151 /**
152  * tdb_fetch - fetch a value from a tdb.
153  * @tdb: the tdb context returned from tdb_open()
154  * @key: the key
155  * @data: pointer to data.
156  *
157  * This looks up a key in the database and sets it in @data.
158  *
159  * If it returns TDB_SUCCESS, the key was found: it is your
160  * responsibility to call free() on @data->dptr.
161  *
162  * Otherwise, it returns an error (usually, TDB_ERR_NOEXIST) and @data is
163  * undefined.
164  */
165 enum TDB_ERROR tdb_fetch(struct tdb_context *tdb, struct tdb_data key,
166                          struct tdb_data *data);
167
168 /**
169  * tdb_errorstr - map the tdb error onto a constant readable string
170  * @ecode: the enum TDB_ERROR to map.
171  *
172  * This is useful for displaying errors to users.
173  */
174 const char *tdb_errorstr(enum TDB_ERROR ecode);
175
176 /**
177  * tdb_append - append a value to a key/value pair in a tdb.
178  * @tdb: the tdb context returned from tdb_open()
179  * @key: the key
180  * @dbuf: the data to append.
181  *
182  * This is equivalent to fetching a record, reallocating .dptr to add the
183  * data, and writing it back, only it's much more efficient.  If the key
184  * doesn't exist, it's equivalent to tdb_store (with an additional hint that
185  * you expect to expand the record in future).
186  *
187  * See Also:
188  *      tdb_fetch(), tdb_store()
189  */
190 enum TDB_ERROR tdb_append(struct tdb_context *tdb,
191                           struct tdb_data key, struct tdb_data dbuf);
192
193 /**
194  * tdb_delete - delete a key from a tdb.
195  * @tdb: the tdb context returned from tdb_open()
196  * @key: the key to delete.
197  *
198  * Returns TDB_SUCCESS on success, or an error (usually TDB_ERR_NOEXIST).
199  *
200  * See Also:
201  *      tdb_fetch(), tdb_store()
202  */
203 enum TDB_ERROR tdb_delete(struct tdb_context *tdb, struct tdb_data key);
204
205 /**
206  * tdb_exists - does a key exist in the database?
207  * @tdb: the tdb context returned from tdb_open()
208  * @key: the key to search for.
209  *
210  * Returns true if it exists, or false if it doesn't or any other error.
211  */
212 bool tdb_exists(struct tdb_context *tdb, TDB_DATA key);
213
214 /**
215  * tdb_deq - are struct tdb_data equal?
216  * @a: one struct tdb_data
217  * @b: another struct tdb_data
218  */
219 static inline bool tdb_deq(struct tdb_data a, struct tdb_data b)
220 {
221         return a.dsize == b.dsize && memcmp(a.dptr, b.dptr, a.dsize) == 0;
222 }
223
224 /**
225  * tdb_transaction_start - start a transaction
226  * @tdb: the tdb context returned from tdb_open()
227  *
228  * This begins a series of atomic operations.  Other processes will be able
229  * to read the tdb, but not alter it (they will block), nor will they see
230  * any changes until tdb_transaction_commit() is called.
231  *
232  * See Also:
233  *      tdb_transaction_cancel, tdb_transaction_commit.
234  */
235 enum TDB_ERROR tdb_transaction_start(struct tdb_context *tdb);
236
237 /**
238  * tdb_transaction_cancel - abandon a transaction
239  * @tdb: the tdb context returned from tdb_open()
240  *
241  * This aborts a transaction, discarding any changes which were made.
242  * tdb_close() does this implicitly.
243  */
244 void tdb_transaction_cancel(struct tdb_context *tdb);
245
246 /**
247  * tdb_transaction_commit - commit a transaction
248  * @tdb: the tdb context returned from tdb_open()
249  *
250  * This completes a transaction, writing any changes which were made.
251  *
252  * fsync() is used to commit the transaction (unless TDB_NOSYNC is set),
253  * making it robust against machine crashes, but very slow compared to
254  * other TDB operations.
255  *
256  * A failure can only be caused by unexpected errors (eg. I/O or
257  * memory); this is no point looping on transaction failure.
258  *
259  * See Also:
260  *      tdb_transaction_prepare_commit()
261  */
262 enum TDB_ERROR tdb_transaction_commit(struct tdb_context *tdb);
263
264 /**
265  * tdb_transaction_prepare_commit - prepare to commit a transaction
266  * @tdb: the tdb context returned from tdb_open()
267  *
268  * This ensures we have the resources to commit a transaction (using
269  * tdb_transaction_commit): if this succeeds then a transaction will only
270  * fail if the write() or fsync() calls fail.
271  *
272  * See Also:
273  *      tdb_transaction_commit()
274  */
275 enum TDB_ERROR tdb_transaction_prepare_commit(struct tdb_context *tdb);
276
277 /**
278  * tdb_traverse - traverse a TDB
279  * @tdb: the tdb context returned from tdb_open()
280  * @fn: the function to call for every key/value pair (or NULL)
281  * @p: the pointer to hand to @f
282  *
283  * This walks the TDB until all they keys have been traversed, or @fn
284  * returns non-zero.  If the traverse function or other processes are
285  * changing data or adding or deleting keys, the traverse may be
286  * unreliable: keys may be skipped or (rarely) visited twice.
287  *
288  * There is one specific exception: the special case of deleting the
289  * current key does not undermine the reliability of the traversal.
290  *
291  * On success, returns the number of keys iterated.  On error returns
292  * a negative enum TDB_ERROR value.
293  */
294 #define tdb_traverse(tdb, fn, p)                                        \
295         tdb_traverse_(tdb, typesafe_cb_preargs(int, (fn), (p),          \
296                                                struct tdb_context *,    \
297                                                TDB_DATA, TDB_DATA), (p))
298
299 int64_t tdb_traverse_(struct tdb_context *tdb,
300                       int (*fn)(struct tdb_context *,
301                                 TDB_DATA, TDB_DATA, void *), void *p);
302
303 /**
304  * tdb_parse_record - operate directly on data in the database.
305  * @tdb: the tdb context returned from tdb_open()
306  * @key: the key whose record we should hand to @parse
307  * @parse: the function to call for the data
308  * @p: the private pointer to hand to @parse (types must match).
309  *
310  * This avoids a copy for many cases, by handing you a pointer into
311  * the memory-mapped database.  It also locks the record to prevent
312  * other accesses at the same time.
313  *
314  * Do not alter the data handed to parse()!
315  */
316 #define tdb_parse_record(tdb, key, parse, p)                            \
317         tdb_parse_record_((tdb), (key),                                 \
318                           typesafe_cb_preargs(enum TDB_ERROR, (parse), (p), \
319                                               TDB_DATA, TDB_DATA), (p))
320
321 enum TDB_ERROR tdb_parse_record_(struct tdb_context *tdb,
322                                  TDB_DATA key,
323                                  enum TDB_ERROR (*parse)(TDB_DATA key,
324                                                          TDB_DATA data,
325                                                          void *p),
326                                  void *p);
327
328 /**
329  * tdb_get_seqnum - get a database sequence number
330  * @tdb: the tdb context returned from tdb_open()
331  *
332  * This returns a sequence number: any change to the database from a
333  * tdb context opened with the TDB_SEQNUM flag will cause that number
334  * to increment.  Note that the incrementing is unreliable (it is done
335  * without locking), so this is only useful as an optimization.
336  *
337  * For example, you may have a regular database backup routine which
338  * does not operate if the sequence number is unchanged.  In the
339  * unlikely event of a failed increment, it will be backed up next
340  * time any way.
341  *
342  * Returns an enum TDB_ERROR (ie. negative) on error.
343  */
344 int64_t tdb_get_seqnum(struct tdb_context *tdb);
345
346 /**
347  * tdb_firstkey - get the "first" key in a TDB
348  * @tdb: the tdb context returned from tdb_open()
349  * @key: pointer to key.
350  *
351  * This returns an arbitrary key in the database; with tdb_nextkey() it allows
352  * open-coded traversal of the database, though it is slightly less efficient
353  * than tdb_traverse.
354  *
355  * It is your responsibility to free @key->dptr on success.
356  *
357  * Returns TDB_ERR_NOEXIST if the database is empty.
358  */
359 enum TDB_ERROR tdb_firstkey(struct tdb_context *tdb, struct tdb_data *key);
360
361 /**
362  * tdb_nextkey - get the "next" key in a TDB
363  * @tdb: the tdb context returned from tdb_open()
364  * @key: a key returned by tdb_firstkey() or tdb_nextkey().
365  *
366  * This returns another key in the database; it will free @key.dptr for
367  * your convenience.
368  *
369  * Returns TDB_ERR_NOEXIST if there are no more keys.
370  */
371 enum TDB_ERROR tdb_nextkey(struct tdb_context *tdb, struct tdb_data *key);
372
373 /**
374  * tdb_chainlock - lock a record in the TDB
375  * @tdb: the tdb context returned from tdb_open()
376  * @key: the key to lock.
377  *
378  * This prevents any changes from occurring to a group of keys including @key,
379  * even if @key does not exist.  This allows primitive atomic updates of
380  * records without using transactions.
381  *
382  * You cannot begin a transaction while holding a tdb_chainlock(), nor can
383  * you do any operations on any other keys in the database.  This also means
384  * that you cannot hold more than one tdb_chainlock() at a time.
385  *
386  * See Also:
387  *      tdb_chainunlock()
388  */
389 enum TDB_ERROR tdb_chainlock(struct tdb_context *tdb, TDB_DATA key);
390
391 /**
392  * tdb_chainunlock - unlock a record in the TDB
393  * @tdb: the tdb context returned from tdb_open()
394  * @key: the key to unlock.
395  */
396 enum TDB_ERROR tdb_chainunlock(struct tdb_context *tdb, TDB_DATA key);
397
398 /**
399  * tdb_wipe_all - wipe the database clean
400  * @tdb: the tdb context returned from tdb_open()
401  *
402  * Completely erase the database.  This is faster than iterating through
403  * each key and doing tdb_delete.
404  */
405 enum TDB_ERROR tdb_wipe_all(struct tdb_context *tdb);
406
407 /**
408  * tdb_check - check a TDB for consistency
409  * @tdb: the tdb context returned from tdb_open()
410  * @check: function to check each key/data pair (or NULL)
411  * @private: argument for @check, must match type.
412  *
413  * This performs a consistency check of the open database, optionally calling
414  * a check() function on each record so you can do your own data consistency
415  * checks as well.  If check() returns an error, that is returned from
416  * tdb_check().
417  *
418  * Returns TDB_SUCCESS or an error.
419  */
420 #define tdb_check(tdb, check, private)                                  \
421         tdb_check_((tdb), typesafe_cb_preargs(enum TDB_ERROR,           \
422                                               (check), (private),       \
423                                               struct tdb_data,          \
424                                               struct tdb_data),         \
425                    (private))
426
427 enum TDB_ERROR tdb_check_(struct tdb_context *tdb,
428                           enum TDB_ERROR (*check)(struct tdb_data key,
429                                                   struct tdb_data data,
430                                                   void *private),
431                           void *private);
432
433 /**
434  * tdb_error - get the last error (not threadsafe)
435  * @tdb: the tdb context returned from tdb_open()
436  *
437  * Returns the last error returned by a TDB function.
438  *
439  * This makes porting from TDB1 easier, but note that the last error is not
440  * reliable in threaded programs.
441  */
442 enum TDB_ERROR tdb_error(struct tdb_context *tdb);
443
444 /**
445  * enum tdb_summary_flags - flags for tdb_summary.
446  */
447 enum tdb_summary_flags {
448         TDB_SUMMARY_HISTOGRAMS = 1 /* Draw graphs in the summary. */
449 };
450
451 /**
452  * tdb_summary - return a string describing the TDB state
453  * @tdb: the tdb context returned from tdb_open()
454  * @flags: flags to control the summary output.
455  * @summary: pointer to string to allocate.
456  *
457  * This returns a developer-readable string describing the overall
458  * state of the tdb, such as the percentage used and sizes of records.
459  * It is designed to provide information about the tdb at a glance
460  * without displaying any keys or data in the database.
461  *
462  * On success, sets @summary to point to a malloc()'ed nul-terminated
463  * multi-line string.  It is your responsibility to free() it.
464  */
465 enum TDB_ERROR tdb_summary(struct tdb_context *tdb,
466                            enum tdb_summary_flags flags,
467                            char **summary);
468
469  
470 /**
471  * tdb_get_flags - return the flags for a tdb
472  * @tdb: the tdb context returned from tdb_open()
473  *
474  * This returns the flags on the current tdb.  Some of these are caused by
475  * the flags argument to tdb_open(), others (such as TDB_CONVERT) are
476  * intuited.
477  */
478 unsigned int tdb_get_flags(struct tdb_context *tdb);
479
480 /**
481  * tdb_add_flag - set a flag for a tdb
482  * @tdb: the tdb context returned from tdb_open()
483  * @flag: one of TDB_NOLOCK, TDB_NOMMAP or TDB_NOSYNC.
484  *
485  * You can use this to set a flag on the TDB.  You cannot set these flags
486  * on a TDB_INTERNAL tdb.
487  */
488 void tdb_add_flag(struct tdb_context *tdb, unsigned flag);
489
490 /**
491  * tdb_remove_flag - unset a flag for a tdb
492  * @tdb: the tdb context returned from tdb_open()
493  * @flag: one of TDB_NOLOCK, TDB_NOMMAP or TDB_NOSYNC.
494  *
495  * You can use this to clear a flag on the TDB.  You cannot clear flags
496  * on a TDB_INTERNAL tdb.
497  */
498 void tdb_remove_flag(struct tdb_context *tdb, unsigned flag);
499
500 /**
501  * tdb_name - get the name of a tdb
502  * @tdb: the tdb context returned from tdb_open()
503  *
504  * This returns a copy of the name string, made at tdb_open() time.  If that
505  * argument was NULL (possible for a TDB_INTERNAL db) this will return NULL.
506  *
507  * This is mostly useful for logging.
508  */
509 const char *tdb_name(const struct tdb_context *tdb);
510
511 /**
512  * tdb_fd - get the file descriptor of a tdb
513  * @tdb: the tdb context returned from tdb_open()
514  *
515  * This returns the file descriptor for the underlying database file, or -1
516  * for TDB_INTERNAL.
517  */
518 int tdb_fd(const struct tdb_context *tdb);
519
520 /**
521  * enum tdb_attribute_type - descriminator for union tdb_attribute.
522  */
523 enum tdb_attribute_type {
524         TDB_ATTRIBUTE_LOG = 0,
525         TDB_ATTRIBUTE_HASH = 1,
526         TDB_ATTRIBUTE_SEED = 2,
527         TDB_ATTRIBUTE_STATS = 3
528 };
529
530 /**
531  * struct tdb_attribute_base - common fields for all tdb attributes.
532  */
533 struct tdb_attribute_base {
534         enum tdb_attribute_type attr;
535         union tdb_attribute *next;
536 };
537
538 /**
539  * enum tdb_log_level - log levels for tdb_attribute_log
540  * @TDB_LOG_ERROR: used to log unrecoverable errors such as I/O errors
541  *                 or internal consistency failures.
542  * @TDB_LOG_USE_ERROR: used to log usage errors such as invalid parameters
543  *                 or writing to a read-only database.
544  * @TDB_LOG_WARNING: used for informational messages on issues which
545  *                   are unusual but handled by TDB internally, such
546  *                   as a failure to mmap or failure to open /dev/urandom.
547  */
548 enum tdb_log_level {
549         TDB_LOG_ERROR,
550         TDB_LOG_USE_ERROR,
551         TDB_LOG_WARNING
552 };
553
554 /**
555  * struct tdb_attribute_log - log function attribute
556  *
557  * This attribute provides a hook for you to log errors.
558  */
559 struct tdb_attribute_log {
560         struct tdb_attribute_base base; /* .attr = TDB_ATTRIBUTE_LOG */
561         void (*log_fn)(struct tdb_context *tdb,
562                        enum tdb_log_level level,
563                        void *log_private,
564                        const char *message);
565         void *log_private;
566 };
567
568 /**
569  * struct tdb_attribute_hash - hash function attribute
570  *
571  * This attribute allows you to provide an alternative hash function.
572  * This hash function will be handed keys from the database; it will also
573  * be handed the 8-byte TDB_HASH_MAGIC value for checking the header (the
574  * tdb_open() will fail if the hash value doesn't match the header).
575  *
576  * Note that if your hash function gives different results on
577  * different machine endians, your tdb will no longer work across
578  * different architectures!
579  */
580 struct tdb_attribute_hash {
581         struct tdb_attribute_base base; /* .attr = TDB_ATTRIBUTE_HASH */
582         uint64_t (*hash_fn)(const void *key, size_t len, uint64_t seed,
583                             void *priv);
584         void *hash_private;
585 };
586
587 /**
588  * struct tdb_attribute_seed - hash function seed attribute
589  *
590  * The hash function seed is normally taken from /dev/urandom (or equivalent)
591  * but can be set manually here.  This is mainly for testing purposes.
592  */
593 struct tdb_attribute_seed {
594         struct tdb_attribute_base base; /* .attr = TDB_ATTRIBUTE_SEED */
595         uint64_t seed;
596 };
597
598 /**
599  * struct tdb_attribute_stats - tdb operational statistics
600  *
601  * This attribute records statistics of various low-level TDB operations.
602  * This can be used to assist performance evaluation.
603  *
604  * New fields will be added at the end, hence the "size" argument which
605  * indicates how large your structure is.  If your size is larger than
606  * that known about by this version of tdb, the size will be reduced to
607  * the known structure size.  Thus you can detect older versions, and
608  * thus know that newer stats will not be updated.
609  */
610 struct tdb_attribute_stats {
611         struct tdb_attribute_base base; /* .attr = TDB_ATTRIBUTE_STATS */
612         size_t size; /* = sizeof(struct tdb_attribute_stats) */
613         uint64_t allocs;
614         uint64_t   alloc_subhash;
615         uint64_t   alloc_chain;
616         uint64_t   alloc_bucket_exact;
617         uint64_t   alloc_bucket_max;
618         uint64_t   alloc_leftover;
619         uint64_t   alloc_coalesce_tried;
620         uint64_t     alloc_coalesce_lockfail;
621         uint64_t     alloc_coalesce_race;
622         uint64_t     alloc_coalesce_succeeded;
623         uint64_t        alloc_coalesce_num_merged;
624         uint64_t compares;
625         uint64_t   compare_wrong_bucket;
626         uint64_t   compare_wrong_offsetbits;
627         uint64_t   compare_wrong_keylen;
628         uint64_t   compare_wrong_rechash;
629         uint64_t   compare_wrong_keycmp;
630         uint64_t expands;
631         uint64_t frees;
632         uint64_t locks;
633         uint64_t    lock_lowlevel;
634         uint64_t    lock_nonblock;
635 };
636
637 /**
638  * union tdb_attribute - tdb attributes.
639  *
640  * This represents all the known attributes.
641  *
642  * See also:
643  *      struct tdb_attribute_log, struct tdb_attribute_hash,
644  *      struct tdb_attribute_seed, struct tdb_attribute_stats.
645  */
646 union tdb_attribute {
647         struct tdb_attribute_base base;
648         struct tdb_attribute_log log;
649         struct tdb_attribute_hash hash;
650         struct tdb_attribute_seed seed;
651         struct tdb_attribute_stats stats;
652 };
653
654 #ifdef  __cplusplus
655 }
656 #endif
657
658 #endif /* tdb2.h */