You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2010/06/01 17:17:16 UTC
svn commit: r950109 - in /subversion/trunk/subversion: include/svn_repos.h
libsvn_repos/deprecated.c libsvn_repos/fs-wrap.c
Author: hwright
Date: Tue Jun 1 15:17:16 2010
New Revision: 950109
URL: http://svn.apache.org/viewvc?rev=950109&view=rev
Log:
Rev the repos packing API to use the repos-wide notification system.
* subversion/include/svn_repos.h
(svn_repos_notify_action_t, svn_repos_notify_t, svn_repos_notify_func_t,
svn_repos_notify_create): Shuffle definition up in the file.
(svn_repos_fs_pack2): New.
(svn_repos_fs_pack): Deprecate.
* subversion/libsvn_repos/deprecated.c
(pack_notify_wrapper_baton, pack_notify_wrapper_func): New.
(svn_repos_fs_pack): Move here, as a wrapper around the new repos API.
* subversion/libsvn_repos/fs-wrap.c
(pack_notify_baton, pack_notify_func): New.
(svn_repos_fs_pack): Remove.
(svn_repos_fs_pack2): New.
Modified:
subversion/trunk/subversion/include/svn_repos.h
subversion/trunk/subversion/libsvn_repos/deprecated.c
subversion/trunk/subversion/libsvn_repos/fs-wrap.c
Modified: subversion/trunk/subversion/include/svn_repos.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_repos.h?rev=950109&r1=950108&r2=950109&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_repos.h (original)
+++ subversion/trunk/subversion/include/svn_repos.h Tue Jun 1 15:17:16 2010
@@ -164,6 +164,79 @@ typedef svn_error_t *(*svn_repos_file_re
apr_pool_t *pool);
+/* Notification system. */
+
+/** The type of action occuring.
+ *
+ * @since New in 1.7.
+ */
+typedef enum svn_repos_notify_action_t
+{
+ /** A warning message is waiting. */
+ svn_repos_notify_warning = 0,
+
+ /** A revision has finished being dumped. */
+ svn_repos_notify_dump_rev_end,
+
+ /** A revision has finished being verified. */
+ svn_repos_notify_verify_rev_end,
+
+ svn_repos_notify_pack_shard_start,
+
+ svn_repos_notify_pack_shard_end
+} svn_repos_notify_action_t;
+
+/**
+ * Structure used by #svn_repos_notify_func_t.
+ *
+ * The only field guaranteed to be populated is @c action. Other fields are
+ * dependent upon the @c action. (See individual fields for more information.)
+ *
+ * @note Callers of notification functions should use
+ * svn_repos_notify_create() to create structures of this type to allow for
+ * future extensibility.
+ *
+ * @since New in 1.7.
+ */
+typedef struct svn_repos_notify_t
+{
+ /** Action that describes what happened in the repository. */
+ svn_repos_notify_action_t action;
+
+ /** For #svn_repos_notify_dump_rev_end and #svn_repos_notify_verify_rev_end,
+ * the revision which just completed. */
+ svn_revnum_t revision;
+
+ /** For #svn_repos_notify_warning, the warning text. */
+ const char *warning;
+
+ apr_int64_t shard;
+
+ /* NOTE: Add new fields at the end to preserve binary compatibility.
+ Also, if you add fields here, you have to update
+ svn_repos_notify_create(). */
+} svn_repos_notify_t;
+
+/** Callback for providing notification from the repository.
+ * Returns @a void. Justification: success of an operation is not dependent
+ * upon successful notification of that operation.
+ *
+ * @since New in 1.7. */
+typedef void (*svn_repos_notify_func_t)(void *baton,
+ const svn_repos_notify_t *notify,
+ apr_pool_t *scratch_pool);
+
+/**
+ * Allocate an #svn_repos_notify_t structure in @a result_pool, initialize
+ * and return it.
+ *
+ * @since New in 1.7.
+ */
+svn_repos_notify_t *
+svn_repos_notify_create(svn_repos_notify_action_t action,
+ apr_pool_t *result_pool);
+
+
/** The repository object. */
typedef struct svn_repos_t svn_repos_t;
@@ -320,8 +393,24 @@ svn_repos_hotcopy(const char *src_path,
* Possibly update the repository, @a repos, to use a more efficient
* filesystem representation. Use @a pool for allocations.
*
+ * @since New in 1.7.
+ */
+svn_error_t *
+svn_repos_fs_pack2(svn_repos_t *repos,
+ svn_repos_notify_func_t notify_func,
+ void *notify_baton,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *pool);
+
+/**
+ * Similar to svn_repos_fs_pack2(), but with a #svn_fs_pack_notify_t instead
+ * of a #svn_repos_notify_t.
+ *
* @since New in 1.6.
+ * @deprecated Provided for backward compatibility with the 1.6 API.
*/
+SVN_DEPRECATED
svn_error_t *
svn_repos_fs_pack(svn_repos_t *repos,
svn_fs_pack_notify_t notify_func,
@@ -330,7 +419,6 @@ svn_repos_fs_pack(svn_repos_t *repos,
void *cancel_baton,
apr_pool_t *pool);
-
/**
* Run database recovery procedures on the repository at @a path,
* returning the database to a consistent state. Use @a pool for all
@@ -2115,71 +2203,6 @@ enum svn_repos_load_uuid
svn_repos_load_uuid_force
};
-/** The type of action occuring.
- *
- * @since New in 1.7.
- */
-typedef enum svn_repos_notify_action_t
-{
- /** A warning message is waiting. */
- svn_repos_notify_warning = 0,
-
- /** A revision has finished being dumped. */
- svn_repos_notify_dump_rev_end,
-
- /** A revision has finished being verified. */
- svn_repos_notify_verify_rev_end,
-} svn_repos_notify_action_t;
-
-/**
- * Structure used by #svn_repos_notify_func_t.
- *
- * The only field guaranteed to be populated is @c action. Other fields are
- * dependent upon the @c action. (See individual fields for more information.)
- *
- * @note Callers of notification functions should use
- * svn_repos_notify_create() to create structures of this type to allow for
- * future extensibility.
- *
- * @since New in 1.7.
- */
-typedef struct svn_repos_notify_t
-{
- /** Action that describes what happened in the repository. */
- svn_repos_notify_action_t action;
-
- /** For #svn_repos_notify_dump_rev_end and #svn_repos_notify_verify_rev_end,
- * the revision which just completed. */
- svn_revnum_t revision;
-
- /** For #svn_repos_notify_warning, the warning text. */
- const char *warning;
-
- /* NOTE: Add new fields at the end to preserve binary compatibility.
- Also, if you add fields here, you have to update
- svn_repos_notify_create(). */
-} svn_repos_notify_t;
-
-/** Callback for providing notification from the repository.
- * Returns @a void. Justification: success of an operation is not dependent
- * upon successful notification of that operation.
- *
- * @since New in 1.7. */
-typedef void (*svn_repos_notify_func_t)(void *baton,
- const svn_repos_notify_t *notify,
- apr_pool_t *scratch_pool);
-
-/**
- * Allocate an #svn_repos_notify_t structure in @a result_pool, initialize
- * and return it.
- *
- * @since New in 1.7.
- */
-svn_repos_notify_t *
-svn_repos_notify_create(svn_repos_notify_action_t action,
- apr_pool_t *result_pool);
-
-
/**
* Verify the contents of the file system in @a repos.
*
Modified: subversion/trunk/subversion/libsvn_repos/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/deprecated.c?rev=950109&r1=950108&r2=950109&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_repos/deprecated.c Tue Jun 1 15:17:16 2010
@@ -306,6 +306,40 @@ svn_repos_fs_change_rev_prop(svn_repos_t
NULL, NULL, pool);
}
+struct pack_notify_wrapper_baton
+{
+ svn_fs_pack_notify_t notify_func;
+ void *notify_baton;
+};
+
+static void
+pack_notify_wrapper_func(void *baton,
+ const svn_repos_notify_t *notify,
+ apr_pool_t *scratch_pool)
+{
+ struct pack_notify_wrapper_baton *pnwb = baton;
+
+ svn_error_clear(pnwb->notify_func(pnwb->notify_baton, notify->shard,
+ notify->action - 3, scratch_pool));
+}
+
+svn_error_t *
+svn_repos_fs_pack(svn_repos_t *repos,
+ svn_fs_pack_notify_t notify_func,
+ void *notify_baton,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *pool)
+{
+ struct pack_notify_wrapper_baton pnwb;
+
+ pnwb.notify_func = notify_func;
+ pnwb.notify_baton = notify_baton;
+
+ return svn_repos_fs_pack2(repos, pack_notify_wrapper_func, &pnwb,
+ cancel_func, cancel_baton, pool);
+}
+
/*** From logs.c ***/
svn_error_t *
svn_repos_get_logs3(svn_repos_t *repos,
Modified: subversion/trunk/subversion/libsvn_repos/fs-wrap.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/fs-wrap.c?rev=950109&r1=950108&r2=950109&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/fs-wrap.c (original)
+++ subversion/trunk/subversion/libsvn_repos/fs-wrap.c Tue Jun 1 15:17:16 2010
@@ -640,15 +640,43 @@ svn_repos_fs_get_mergeinfo(svn_mergeinfo
return SVN_NO_ERROR;
}
+struct pack_notify_baton
+{
+ svn_repos_notify_func_t notify_func;
+ void *notify_baton;
+};
+
+/* Implements svn_fs_pack_notify_t. */
+static svn_error_t *
+pack_notify_func(void *baton,
+ apr_int64_t shard,
+ svn_fs_pack_notify_action_t pack_action,
+ apr_pool_t *pool)
+{
+ struct pack_notify_baton *pnb = baton;
+ svn_repos_notify_t *notify;
+
+ notify = svn_repos_notify_create(pack_action + 3, pool);
+ notify->shard = shard;
+ pnb->notify_func(pnb->notify_baton, notify, pool);
+
+ return SVN_NO_ERROR;
+}
+
svn_error_t *
-svn_repos_fs_pack(svn_repos_t *repos,
- svn_fs_pack_notify_t notify_func,
- void *notify_baton,
- svn_cancel_func_t cancel_func,
- void *cancel_baton,
- apr_pool_t *pool)
+svn_repos_fs_pack2(svn_repos_t *repos,
+ svn_repos_notify_func_t notify_func,
+ void *notify_baton,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *pool)
{
- return svn_fs_pack(repos->db_path, notify_func, notify_baton,
+ struct pack_notify_baton pnb;
+
+ pnb.notify_func = notify_func;
+ pnb.notify_baton = notify_baton;
+
+ return svn_fs_pack(repos->db_path, pack_notify_func, &pnb,
cancel_func, cancel_baton, pool);
}