1 /* strings-table.h : internal interface to `strings' table
3 * ====================================================================
4 * Copyright (c) 2000-2004 CollabNet. All rights reserved.
6 * This software is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at http://subversion.tigris.org/license-1.html.
9 * If newer versions of this license are posted there, you may use a
10 * newer version instead, at your option.
12 * This software consists of voluntary contributions made by many
13 * individuals. For exact contribution history, see the revision
14 * history and logs, available at http://subversion.tigris.org/.
15 * ====================================================================
18 #ifndef SVN_LIBSVN_FS_STRINGS_TABLE_H
19 #define SVN_LIBSVN_FS_STRINGS_TABLE_H
30 #endif /* __cplusplus */
33 /* This interface provides raw access to the `strings' table. It does
34 not deal with deltification, undeltification, or skels. It just
35 reads and writes strings of bytes. */
38 /* Open a `strings' table in ENV. If CREATE is non-zero, create
39 * one if it doesn't exist. Set *STRINGS_P to the new table.
40 * Return a Berkeley DB error code.
42 int svn_fs_bdb__open_strings_table(DB
**strings_p
,
44 svn_boolean_t create
);
47 /* Read *LEN bytes into BUF from OFFSET in string KEY in FS, as part
50 * On return, *LEN is set to the number of bytes read. If this value
51 * is less than the number requested, the end of the string has been
52 * reached (no error is returned on end-of-string).
54 * If OFFSET is past the end of the string, then *LEN will be set to
55 * zero. Callers which are advancing OFFSET as they read portions of
56 * the string can terminate their loop when *LEN is returned as zero
57 * (which will occur when OFFSET == length(the string)).
59 * If string KEY does not exist, the error SVN_ERR_FS_NO_SUCH_STRING
62 svn_error_t
*svn_fs_bdb__string_read(svn_fs_t
*fs
,
65 svn_filesize_t offset
,
71 /* Set *SIZE to the size in bytes of string KEY in FS, as part of
74 * If string KEY does not exist, return SVN_ERR_FS_NO_SUCH_STRING.
76 svn_error_t
*svn_fs_bdb__string_size(svn_filesize_t
*size
,
83 /* Append LEN bytes from BUF to string *KEY in FS, as part of TRAIL.
85 * If *KEY is null, then create a new string and store the new key in
86 * *KEY (allocating it in POOL), and write LEN bytes from BUF
87 * as the initial contents of the string.
89 * If *KEY is not null but there is no string named *KEY, return
90 * SVN_ERR_FS_NO_SUCH_STRING.
92 * Note: to overwrite the old contents of a string, call
93 * svn_fs_bdb__string_clear() and then svn_fs_bdb__string_append(). */
94 svn_error_t
*svn_fs_bdb__string_append(svn_fs_t
*fs
,
102 /* Make string KEY in FS zero length, as part of TRAIL.
103 * If the string does not exist, return SVN_ERR_FS_NO_SUCH_STRING.
105 svn_error_t
*svn_fs_bdb__string_clear(svn_fs_t
*fs
,
111 /* Delete string KEY from FS, as part of TRAIL.
113 * If string KEY does not exist, return SVN_ERR_FS_NO_SUCH_STRING.
115 * WARNING: Deleting a string renders unusable any representations
116 * that refer to it. Be careful.
118 svn_error_t
*svn_fs_bdb__string_delete(svn_fs_t
*fs
,
124 /* Copy the contents of the string referred to by KEY in FS into a new
125 * record, returning the new record's key in *NEW_KEY. All
126 * allocations (including *NEW_KEY) occur in POOL. */
127 svn_error_t
*svn_fs_bdb__string_copy(svn_fs_t
*fs
,
128 const char **new_key
,
136 #endif /* __cplusplus */
138 #endif /* SVN_LIBSVN_FS_STRINGS_TABLE_H */