1 /* strings-table.h : internal interface to `strings' table
3 * ====================================================================
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
20 * ====================================================================
23 #ifndef SVN_LIBSVN_FS_STRINGS_TABLE_H
24 #define SVN_LIBSVN_FS_STRINGS_TABLE_H
27 #include "svn_private_config.h"
35 #endif /* __cplusplus */
38 /* This interface provides raw access to the `strings' table. It does
39 not deal with deltification, undeltification, or skels. It just
40 reads and writes strings of bytes. */
43 /* Open a `strings' table in ENV. If CREATE is non-zero, create
44 * one if it doesn't exist. Set *STRINGS_P to the new table.
45 * Return a Berkeley DB error code.
47 int svn_fs_bdb__open_strings_table(DB **strings_p,
49 svn_boolean_t create);
52 /* Read *LEN bytes into BUF from OFFSET in string KEY in FS, as part
55 * On return, *LEN is set to the number of bytes read. If this value
56 * is less than the number requested, the end of the string has been
57 * reached (no error is returned on end-of-string).
59 * If OFFSET is past the end of the string, then *LEN will be set to
60 * zero. Callers which are advancing OFFSET as they read portions of
61 * the string can terminate their loop when *LEN is returned as zero
62 * (which will occur when OFFSET == length(the string)).
64 * If string KEY does not exist, the error SVN_ERR_FS_NO_SUCH_STRING
67 svn_error_t *svn_fs_bdb__string_read(svn_fs_t *fs,
70 svn_filesize_t offset,
76 /* Set *SIZE to the size in bytes of string KEY in FS, as part of
79 * If string KEY does not exist, return SVN_ERR_FS_NO_SUCH_STRING.
81 svn_error_t *svn_fs_bdb__string_size(svn_filesize_t *size,
88 /* Append LEN bytes from BUF to string *KEY in FS, as part of TRAIL.
90 * If *KEY is null, then create a new string and store the new key in
91 * *KEY (allocating it in POOL), and write LEN bytes from BUF
92 * as the initial contents of the string.
94 * If *KEY is not null but there is no string named *KEY, return
95 * SVN_ERR_FS_NO_SUCH_STRING.
97 * Note: to overwrite the old contents of a string, call
98 * svn_fs_bdb__string_clear() and then svn_fs_bdb__string_append(). */
99 svn_error_t *svn_fs_bdb__string_append(svn_fs_t *fs,
107 /* Make string KEY in FS zero length, as part of TRAIL.
108 * If the string does not exist, return SVN_ERR_FS_NO_SUCH_STRING.
110 svn_error_t *svn_fs_bdb__string_clear(svn_fs_t *fs,
116 /* Delete string KEY from FS, as part of TRAIL.
118 * If string KEY does not exist, return SVN_ERR_FS_NO_SUCH_STRING.
120 * WARNING: Deleting a string renders unusable any representations
121 * that refer to it. Be careful.
123 svn_error_t *svn_fs_bdb__string_delete(svn_fs_t *fs,
129 /* Copy the contents of the string referred to by KEY in FS into a new
130 * record, returning the new record's key in *NEW_KEY. All
131 * allocations (including *NEW_KEY) occur in POOL. */
132 svn_error_t *svn_fs_bdb__string_copy(svn_fs_t *fs,
133 const char **new_key,
141 #endif /* __cplusplus */
143 #endif /* SVN_LIBSVN_FS_STRINGS_TABLE_H */