📄 dag.h
字号:
trail_t *trail);
/* Set ENTRY_NAME in NODE to point to ID, as part of TRAIL. NODE must
be a mutable directory. ID can refer to a mutable or immutable
node. If ENTRY_NAME does not exist, it will be created. TXN_ID is
the Subversion transaction under which this occurs.*/
svn_error_t *svn_fs_base__dag_set_entry (dag_node_t *node,
const char *entry_name,
const svn_fs_id_t *id,
const char *txn_id,
trail_t *trail);
/* Make a new mutable clone of the node named NAME in PARENT, and
adjust PARENT's directory entry to point to it, as part of TRAIL,
unless NAME in PARENT already refers to a mutable node. In either
case, set *CHILD_P to a reference to the new node, allocated in
TRAIL->pool. PARENT must be mutable. NAME must be a single path
component; it cannot be a slash-separated directory path.
PARENT_PATH must be the canonicalized absolute path of the parent
directory.
COPY_ID, if non-NULL, is a key into the `copies' table, and
indicates that this new node is being created as the result of a
copy operation, and specifically which operation that was.
PATH is the canonicalized absolute path at which this node is being
created.
TXN_ID is the Subversion transaction under which this occurs. */
svn_error_t *svn_fs_base__dag_clone_child (dag_node_t **child_p,
dag_node_t *parent,
const char *parent_path,
const char *name,
const char *copy_id,
const char *txn_id,
trail_t *trail);
/* Delete the directory entry named NAME from PARENT, as part of
TRAIL. PARENT must be mutable. NAME must be a single path
component; it cannot be a slash-separated directory path. If the
node being deleted is a mutable directory, remove all mutable nodes
reachable from it. TXN_ID is the Subversion transaction under
which this occurs.
If return SVN_ERR_FS_NO_SUCH_ENTRY, then there is no entry NAME in
PARENT. */
svn_error_t *svn_fs_base__dag_delete (dag_node_t *parent,
const char *name,
const char *txn_id,
trail_t *trail);
/* Delete the node revision assigned to node ID from FS's `nodes'
table, as part of TRAIL. Also delete any mutable representations
and strings associated with that node revision. ID may refer to a
file or directory, which must be mutable. TXN_ID is the Subversion
transaction under which this occurs.
NOTE: If ID represents a directory, and that directory has mutable
children, you risk orphaning those children by leaving them
dangling, disconnected from all DAG trees. It is assumed that
callers of this interface know what in the world they are doing. */
svn_error_t *svn_fs_base__dag_remove_node (svn_fs_t *fs,
const svn_fs_id_t *id,
const char *txn_id,
trail_t *trail);
/* Delete all mutable node revisions reachable from node ID, including
ID itself, from FS's `nodes' table, as part of TRAIL. Also delete
any mutable representations and strings associated with that node
revision. ID may refer to a file or directory, which may be
mutable or immutable. TXN_ID is the Subversion transaction under
which this occurs. */
svn_error_t *svn_fs_base__dag_delete_if_mutable (svn_fs_t *fs,
const svn_fs_id_t *id,
const char *txn_id,
trail_t *trail);
/* Create a new mutable directory named NAME in PARENT, as part of
TRAIL. Set *CHILD_P to a reference to the new node, allocated in
TRAIL->pool. The new directory has no contents, and no properties.
PARENT must be mutable. NAME must be a single path component; it
cannot be a slash-separated directory path. PARENT_PATH must be
the canonicalized absolute path of the parent directory. PARENT
must not currently have an entry named NAME. Do any temporary
allocation in TRAIL->pool. TXN_ID is the Subversion transaction
under which this occurs. */
svn_error_t *svn_fs_base__dag_make_dir (dag_node_t **child_p,
dag_node_t *parent,
const char *parent_path,
const char *name,
const char *txn_id,
trail_t *trail);
/* Files. */
/* Set *CONTENTS to a readable generic stream which yields the
contents of FILE, as part of TRAIL. Allocate the stream in POOL,
which may or may not be TRAIL->pool.
If FILE is not a file, return SVN_ERR_FS_NOT_FILE. */
svn_error_t *svn_fs_base__dag_get_contents (svn_stream_t **contents,
dag_node_t *file,
apr_pool_t *pool,
trail_t *trail);
/* Return a generic writable stream in *CONTENTS with which to set the
contents of FILE as part of TRAIL. Allocate the stream in POOL,
which may or may not be TRAIL->pool. TXN_ID is the Subversion
transaction under which this occurs.
Any previous edits on the file will be deleted, and a new edit
stream will be constructed. */
svn_error_t *svn_fs_base__dag_get_edit_stream (svn_stream_t **contents,
dag_node_t *file,
apr_pool_t *pool,
const char *txn_id,
trail_t *trail);
/* Signify the completion of edits to FILE made using the stream
returned by svn_fs_base__dag_get_edit_stream, as part of TRAIL. TXN_ID
is the Subversion transaction under which this occurs.
If CHECKSUM is non-null, it must match the checksum for FILE's
contents (note: this is not recalculated, the recorded checksum is
used), else the error SVN_ERR_CHECKSUM_MISMATCH is returned.
This operation is a no-op if no edits are present. */
svn_error_t *svn_fs_base__dag_finalize_edits (dag_node_t *file,
const char *checksum,
const char *txn_id,
trail_t *trail);
/* Set *LENGTH to the length of the contents of FILE, as part of TRAIL. */
svn_error_t *svn_fs_base__dag_file_length (svn_filesize_t *length,
dag_node_t *file,
trail_t *trail);
/* Put the recorded MD5 checksum of FILE into DIGEST, as part of
* TRAIL. DIGEST must point to APR_MD5_DIGESTSIZE bytes of storage.
*
* If no stored checksum is available, do not calculate the checksum,
* just put all 0's into DIGEST.
*/
svn_error_t *
svn_fs_base__dag_file_checksum (unsigned char digest[],
dag_node_t *file,
trail_t *trail);
/* Create a new mutable file named NAME in PARENT, as part of TRAIL.
Set *CHILD_P to a reference to the new node, allocated in
TRAIL->pool. The new file's contents are the empty string, and it
has no properties. PARENT must be mutable. NAME must be a single
path component; it cannot be a slash-separated directory path.
PARENT_PATH must be the canonicalized absolute path of the parent
directory. TXN_ID is the Subversion transaction under which this
occurs. */
svn_error_t *svn_fs_base__dag_make_file (dag_node_t **child_p,
dag_node_t *parent,
const char *parent_path,
const char *name,
const char *txn_id,
trail_t *trail);
/* Copies */
/* Make ENTRY in TO_NODE be a copy of FROM_NODE, as part of TRAIL.
TO_NODE must be mutable. TXN_ID is the Subversion transaction
under which this occurs.
If PRESERVE_HISTORY is true, the new node will record that it was
copied from FROM_PATH in FROM_REV; therefore, FROM_NODE should be
the node found at FROM_PATH in FROM_REV, although this is not
checked.
If PRESERVE_HISTORY is false, FROM_PATH and FROM_REV are ignored. */
svn_error_t *svn_fs_base__dag_copy (dag_node_t *to_node,
const char *entry,
dag_node_t *from_node,
svn_boolean_t preserve_history,
svn_revnum_t from_rev,
const char *from_path,
const char *txn_id,
trail_t *trail);
/* Deltification */
/* Change TARGET's representation to be a delta against SOURCE, as
part of TRAIL. If TARGET or SOURCE does not exist, do nothing and
return success. If PROPS_ONLY is non-zero, only the node property
portion of TARGET will be deltified.
WARNING WARNING WARNING: Do *NOT* call this with a mutable SOURCE
node. Things will go *very* sour if you deltify TARGET against a
node that might just disappear from the filesystem in the (near)
future. */
svn_error_t *svn_fs_base__dag_deltify (dag_node_t *target,
dag_node_t *source,
svn_boolean_t props_only,
trail_t *trail);
/* Comparison */
/* Find out what is the same between two nodes.
If PROPS_CHANGED is non-null, set *PROPS_CHANGED to 1 if the two
nodes have different property lists, or to 0 if same.
If CONTENTS_CHANGED is non-null, set *CONTENTS_CHANGED to 1 if the
two nodes have different contents, or to 0 if same. For files,
file contents are compared; for directories, the entries lists are
compared. If one is a file and the other is a directory, the one's
contents will be compared to the other's entries list. (Not
terribly useful, I suppose, but that's the caller's business.)
### todo: This function only compares rep keys at the moment. This
may leave us with a slight chance of a false positive, though I
don't really see how that would happen in practice. Nevertheless,
it should probably be fixed. */
svn_error_t *svn_fs_base__things_different (svn_boolean_t *props_changed,
svn_boolean_t *contents_changed,
dag_node_t *node1,
dag_node_t *node2,
trail_t *trail);
/* Set *IS_ANCESTOR to non-zero IFF NODE1 is an ancestor of NODE2.
Perform this test under TRAIL. */
svn_error_t *svn_fs_base__dag_is_ancestor (svn_boolean_t *is_ancestor,
dag_node_t *node1,
dag_node_t *node2,
trail_t *trail);
/* Set *IS_PARENT to non-zero IFF NODE1 is the parent of NODE2.
Perform this test under TRAIL. */
svn_error_t *svn_fs_base__dag_is_parent (svn_boolean_t *is_ancestor,
dag_node_t *node1,
dag_node_t *node2,
trail_t *trail);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_LIBSVN_FS_DAG_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -