1
/* reps-strings.h : interpreting representations with respect to strings
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_REPS_STRINGS_H
19
#define SVN_LIBSVN_FS_REPS_STRINGS_H
32
#endif /* __cplusplus */
36
/* Get or create a mutable representation in FS, store the new rep's
39
TXN_ID is the id of the Subversion transaction under which this occurs.
41
If REP_KEY is already a mutable representation, set *NEW_REP_KEY to
42
REP_KEY, else set *NEW_REP_KEY to a brand new rep key allocated in
44
svn_error_t *svn_fs_base__get_mutable_rep (const char **new_rep_key,
52
/* Delete REP_KEY from FS if REP_KEY is mutable, as part of trail, or
53
do nothing if REP_KEY is immutable. If a mutable rep is deleted,
54
the string it refers to is deleted as well. TXN_ID is the id of
55
the Subversion transaction under which this occurs.
57
If no such rep, return SVN_ERR_FS_NO_SUCH_REPRESENTATION. */
58
svn_error_t *svn_fs_base__delete_rep_if_mutable (svn_fs_t *fs,
67
/*** Reading and writing rep contents. ***/
69
/* Set *SIZE_P to the size of REP_KEY's contents in FS, as part of TRAIL.
70
Note: this is the fulltext size, no matter how the contents are
71
represented in storage. */
72
svn_error_t *svn_fs_base__rep_contents_size (svn_filesize_t *size_p,
79
/* Put into DIGEST the MD5 checksum for REP_KEY in FS, as part of TRAIL.
80
This is the prerecorded checksum for the rep's contents' fulltext.
81
If no checksum is available, do not calculate one dynamically, just
82
put all 0's into DIGEST. (By convention, the all-zero checksum is
83
considered to match any checksum.) */
84
svn_error_t *svn_fs_base__rep_contents_checksum (unsigned char digest[],
91
/* Set STR->data to the contents of REP_KEY in FS, and STR->len to the
92
contents' length, as part of TRAIL. The data is allocated in
93
POOL. If an error occurs, the effect on STR->data and
94
STR->len is undefined.
96
Note: this is the fulltext contents, no matter how the contents are
97
represented in storage. */
98
svn_error_t *svn_fs_base__rep_contents (svn_string_t *str,
105
/* Set *RS_P to a stream to read the contents of REP_KEY in FS.
106
Allocate the stream in POOL.
108
REP_KEY may be null, in which case reads just return 0 bytes.
110
If USE_TRAIL_FOR_READS is TRUE, the stream's reads are part
111
of TRAIL; otherwise, each read happens in an internal, one-off
112
trail (though TRAIL is still required). POOL may be TRAIL->pool. */
114
svn_fs_base__rep_contents_read_stream (svn_stream_t **rs_p,
117
svn_boolean_t use_trail_for_reads,
122
/* Set *WS_P to a stream to write the contents of REP_KEY. Allocate
123
the stream in POOL. TXN_ID is the id of the Subversion transaction
124
under which this occurs.
126
If USE_TRAIL_FOR_WRITES is TRUE, the stream's writes are part
127
of TRAIL; otherwise, each write happens in an internal, one-off
128
trail (though TRAIL is still required). POOL may be TRAIL->pool.
130
If REP_KEY is not mutable, writes to *WS_P will return the
131
error SVN_ERR_FS_REP_NOT_MUTABLE. */
133
svn_fs_base__rep_contents_write_stream (svn_stream_t **ws_p,
137
svn_boolean_t use_trail_for_writes,
143
/*** Deltified storage. ***/
145
/* Offer TARGET the chance to store its contents as a delta against
146
SOURCE, in FS, as part of TRAIL. TARGET and SOURCE are both
149
This usually results in TARGET's data being stored as a diff
150
against SOURCE; but it might not, if it turns out to be more
151
efficient to store the contents some other way. */
152
svn_error_t *svn_fs_base__rep_deltify (svn_fs_t *fs,
159
/* Ensure that REP_KEY refers to storage that is maintained as fulltext,
160
not as a delta against other strings, in FS, as part of TRAIL. */
161
svn_error_t *svn_fs_base__rep_undeltify (svn_fs_t *fs,
170
#endif /* __cplusplus */
172
#endif /* SVN_LIBSVN_FS_REPS_STRINGS_H */