Mark many merge tests as skip-against-old-server.
[svn.git] / subversion / libsvn_fs_base / bdb / strings-table.h
blob4f0767c4c57a65bf3709a8fe8d93ba490a617056
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
21 #define APU_WANT_DB
22 #include <apu_want.h>
24 #include "svn_io.h"
25 #include "svn_fs.h"
26 #include "../trail.h"
28 #ifdef __cplusplus
29 extern "C" {
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,
43 DB_ENV *env,
44 svn_boolean_t create);
47 /* Read *LEN bytes into BUF from OFFSET in string KEY in FS, as part
48 * of TRAIL.
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
60 * is returned.
62 svn_error_t *svn_fs_bdb__string_read(svn_fs_t *fs,
63 const char *key,
64 char *buf,
65 svn_filesize_t offset,
66 apr_size_t *len,
67 trail_t *trail,
68 apr_pool_t *pool);
71 /* Set *SIZE to the size in bytes of string KEY in FS, as part of
72 * TRAIL.
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,
77 svn_fs_t *fs,
78 const char *key,
79 trail_t *trail,
80 apr_pool_t *pool);
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,
95 const char **key,
96 apr_size_t len,
97 const char *buf,
98 trail_t *trail,
99 apr_pool_t *pool);
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,
106 const char *key,
107 trail_t *trail,
108 apr_pool_t *pool);
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,
119 const char *key,
120 trail_t *trail,
121 apr_pool_t *pool);
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,
129 const char *key,
130 trail_t *trail,
131 apr_pool_t *pool);
134 #ifdef __cplusplus
136 #endif /* __cplusplus */
138 #endif /* SVN_LIBSVN_FS_STRINGS_TABLE_H */