You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2015/10/11 17:58:33 UTC

svn commit: r1707992 - in /subversion/trunk/subversion: include/svn_fs.h libsvn_fs/deprecated.c libsvn_fs/fs-loader.c

Author: stefan2
Date: Sun Oct 11 15:58:33 2015
New Revision: 1707992

URL: http://svn.apache.org/viewvc?rev=1707992&view=rev
Log:
Make the recent revprop read function changes in the FS vtable
available through the FS API.

* subversion/include/svn_fs.h
  (svn_fs_refresh_revision_props): Declare new public API.
  (svn_fs_revision_prop2): Bump version of ...
  (svn_fs_revision_prop): ... this now deprecated API.
  (svn_fs_revision_proplist2): Bump version of ...
  (svn_fs_revision_proplist): ... this now deprecated API.

* subversion/libsvn_fs/deprecated.c
  (svn_fs_revision_prop,
   svn_fs_revision_proplist): Implement in terms of the new API.

* subversion/libsvn_fs/fs-loader.c
  (svn_fs_refresh_revision_props,
   svn_fs_revision_prop2,
   svn_fs_revision_proplist2): Implement as direct vtable calls.

Modified:
    subversion/trunk/subversion/include/svn_fs.h
    subversion/trunk/subversion/libsvn_fs/deprecated.c
    subversion/trunk/subversion/libsvn_fs/fs-loader.c

Modified: subversion/trunk/subversion/include/svn_fs.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_fs.h?rev=1707992&r1=1707991&r2=1707992&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_fs.h (original)
+++ subversion/trunk/subversion/include/svn_fs.h Sun Oct 11 15:58:33 2015
@@ -2515,11 +2515,70 @@ svn_fs_deltify_revision(svn_fs_t *fs,
                         svn_revnum_t revision,
                         apr_pool_t *pool);
 
+/** Make sure that all completed revision property changes to the filesystem
+ * underlying @a fs are actually visible through @a fs.  Use @a scratch_pool
+ * for temporary allocations.
+ *
+ * This is an explicit synchronization barrier for revprop changes made
+ * through different #svn_fs_t for the same underlying filesystem. Any
+ * revprop change through @a fs acts as an implicit barrier, i.e. that
+ * object will see all completed revprop changes up to an including its own.
+ * Only #svn_fs_revision_prop2 and #svn_fs_revision_proplist2 have an option
+ * to not synchronize with on-disk data and potentially return outdated data
+ * as old as the last barrier.
+ *
+ * The intended use of this is implementing efficient queries in upper layers
+ * where the result only needs to include all changes up the the start of
+ * that query but does not need to pick up on changes while the query is
+ * running:
+ *
+ * @code
+     SVN_ERR(svn_fs_deltify_revision(fs, pool);
+     for (i = 0; i < n; i++)
+       SVN_ERR(svn_fs_revision_prop2(&authors[i], fs, revs[i], "svn:author",
+                                     FALSE, pool, pool)); @endcode
+ *
+ * @see svn_fs_revision_prop2, svn_fs_revision_proplist2
+ *
+ * @since New in 1.10.
+ */
+svn_error_t *
+svn_fs_refresh_revision_props(svn_fs_t *fs,
+                              apr_pool_t *scratch_pool);
 
 /** Set @a *value_p to the value of the property named @a propname on
  * revision @a rev in the filesystem @a fs.  If @a rev has no property by
- * that name, set @a *value_p to zero.  Allocate the result in @a pool.
+ * that name, set @a *value_p to zero.
+ *
+ * If @a refresh is set, this call acts as a read barrier and is guaranteed
+ * to return the latest value.  Otherwise, it may return data as old as the
+ * last synchronization point but can be much faster to access - in
+ * particular for packed repositories.
+ *
+ * Allocate the result in @a result_pool and use @a scratch_pool for
+ * temporary allocations.
+ *
+ * @see svn_fs_refresh_revision_props
+ *
+ * @since New in 1.10.
+ */
+svn_error_t *
+svn_fs_revision_prop2(svn_string_t **value_p,
+                      svn_fs_t *fs,
+                      svn_revnum_t rev,
+                      const char *propname,
+                      svn_boolean_t refresh,
+                      apr_pool_t *result_pool,
+                      apr_pool_t *scratch_pool);
+
+/** Like #svn_fs_revision_prop2 but using @a pool for @a scratch_pool as
+ * well as @a result_pool and setting @a refresh to #TRUE.
+ *
+ * @see svn_fs_refresh_revision_props
+ *
+ * @deprecated For backward compatibility with 1.9.
  */
