Subversion
|
Locking/Opening/Closing using adm access batons. More...
Typedefs | |
typedef struct svn_wc_adm_access_t | svn_wc_adm_access_t |
Baton for access to a working copy administrative area. | |
Functions | |
svn_error_t * | svn_wc_adm_open3 (svn_wc_adm_access_t **adm_access, svn_wc_adm_access_t *associated, const char *path, svn_boolean_t write_lock, int levels_to_lock, svn_cancel_func_t cancel_func, void *cancel_baton, apr_pool_t *pool) |
Return, in *adm_access, a pointer to a new access baton for the working copy administrative area associated with the directory path. | |
svn_error_t * | svn_wc_adm_open2 (svn_wc_adm_access_t **adm_access, svn_wc_adm_access_t *associated, const char *path, svn_boolean_t write_lock, int levels_to_lock, apr_pool_t *pool) |
Similar to svn_wc_adm_open3(), but without cancellation support. | |
svn_error_t * | svn_wc_adm_open (svn_wc_adm_access_t **adm_access, svn_wc_adm_access_t *associated, const char *path, svn_boolean_t write_lock, svn_boolean_t tree_lock, apr_pool_t *pool) |
Similar to svn_wc_adm_open2(), but with tree_lock instead of levels_to_lock. | |
svn_error_t * | svn_wc_adm_probe_open3 (svn_wc_adm_access_t **adm_access, svn_wc_adm_access_t *associated, const char *path, svn_boolean_t write_lock, int levels_to_lock, svn_cancel_func_t cancel_func, void *cancel_baton, apr_pool_t *pool) |
Checks the working copy to determine the node type of path. | |
svn_error_t * | svn_wc_adm_probe_open2 (svn_wc_adm_access_t **adm_access, svn_wc_adm_access_t *associated, const char *path, svn_boolean_t write_lock, int levels_to_lock, apr_pool_t *pool) |
Similar to svn_wc_adm_probe_open3() without the cancel functionality. | |
svn_error_t * | svn_wc_adm_probe_open (svn_wc_adm_access_t **adm_access, svn_wc_adm_access_t *associated, const char *path, svn_boolean_t write_lock, svn_boolean_t tree_lock, apr_pool_t *pool) |
Similar to svn_wc_adm_probe_open2(), but with tree_lock instead of levels_to_lock. | |
svn_error_t * | svn_wc_adm_open_anchor (svn_wc_adm_access_t **anchor_access, svn_wc_adm_access_t **target_access, const char **target, const char *path, svn_boolean_t write_lock, int levels_to_lock, svn_cancel_func_t cancel_func, void *cancel_baton, apr_pool_t *pool) |
Open access batons for path and return in *anchor_access and *target the anchor and target required to drive an editor. | |
svn_error_t * | svn_wc_adm_retrieve (svn_wc_adm_access_t **adm_access, svn_wc_adm_access_t *associated, const char *path, apr_pool_t *pool) |
Return, in *adm_access, a pointer to an existing access baton associated with path. | |
svn_error_t * | svn_wc_adm_probe_retrieve (svn_wc_adm_access_t **adm_access, svn_wc_adm_access_t *associated, const char *path, apr_pool_t *pool) |
Check the working copy to determine the node type of path. | |
svn_error_t * | svn_wc_adm_probe_try3 (svn_wc_adm_access_t **adm_access, svn_wc_adm_access_t *associated, const char *path, svn_boolean_t write_lock, int levels_to_lock, svn_cancel_func_t cancel_func, void *cancel_baton, apr_pool_t *pool) |
Try various ways to obtain an access baton for path. | |
svn_error_t * | svn_wc_adm_probe_try2 (svn_wc_adm_access_t **adm_access, svn_wc_adm_access_t *associated, const char *path, svn_boolean_t write_lock, int levels_to_lock, apr_pool_t *pool) |
Similar to svn_wc_adm_probe_try3() without the cancel functionality. | |
svn_error_t * | svn_wc_adm_probe_try (svn_wc_adm_access_t **adm_access, svn_wc_adm_access_t *associated, const char *path, svn_boolean_t write_lock, svn_boolean_t tree_lock, apr_pool_t *pool) |
Similar to svn_wc_adm_probe_try2(), but with tree_lock instead of levels_to_lock. | |
svn_error_t * | svn_wc_adm_close2 (svn_wc_adm_access_t *adm_access, apr_pool_t *scratch_pool) |
Give up the access baton adm_access, and its lock if any. | |
svn_error_t * | svn_wc_adm_close (svn_wc_adm_access_t *adm_access) |
Similar to svn_wc_adm_close2(), but with the internal pool of adm_access used for temporary allocations. | |
const char * | svn_wc_adm_access_path (const svn_wc_adm_access_t *adm_access) |
Return the path used to open the access baton adm_access. | |
apr_pool_t * | svn_wc_adm_access_pool (const svn_wc_adm_access_t *adm_access) |
Return the pool used by access baton adm_access. | |
svn_boolean_t | svn_wc_adm_locked (const svn_wc_adm_access_t *adm_access) |
Return TRUE is the access baton adm_access has a write lock, FALSE otherwise. |
Locking/Opening/Closing using adm access batons.
typedef struct svn_wc_adm_access_t svn_wc_adm_access_t |
Baton for access to a working copy administrative area.
Access batons can be grouped into sets, by passing an existing open baton when opening a new baton. Given one baton in a set, other batons may be retrieved. This allows an entire hierarchy to be locked, and then the set of batons can be passed around by passing a single baton.
const char* svn_wc_adm_access_path | ( | const svn_wc_adm_access_t * | adm_access | ) |
Return the path used to open the access baton adm_access.
apr_pool_t* svn_wc_adm_access_pool | ( | const svn_wc_adm_access_t * | adm_access | ) |
Return the pool used by access baton adm_access.
svn_error_t* svn_wc_adm_close | ( | svn_wc_adm_access_t * | adm_access | ) |
Similar to svn_wc_adm_close2(), but with the internal pool of adm_access used for temporary allocations.
svn_error_t* svn_wc_adm_close2 | ( | svn_wc_adm_access_t * | adm_access, |
apr_pool_t * | scratch_pool | ||
) |
Give up the access baton adm_access, and its lock if any.
This will recursively close any batons in the same set that are direct subdirectories of adm_access. Any physical locks will be removed from the working copy. Lock removal is unconditional, there is no check to determine if cleanup is required.
Any temporary allocations are performed using scratch_pool.
svn_boolean_t svn_wc_adm_locked | ( | const svn_wc_adm_access_t * | adm_access | ) |
Return TRUE
is the access baton adm_access has a write lock, FALSE
otherwise.
Compared to svn_wc_locked() this is a cheap, fast function that doesn't access the filesystem.
svn_error_t* svn_wc_adm_open | ( | svn_wc_adm_access_t ** | adm_access, |
svn_wc_adm_access_t * | associated, | ||
const char * | path, | ||
svn_boolean_t | write_lock, | ||
svn_boolean_t | tree_lock, | ||
apr_pool_t * | pool | ||
) |
Similar to svn_wc_adm_open2(), but with tree_lock instead of levels_to_lock.
levels_to_lock is set to -1 if tree_lock is TRUE
, else 0.
svn_error_t* svn_wc_adm_open2 | ( | svn_wc_adm_access_t ** | adm_access, |
svn_wc_adm_access_t * | associated, | ||
const char * | path, | ||
svn_boolean_t | write_lock, | ||
int | levels_to_lock, | ||
apr_pool_t * | pool | ||
) |
Similar to svn_wc_adm_open3(), but without cancellation support.
svn_error_t* svn_wc_adm_open3 | ( | svn_wc_adm_access_t ** | adm_access, |
svn_wc_adm_access_t * | associated, | ||
const char * | path, | ||
svn_boolean_t | write_lock, | ||
int | levels_to_lock, | ||
svn_cancel_func_t | cancel_func, | ||
void * | cancel_baton, | ||
apr_pool_t * | pool | ||
) |
Return, in *adm_access, a pointer to a new access baton for the working copy administrative area associated with the directory path.
If write_lock is TRUE the baton will include a write lock, otherwise the baton can only be used for read access. If path refers to a directory that is already write locked then the error SVN_ERR_WC_LOCKED will be returned. The error SVN_ERR_WC_NOT_DIRECTORY will be returned if path is not a versioned directory.
If associated is an open access baton then adm_access will be added to the set containing associated. associated can be NULL
, in which case adm_access is the start of a new set.
levels_to_lock specifies how far to lock. Zero means just the specified directory. Any negative value means to lock the entire working copy directory hierarchy under path. A positive value indicates the number of levels of directories to lock -- 1 means just immediate subdirectories, 2 means immediate subdirectories and their subdirectories, etc. All the access batons will become part of the set containing adm_access. This is an all-or-nothing option, if it is not possible to lock all the requested directories then an error will be returned and adm_access will be invalid, with the exception that subdirectories of path that are missing from the physical filesystem will not be locked and will not cause an error. The error SVN_ERR_WC_LOCKED will be returned if a subdirectory of path is already write locked.
If cancel_func is non-NULL, call it with cancel_baton to determine if the client has canceled the operation.
pool will be used to allocate memory for the baton and any subsequently cached items. If adm_access has not been closed when the pool is cleared, it will be closed automatically at that point, and removed from its set. A baton closed in this way will not remove physical locks from the working copy if cleanup is required.
The first baton in a set, with associated passed as NULL
, must have the longest lifetime of all the batons in the set. This implies it must be the root of the hierarchy.
svn_error_t* svn_wc_adm_open_anchor | ( | svn_wc_adm_access_t ** | anchor_access, |
svn_wc_adm_access_t ** | target_access, | ||
const char ** | target, | ||
const char * | path, | ||
svn_boolean_t | write_lock, | ||
int | levels_to_lock, | ||
svn_cancel_func_t | cancel_func, | ||
void * | cancel_baton, | ||
apr_pool_t * | pool | ||
) |
Open access batons for path and return in *anchor_access and *target the anchor and target required to drive an editor.
Return in *target_access the access baton for the target, which may be the same as *anchor_access (in which case *target is the empty string, never NULL). All the access batons will be in the *anchor_access set.
levels_to_lock determines the levels_to_lock used when opening path if path is a versioned directory, levels_to_lock is ignored otherwise. If write_lock is TRUE
the access batons will hold write locks.
If cancel_func is non-NULL, call it with cancel_baton to determine if the client has canceled the operation.
This function is essentially a combination of svn_wc_adm_open3() and svn_wc_get_actual_target(), with the emphasis on reducing physical IO.
svn_error_t* svn_wc_adm_probe_open | ( | svn_wc_adm_access_t ** | adm_access, |
svn_wc_adm_access_t * | associated, | ||
const char * | path, | ||
svn_boolean_t | write_lock, | ||
svn_boolean_t | tree_lock, | ||
apr_pool_t * | pool | ||
) |
Similar to svn_wc_adm_probe_open2(), but with tree_lock instead of levels_to_lock.
levels_to_lock is set to -1 if tree_lock is TRUE
, else 0.
svn_error_t* svn_wc_adm_probe_open2 | ( | svn_wc_adm_access_t ** | adm_access, |
svn_wc_adm_access_t * | associated, | ||
const char * | path, | ||
svn_boolean_t | write_lock, | ||
int | levels_to_lock, | ||
apr_pool_t * | pool | ||
) |
Similar to svn_wc_adm_probe_open3() without the cancel functionality.
svn_error_t* svn_wc_adm_probe_open3 | ( | svn_wc_adm_access_t ** | adm_access, |
svn_wc_adm_access_t * | associated, | ||
const char * | path, | ||
svn_boolean_t | write_lock, | ||
int | levels_to_lock, | ||
svn_cancel_func_t | cancel_func, | ||
void * | cancel_baton, | ||
apr_pool_t * | pool | ||
) |
Checks the working copy to determine the node type of path.
If path is a versioned directory then the behaviour is like that of svn_wc_adm_open3(), otherwise, if path is a file or does not exist, then the behaviour is like that of svn_wc_adm_open3() with path replaced by the parent directory of path. If path is an unversioned directory, the behaviour is also like that of svn_wc_adm_open3() on the parent, except that if the open fails, then the returned SVN_ERR_WC_NOT_DIRECTORY error refers to path, not to path's parent.
svn_error_t* svn_wc_adm_probe_retrieve | ( | svn_wc_adm_access_t ** | adm_access, |
svn_wc_adm_access_t * | associated, | ||
const char * | path, | ||
apr_pool_t * | pool | ||
) |
Check the working copy to determine the node type of path.
If path is a versioned directory then the behaviour is like that of svn_wc_adm_retrieve(), otherwise, if path is a file, an unversioned directory, or does not exist, then the behaviour is like that of svn_wc_adm_retrieve() with path replaced by the parent directory of path.
svn_error_t* svn_wc_adm_probe_try | ( | svn_wc_adm_access_t ** | adm_access, |
svn_wc_adm_access_t * | associated, | ||
const char * | path, | ||
svn_boolean_t | write_lock, | ||
svn_boolean_t | tree_lock, | ||
apr_pool_t * | pool | ||
) |
Similar to svn_wc_adm_probe_try2(), but with tree_lock instead of levels_to_lock.
levels_to_lock is set to -1 if tree_lock is TRUE
, else 0.
svn_error_t* svn_wc_adm_probe_try2 | ( | svn_wc_adm_access_t ** | adm_access, |
svn_wc_adm_access_t * | associated, | ||
const char * | path, | ||
svn_boolean_t | write_lock, | ||
int | levels_to_lock, | ||
apr_pool_t * | pool | ||
) |
Similar to svn_wc_adm_probe_try3() without the cancel functionality.
svn_error_t* svn_wc_adm_probe_try3 | ( | svn_wc_adm_access_t ** | adm_access, |
svn_wc_adm_access_t * | associated, | ||
const char * | path, | ||
svn_boolean_t | write_lock, | ||
int | levels_to_lock, | ||
svn_cancel_func_t | cancel_func, | ||
void * | cancel_baton, | ||
apr_pool_t * | pool | ||
) |
Try various ways to obtain an access baton for path.
First, try to obtain *adm_access via svn_wc_adm_probe_retrieve(), but if this fails because associated can't give a baton for path or path's parent, then try svn_wc_adm_probe_open3(), this time passing write_lock and levels_to_lock. If there is still no access because path is not a versioned directory, then just set *adm_access to NULL and return success. But if it is because path is locked, then return the error SVN_ERR_WC_LOCKED, and the effect on *adm_access is undefined. (Or if the attempt fails for any other reason, return the corresponding error, and the effect on *adm_access is also undefined.)
If svn_wc_adm_probe_open3() succeeds, then add *adm_access to associated.
If cancel_func is non-NULL, call it with cancel_baton to determine if the client has canceled the operation.
Use pool only for local processing, not to allocate *adm_access.
svn_error_t* svn_wc_adm_retrieve | ( | svn_wc_adm_access_t ** | adm_access, |
svn_wc_adm_access_t * | associated, | ||
const char * | path, | ||
apr_pool_t * | pool | ||
) |
Return, in *adm_access, a pointer to an existing access baton associated with path.
path must be a directory that is locked as part of the set containing the associated access baton.
If the requested access baton is marked as missing in, or is simply absent from, associated, return SVN_ERR_WC_NOT_LOCKED.
pool is used only for local processing, it is not used for the batons.