2 * Sherlock Library -- Object Buckets
4 * (c) 2001 Martin Mares <mj@ucw.cz>
8 * Format: The object pool is merely a sequence of object buckets.
9 * Each bucket starts with struct obuck_header and it's padded
10 * by zeros to a multiple of OBUCK_ALIGN bytes.
12 * Locking: Each operation on the pool is protected by a flock.
14 * The buckets emulate non-seekable fastbuf streams.
18 #define OBUCK_ALIGN (1<<OBUCK_SHIFT)
19 #define OBUCK_MAGIC 0xdeadf00d
20 #define OBUCK_TRAILER 0xfeedcafe
21 #define OBUCK_OID_DELETED (~(oid_t)0)
24 u32 magic; /* OBUCK_MAGIC should dwell here */
25 oid_t oid; /* ID of this object or OBUCK_OID_DELETED */
26 u32 length; /* Length of compressed data in the bucket */
27 u32 orig_length; /* Length of uncompressed data */
28 /* Bucket data continue here */
33 void obuck_init(int writeable);
34 void obuck_cleanup(void);
35 struct fastbuf * obuck_fetch(struct obuck_header *hdrp);
36 void obuck_fetch_abort(struct fastbuf *b);
37 void obuck_fetch_end(struct fastbuf *b);
38 struct fastbuf * obuck_write(void);
39 void obuck_write_end(struct fastbuf *b, struct obuck_header *hdrp);
40 void obuck_delete(oid_t oid);
41 struct fastbuf * obuck_walk_init(void);
42 struct fastbuf * obuck_walk_next(struct fastbuf *b, struct obuck_header *hdrp);
43 void obuck_walk_end(struct fastbuf *b);