📄 svn_ra.h
字号:
/** * @copyright * ==================================================================== * 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/. * ==================================================================== * @endcopyright * * @file svn_ra.h * @brief Repository Access */#ifndef SVN_RA_H#define SVN_RA_H#include <apr_pools.h>#include <apr_tables.h>#include "svn_error.h"#include "svn_delta.h"#include "svn_auth.h"#ifdef __cplusplusextern "C" {#endif /* __cplusplus *//* Misc. declarations *//** * Get libsvn_ra version information. * * @since New in 1.1. */const svn_version_t *svn_ra_version(void);/** This is a function type which allows the RA layer to fetch working * copy (WC) properties. * * The @a baton is provided along with the function pointer and should * be passed back in. This will be the @a callback_baton or the * @a close_baton as appropriate. * * @a path is relative to the "root" of the session, defined by the * @a repos_url passed to the @c RA->open() vtable call. * * @a name is the name of the property to fetch. If the property is present, * then it is returned in @a value. Otherwise, @a *value is set to @c NULL. */typedef svn_error_t *(*svn_ra_get_wc_prop_func_t)(void *baton, const char *relpath, const char *name, const svn_string_t **value, apr_pool_t *pool);/** This is a function type which allows the RA layer to store new * working copy properties during update-like operations. See the * comments for @c svn_ra_get_wc_prop_func_t for @a baton, @a path, and * @a name. The @a value is the value that will be stored for the property; * a null @a value means the property will be deleted. */typedef svn_error_t *(*svn_ra_set_wc_prop_func_t)(void *baton, const char *path, const char *name, const svn_string_t *value, apr_pool_t *pool);/** This is a function type which allows the RA layer to store new * working copy properties as part of a commit. See the comments for * @c svn_ra_get_wc_prop_func_t for @a baton, @a path, and @a name. * The @a value is the value that will be stored for the property; a * @c NULL @a value means the property will be deleted. * * Note that this might not actually store the new property before * returning, but instead schedule it to be changed as part of * post-commit processing (in which case a successful commit means the * properties got written). Thus, during the commit, it is possible * to invoke this function to set a new value for a wc prop, then read * the wc prop back from the working copy and get the *old* value. * Callers beware. */typedef svn_error_t *(*svn_ra_push_wc_prop_func_t)(void *baton, const char *path, const char *name, const svn_string_t *value, apr_pool_t *pool);/** This is a function type which allows the RA layer to invalidate * (i.e., remove) wcprops. See the documentation for * @c svn_ra_get_wc_prop_func_t for @a baton, @a path, and @a name. * * Unlike @c svn_ra_push_wc_prop_func_t, this has immediate effect. If * it returns success, the wcprops have been removed. */typedef svn_error_t *(*svn_ra_invalidate_wc_props_func_t)(void *baton, const char *path, const char *name, apr_pool_t *pool);/** A function type for retrieving the youngest revision from a repos. */typedef svn_error_t *(*svn_ra_get_latest_revnum_func_t) (void *session_baton, svn_revnum_t *latest_revnum);/** * A callback function type for use in @c get_file_revs. * @a baton is provided by the caller, @a path is the pathname of the file * in revision @a rev and @a rev_props are the revision properties. * If @a delta_handler and @a delta_baton are non-NULL, they may be set to a * handler/baton which will be called with the delta between the previous * revision and this one after the return of this callback. They may be * left as NULL/NULL. * @a prop_diffs is an array of svn_prop_t elements indicating the property * delta for this and the previous revision. * @a pool may be used for temporary allocations, but you can't rely * on objects allocated to live outside of this particular call and the * immediately following calls to @a *delta_handler, if any. * * @since New in 1.1. */typedef svn_error_t *(*svn_ra_file_rev_handler_t) (void *baton, const char *path, svn_revnum_t rev, apr_hash_t *rev_props, svn_txdelta_window_handler_t *delta_handler, void **delta_baton, apr_array_header_t *prop_diffs, apr_pool_t *pool);/** * Callback function type for locking and unlocking actions. * * @since New in 1.2. * * @a do_lock is TRUE when locking @a path, and FALSE * otherwise. * * @a lock is a lock for @a path or null if @a do_lock is false or @a ra_err is * non-null. * * @a ra_err is NULL unless the ra layer encounters a locking related * error which it passes back for notification purposes. The caller * is responsible for clearing @a ra_err after the callback is run. * * @a baton is a closure object; it should be provided by the * implementation, and passed by the caller. @a pool may be used for * temporary allocation. */typedef svn_error_t *(*svn_ra_lock_callback_t)(void *baton, const char *path, svn_boolean_t do_lock, const svn_lock_t *lock, svn_error_t *ra_err, apr_pool_t *pool);/** * Callback function type for progress notification. * * @a progress is the number of bytes already transferred, @a total is * the total number of bytes to transfer or -1 if it's not known, @a * baton is the callback baton. * * @since New in 1.3. */typedef void (*svn_ra_progress_notify_func_t)(apr_off_t progress, apr_off_t total, void *baton, apr_pool_t *pool);/** * The update Reporter. * * A vtable structure which allows a working copy to describe a subset * (or possibly all) of its working-copy to an RA layer, for the * purposes of an update, switch, status, or diff operation. * * Paths for report calls are relative to the target (not the anchor) * of the operation. Report calls must be made in depth-first order: * parents before children, all children of a parent before any * siblings of the parent. The first report call must be a set_path * with a @a path argument of "" and a valid revision. (If the target * of the operation is locally deleted or missing, use the anchor's * revision.) If the target of the operation is deleted or switched * relative to the anchor, follow up the initial set_path call with a * link_path or delete_path call with a @a path argument of "" to * indicate that. In no other case may there be two report * descriptions for the same path. If the target of the operation is * a locally added file or directory (which previously did not exist), * it may be reported as having revision 0 or as having the parent * directory's revision. * * @since New in 1.2. */typedef struct svn_ra_reporter2_t{ /** Describe a working copy @a path as being at a particular @a revision. * * If @a start_empty is set and @a path is a directory, the * implementor should assume the directory has no entries or props. * * This will *override* any previous set_path() calls made on parent * paths. @a path is relative to the URL specified in @c RA->open(). * * If @a lock_token is non-NULL, it is the lock token for @a path in the WC. * * All temporary allocations are done in @a pool. */ svn_error_t *(*set_path)(void *report_baton, const char *path, svn_revnum_t revision, svn_boolean_t start_empty, const char *lock_token, apr_pool_t *pool); /** Describing a working copy @a path as missing. * * All temporary allocations are done in @a pool. */ svn_error_t *(*delete_path)(void *report_baton, const char *path, apr_pool_t *pool); /** Like set_path(), but differs in that @a path in the working copy * (relative to the root of the report driver) isn't a reflection of * @a path in the repository (relative to the URL specified when * opening the RA layer), but is instead a reflection of a different * repository @a url at @a revision. * * If @a start_empty is set and @a path is a directory, * the implementor should assume the directory has no entries or props. * * If @a lock_token is non-NULL, it is the lock token for @a path in the WC. * * All temporary allocations are done in @a pool. */ svn_error_t *(*link_path)(void *report_baton, const char *path, const char *url, svn_revnum_t revision, svn_boolean_t start_empty, const char *lock_token, apr_pool_t *pool); /** WC calls this when the state report is finished; any directories * or files not explicitly `set' are assumed to be at the * baseline revision originally passed into do_update(). No other * reporting functions, including abort_report, should be called after * calling this function. */ svn_error_t *(*finish_report)(void *report_baton, apr_pool_t *pool); /** If an error occurs during a report, this routine should cause the * filesystem transaction to be aborted & cleaned up. No other reporting * functions should be called after calling this function. */ svn_error_t *(*abort_report)(void *report_baton, apr_pool_t *pool);} svn_ra_reporter2_t;/** * Similar to @c svn_ra_reporter2_t, but without support for lock tokens. * * @deprecated Provided for backward compatibility with the 1.1 API. */typedef struct svn_ra_reporter_t{ /** Similar to the corresponding field in @c svn_ra_reporter2_t, but * with @a lock_token always set to NULL. */ svn_error_t *(*set_path)(void *report_baton, const char *path, svn_revnum_t revision, svn_boolean_t start_empty, apr_pool_t *pool); /** Same as the corresponding field in @c svn_ra_reporter2_t. */ svn_error_t *(*delete_path)(void *report_baton, const char *path, apr_pool_t *pool); /** Similar to the corresponding field in @c svn_ra_reporter2_t, but * with @a lock_token always set to NULL. */ svn_error_t *(*link_path)(void *report_baton, const char *path, const char *url, svn_revnum_t revision, svn_boolean_t start_empty, apr_pool_t *pool); /** Same as the corresponding field in @c svn_ra_reporter2_t. */ svn_error_t *(*finish_report)(void *report_baton, apr_pool_t *pool); /** Same as the corresponding field in @c svn_ra_reporter2_t. */ svn_error_t *(*abort_report)(void *report_baton, apr_pool_t *pool);} svn_ra_reporter_t;/** A collection of callbacks implemented by libsvn_client which allows * an RA layer to "pull" information from the client application, or * possibly store information. libsvn_client passes this vtable to
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -