dag.h
来自「linux subdivision ying gai ke yi le ba」· C头文件 代码 · 共 497 行 · 第 1/2 页
H
497 行
/* dag.h : DAG-like interface filesystem, private to libsvn_fs
*
* ====================================================================
* Copyright (c) 2000-2004 CollabNet. All rights reserved.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://subversion.tigris.org/license-1.html.
* If newer versions of this license are posted there, you may use a
* newer version instead, at your option.
*
* This software consists of voluntary contributions made by many
* individuals. For exact contribution history, see the revision
* history and logs, available at http://subversion.tigris.org/.
* ====================================================================
*/
#ifndef SVN_LIBSVN_FS_DAG_H
#define SVN_LIBSVN_FS_DAG_H
#include "svn_fs.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* The interface in this file provides all the essential filesystem
operations, but exposes the filesystem's DAG structure. This makes
it simpler to implement than the public interface, since a client
of this interface has to understand and cope with shared structure
directly as it appears in the database. However, it's still a
self-consistent set of invariants to maintain, making it
(hopefully) a useful interface boundary.
In other words:
- The dag_node_t interface exposes the internal DAG structure of
the filesystem, while the svn_fs.h interface does any cloning
necessary to make the filesystem look like a tree.
- The dag_node_t interface exposes the existence of copy nodes,
whereas the svn_fs.h handles them transparently.
- dag_node_t's must be explicitly cloned, whereas the svn_fs.h
operations make clones implicitly.
- Callers of the dag_node_t interface use Berkeley DB transactions
to ensure consistency between operations, while callers of the
svn_fs.h interface use Subversion transactions. */
/* Initializing a filesystem. */
/* Given a filesystem FS, which contains all the necessary tables,
create the initial revision 0, and the initial root directory. */
svn_error_t *svn_fs_fs__dag_init_fs (svn_fs_t *fs);
/* Generic DAG node stuff. */
typedef struct dag_node_t dag_node_t;
/* Fill *NODE with a dag_node_t representing node revision ID in FS,
allocating in POOL. */
svn_error_t *
svn_fs_fs__dag_get_node (dag_node_t **node,
svn_fs_t *fs,
const svn_fs_id_t *id,
apr_pool_t *pool);
/* Return a new dag_node_t object referring to the same node as NODE,
allocated in POOL. If you're trying to build a structure in a
trail that wants to refer to dag nodes that may have been allocated
elsewhere, you can call this function, passing "trail->pool", and
avoid inter-pool pointers. */
dag_node_t *svn_fs_fs__dag_dup (dag_node_t *node,
apr_pool_t *pool);
/* Return the filesystem containing NODE. */
svn_fs_t *svn_fs_fs__dag_get_fs (dag_node_t *node);
/* Set *REV to NODE's revision number, allocating in POOL. If NODE
has never been committed as part of a revision, set *REV to
SVN_INVALID_REVNUM. */
svn_error_t *svn_fs_fs__dag_get_revision (svn_revnum_t *rev,
dag_node_t *node,
apr_pool_t *pool);
/* Return the node revision ID of NODE. The value returned is shared
with NODE, and will be deallocated when NODE is. */
const svn_fs_id_t *svn_fs_fs__dag_get_id (dag_node_t *node);
/* Return the created path of NODE. The value returned is shared
with NODE, and will be deallocated when NODE is. */
const char *svn_fs_fs__dag_get_created_path (dag_node_t *node);
/* Set *ID_P to the node revision ID of NODE's immediate predecessor,
or NULL if NODE has no predecessor, allocating from POOL. */
svn_error_t *svn_fs_fs__dag_get_predecessor_id (const svn_fs_id_t **id_p,
dag_node_t *node,
apr_pool_t *pool);
/* Set *COUNT to the number of predecessors NODE has (recursively), or
-1 if not known, allocating from POOL. */
svn_error_t *svn_fs_fs__dag_get_predecessor_count (int *count,
dag_node_t *node,
apr_pool_t *pool);
/* Callback function type for svn_fs_fs__dag_walk_predecessors() */
typedef svn_error_t *(*dag_pred_func_t) (void *baton,
dag_node_t *node,
svn_boolean_t *done,
apr_pool_t *pool);
/* Walk over NODE's predecessor list, calling CALLBACK (with its
associated BATON) for each predecessor until the callback returns
an error (in which case, return that error) or until it sets its
DONE flag. When the predecessor walk reaches a node with no
predecessor, it will call the CALLBACK one final time with a NULL
`node' argument to indicate that the predecessor walk is now
complete.
Do all allocations in POOL. */
svn_error_t *svn_fs_fs__dag_walk_predecessors (dag_node_t *node,
dag_pred_func_t callback,
void *baton,
apr_pool_t *pool);
/* Return non-zero IFF NODE is currently mutable under Subversion
transaction TXN_ID. */
svn_boolean_t svn_fs_fs__dag_check_mutable (dag_node_t *node,
const char *txn_id);
/* Return the node kind of NODE. */
svn_node_kind_t svn_fs_fs__dag_node_kind (dag_node_t *node);
/* Set *PROPLIST_P to a PROPLIST hash representing the entire property
list of NODE, allocating from POOL. The hash has const char *
names (the property names) and svn_string_t * values (the property
values).
If properties do not exist on NODE, *PROPLIST_P will be set to
NULL. */
svn_error_t *svn_fs_fs__dag_get_proplist (apr_hash_t **proplist_p,
dag_node_t *node,
apr_pool_t *pool);
/* Set the property list of NODE to PROPLIST, allocating from POOL.
The node being changed must be mutable. TXN_ID is the Subversion
transaction under which this occurs. */
svn_error_t *svn_fs_fs__dag_set_proplist (dag_node_t *node,
apr_hash_t *proplist,
const char *txn_id,
apr_pool_t *pool);
/* Revision and transaction roots. */
/* Open the root of revision REV of filesystem FS, allocating from
POOL. Set *NODE_P to the new node. */
svn_error_t *svn_fs_fs__dag_revision_root (dag_node_t **node_p,
svn_fs_t *fs,
svn_revnum_t rev,
apr_pool_t *pool);
/* Set *NODE_P to the root of transaction TXN_ID in FS, allocating
from POOL.
Note that the root node of TXN_ID is not necessarily mutable. If
no changes have been made in the transaction, then it may share its
root directory with its base revision. To get a mutable root node
for a transaction, call svn_fs_fs__dag_clone_root. */
svn_error_t *svn_fs_fs__dag_txn_root (dag_node_t **node_p,
svn_fs_t *fs,
const char *txn_id,
apr_pool_t *pool);
/* Set *NODE_P to the base root of transaction TXN_ID in FS,
allocating from POOL. Allocate the node in TRAIL->pool. */
svn_error_t *svn_fs_fs__dag_txn_base_root (dag_node_t **node_p,
svn_fs_t *fs,
const char *txn_id,
apr_pool_t *pool);
/* Clone the root directory of TXN_ID in FS, and update the
`transactions' table entry to point to it, unless this has been
done already. In either case, set *ROOT_P to a reference to the
root directory clone. Allocate *ROOT_P in POOL. */
svn_error_t *svn_fs_fs__dag_clone_root (dag_node_t **root_p,
svn_fs_t *fs,
const char *txn_id,
apr_pool_t *pool);
/* Directories. */
/* Open the node named NAME in the directory PARENT. Set *CHILD_P to
the new node, allocated in POOL. NAME must be a single path
component; it cannot be a slash-separated directory path. */
svn_error_t *svn_fs_fs__dag_open (dag_node_t **child_p,
dag_node_t *parent,
const char *name,
apr_pool_t *pool);
/* Set *ENTRIES_P to a hash table of NODE's entries. The keys of the
table are entry names, and the values are svn_fs_dirent_t's. Use
POOL for temporary allocations.
The returned table is *not* allocated in POOL, and becomes invalid
on the next call to this function or svn_fs_fs__rep_contents_dir.
If the caller needs the table to live longer, it should copy the
hash using svn_fs_fs__copy_dir_entries. */
svn_error_t *svn_fs_fs__dag_dir_entries (apr_hash_t **entries_p,
dag_node_t *node,
apr_pool_t *pool);
/* Set ENTRY_NAME in NODE to point to ID (with kind KIND), allocating
from POOL. 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_fs__dag_set_entry (dag_node_t *node,
const char *entry_name,
const svn_fs_id_t *id,
svn_node_kind_t kind,
const char *txn_id,
apr_pool_t *pool);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?