+SVN_DEPRECATED
 svn_error_t *
 svn_fs_revision_prop(svn_string_t **value_p,
                      svn_fs_t *fs,
@@ -2531,15 +2590,41 @@ svn_fs_revision_prop(svn_string_t **valu
 /** Set @a *table_p to the entire property list of revision @a rev in
  * filesystem @a fs, as an APR hash table allocated in @a pool.  The table
  * maps <tt>char *</tt> property names to #svn_string_t * values; the names
- * and values are allocated in @a pool.
+ * and values are allocated in @a result_pool.  Use @a scratch_pool for
+ * temporary allocations.
+ *
+ * If @a refresh is set, this call acts as a read barrier and is guaranteed
+ * to return the latest value.  Otherwise, it may return data as old as the
+ * last synchronization point but can be much faster to access - in
+ * particular for packed repositories.
+ *
+ * @see svn_fs_refresh_revision_props
+ *
+ * @since New in 1.10.
+ *
  */
 svn_error_t *
+svn_fs_revision_proplist2(apr_hash_t **table_p,
+                          svn_fs_t *fs,
+                          svn_revnum_t rev,
+                          svn_boolean_t refresh,
+                          apr_pool_t *result_pool,
+                          apr_pool_t *scratch_pool);
+
+/** Like svn_fs_revision_proplist2 but using @a pool for @a scratch_pool as
+ * well as @a result_pool and setting @a refresh to #TRUE.
+ *
+ * @see svn_fs_refresh_revision_props
+ *
+ * @deprecated For backward compatibility with 1.9.
+ */
+SVN_DEPRECATED
+svn_error_t *
 svn_fs_revision_proplist(apr_hash_t **table_p,
                          svn_fs_t *fs,
                          svn_revnum_t rev,
                          apr_pool_t *pool);
 
-
 /** Change a revision's property's value, or add/delete a property.
  *
  * - @a fs is a filesystem, and @a rev is the revision in that filesystem

Modified: subversion/trunk/subversion/libsvn_fs/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs/deprecated.c?rev=1707992&r1=1707991&r2=1707992&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_fs/deprecated.c Sun Oct 11 15:58:33 2015
@@ -64,6 +64,28 @@ svn_fs_begin_txn(svn_fs_txn_t **txn_p, s
 }
 
 svn_error_t *
+svn_fs_revision_prop(svn_string_t **value_p,
+                     svn_fs_t *fs,
+                     svn_revnum_t rev,
+                     const char *propname,
+                     apr_pool_t *pool)
+{
+  return svn_error_trace(
+           svn_fs_revision_prop2(value_p, fs, rev, propname, TRUE, pool,
+                                 pool));
+}
+
+svn_error_t *
+svn_fs_revision_proplist(apr_hash_t **table_p,
+                         svn_fs_t *fs,
+                         svn_revnum_t rev,
+                         apr_pool_t *pool)
+{
+  return svn_error_trace(
+           svn_fs_revision_proplist2(table_p, fs, rev, TRUE, pool, pool));
+}
+
+svn_error_t *
 svn_fs_change_rev_prop(svn_fs_t *fs, svn_revnum_t rev, const char *name,
                        const svn_string_t *value, apr_pool_t *pool)
 {

Modified: subversion/trunk/subversion/libsvn_fs/fs-loader.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs/fs-loader.c?rev=1707992&r1=1707991&r2=1707992&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs/fs-loader.c (original)
+++ subversion/trunk/subversion/libsvn_fs/fs-loader.c Sun Oct 11 15:58:33 2015
@@ -1553,20 +1553,39 @@ svn_fs_deltify_revision(svn_fs_t *fs, sv
 }
 
 svn_error_t *
-svn_fs_revision_prop(svn_string_t **value_p, svn_fs_t *fs, svn_revnum_t rev,
-                     const char *propname, apr_pool_t *pool)
+svn_fs_refresh_revision_props(svn_fs_t *fs,
+                              apr_pool_t *scratch_pool)
+{
+  return svn_error_trace(fs->vtable->refresh_revprops(fs, scratch_pool));
+}
+
+svn_error_t *
+svn_fs_revision_prop2(svn_string_t **value_p,
+                      svn_fs_t *fs,
+                      svn_revnum_t rev,
+                      const char *propname,
+                      svn_boolean_t refresh,
+                      apr_pool_t *result_pool,
+                      apr_pool_t *scratch_pool)
 {
   return svn_error_trace(fs->vtable->revision_prop(value_p, fs, rev,
-                                                   propname, TRUE,
-                                                   pool, pool));
+                                                   propname, refresh,
+                                                   result_pool,
+                                                   scratch_pool));
 }
 
 svn_error_t *
-svn_fs_revision_proplist(apr_hash_t **table_p, svn_fs_t *fs, svn_revnum_t rev,
-                         apr_pool_t *pool)
+svn_fs_revision_proplist2(apr_hash_t **table_p,
+                          svn_fs_t *fs,
+                          svn_revnum_t rev,
+                          svn_boolean_t refresh,
+                          apr_pool_t *result_pool,
+                          apr_pool_t *scratch_pool)
 {
   return svn_error_trace(fs->vtable->revision_proplist(table_p, fs, rev,
-                                                       TRUE, pool, pool));
+                                                       refresh,
+                                                       result_pool,
+                                                       scratch_pool));
 }
 
 svn_error_t *