You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2013/04/05 16:47:38 UTC
svn commit: r1464993 - in /subversion/trunk/subversion: include/svn_fs.h
include/svn_repos.h libsvn_fs/fs-loader.c libsvn_repos/repos.c
Author: danielsh
Date: Fri Apr 5 14:47:37 2013
New Revision: 1464993
URL: http://svn.apache.org/r1464993
Log:
'svnadmin info': sketch the public API.
Declare the new APIs:
* subversion/include/svn_fs.h
(svn_fs_info, svn_fs_info_t, svn_fs_info_dup): New.
* subversion/include/svn_repos.h
(svn_repos_info, svn_repos_info_t, svn_repos_info_dup): New.
(svn_repos_capabilities): New.
And provide "Not implemented" definitions:
* subversion/libsvn_fs/fs-loader.c
(svn_fs_info, svn_fs_info_dup): Dummy implementations.
* subversion/libsvn_repos/repos.c
(svn_repos_info, svn_repos_info_dup): Dummy implementations.
(svn_repos_capabilities): Dummy implementation.
Modified:
subversion/trunk/subversion/include/svn_fs.h
subversion/trunk/subversion/include/svn_repos.h
subversion/trunk/subversion/libsvn_fs/fs-loader.c
subversion/trunk/subversion/libsvn_repos/repos.c
Modified: subversion/trunk/subversion/include/svn_fs.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_fs.h?rev=1464993&r1=1464992&r2=1464993&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_fs.h (original)
+++ subversion/trunk/subversion/include/svn_fs.h Fri Apr 5 14:47:37 2013
@@ -2500,6 +2500,98 @@ svn_fs_verify_root(svn_fs_root_t *root,
/** @} */
+/**
+ * @defgroup fs_info Filesystem information subsystem
+ * @{
+ */
+
+/**
+ * A structure that provides some information about a filesystem.
+ * Returned by svn_fs_info().
+ *
+ * @note Fields may be added to the end of this structure in future
+ * versions. Therefore, users shouldn't allocate structures of this
+ * type, to preserve binary compatibility.
+ *
+ * @since New in 1.8.
+ */
+typedef struct svn_fs_info_t {
+
+ /** @see svn_fs_type() */
+ const char *fs_type;
+
+ /** @see svn_fs_get_uuid() */
+ const char *uuid;
+
+ /** @see svn_fs_youngest_rev() */
+ svn_revnum_t youngest;
+
+ /** Filesystem format number: an integer that increases when incompatible
+ * changes are made (such as by #svn_fs_upgrade). */
+ int fs_format;
+
+ /** The oldest Subversion GA release that can read and write this
+ * filesystem. */
+ svn_version_t *supports_version;
+
+#if 0
+ /* Potential future feature. */
+ svn_boolean_t is_write_locked;
+#endif
+
+ /** Filesystem backend (#fs_type) -specific information.
+ * @see SVN_FS_FSFS_INFO_* */
+ apr_hash_t *fsap_info;
+
+ /** List of user-serviceable config files.
+ * Elements are dirents (as const char *). */
+ apr_array_header_t *config_files;
+
+} svn_fs_info_t;
+
+/**
+ * Set @a *info to an info struct describing @a fs.
+ *
+ * @see #svn_fs_info_t
+ *
+ * @since New in 1.8.
+ */
+svn_error_t *
+svn_fs_info(const svn_fs_info_t **info,
+ svn_fs_t *fs,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
+/**
+ * Return a duplicate of @a info, allocated in @a pool. No part of the new
+ * structure will be shared with @a info.
+ *
+ * @since New in 1.8.
+ */
+svn_fs_info_t *
+svn_fs_info_dup(const svn_fs_info_t *info,
+ apr_pool_t *result_pool);
+
+/** @name FSFS-specific #svn_fs_info_t information.
+ * @since New in 1.8.
+ * @{
+ */
+
+/** Value: shard size (as int), or 0 if the filesystem is
+ * not currently sharded. */
+#define SVN_FS_FSFS_INFO_SHARDED "sharded"
+
+/** Value: abspath to rep-cache.db, or absent if that doesn't exist.
+ @note Do not modify the db schema or tables!
+ */
+#define SVN_FS_FSFS_INFO_REP_CACHE_PATH "rep-cache-path"
+
+/** The smallest revision (as #svn_revnum_t) which is not in a pack file.
+ * @note Zero (0) if (but not iff) the format does not support packing. */
+#define SVN_FS_FSFS_INFO_MIN_UNPACKED_REV "min-unpacked-rev"
+/** @} */
+
+/** @} */
#ifdef __cplusplus
}
Modified: subversion/trunk/subversion/include/svn_repos.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_repos.h?rev=1464993&r1=1464992&r2=1464993&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_repos.h (original)
+++ subversion/trunk/subversion/include/svn_repos.h Fri Apr 5 14:47:37 2013
@@ -495,6 +495,26 @@ svn_repos_has_capability(svn_repos_t *re
apr_pool_t *pool);
/**
+ * Return a set capabilities supported by the running Subversion library and by
+ * @a repos. (Capabilities supported by this version of Subversion but not by
+ * @a repos are not listed. This may happen when svn_repos_upgrade2() has not
+ * been called after a software upgrade.)
+ *
+ * The set is represented as a hash whose keys are the set members. The values
+ * are not defined.
+ *
+ * @see svn_repos_info()
+ *
+ * @since New in 1.8.
+ */
+svn_error_t *
+svn_repos_capabilities(apr_hash_t **capabilities,
+ svn_repos_t *repos,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+/** @} */
+
+/**
* The capability of doing the right thing with merge-tracking
* information, both storing it and responding to queries about it.
*
@@ -3387,6 +3407,76 @@ svn_repos_remember_client_capabilities(s
const apr_array_header_t *capabilities);
+
+/** Info. **/
+/**
+ * @defgroup repos_info Repository information subsystem
+ * @{
+ */
+
+/**
+ * A structure that provides some information about a repository.
+ * Returned by svn_repos_info().
+ *
+ * @note Fields may be added to the end of this structure in future
+ * versions. Therefore, users shouldn't allocate structures of this
+ * type, to preserve binary compatibility.
+ *
+ * @since New in 1.8.
+ */
+typedef struct svn_repos_info_t {
+
+ /** Repository format number: an integer that increases when incompatible
+ * changes are made (such as by #svn_repos_upgrade). */
+ int repos_format;
+
+ /** The oldest Subversion GA release that can read and write this
+ * repository. */
+ svn_version_t *supports_version;
+
+ /** Set of basenames of hook scripts which have been installed.
+ * Keys are C strings such as "post-commit", values are undefined. */
+ apr_hash_t *hooks_enabled;
+
+ /** Set of basenames of hook scripts which are respected by this version of
+ * Subversion. Keys are C strings such as "post-commit", values are
+ * undefined.
+ *
+ * @note Hooks are sometimes extended (e.g., by passing additional arguments
+ * to them). In the future we might extend the semantics of this hash to
+ * describe that case, for example by adding keys or defining a meaning for
+ * the values.
+ */
+ apr_hash_t *hooks_known;
+
+ /** @see svn_fs_info(), svn_repos_fs() */
+ svn_fs_info_t *fs_info;
+
+} svn_repos_info_t;
+
+/**
+ * Set @a *info to an info struct describing @a repos.
+ *
+ * @see #svn_repos_info_t, svn_repos_capabilities()
+ *
+ * @since New in 1.8.
+ */
+svn_error_t *
+svn_repos_info(const svn_repos_info_t **info,
+ svn_repos_t *repos,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
+/**
+ * Return a duplicate of @a info, allocated in @a pool. No part of the new
+ * structure will be shared with @a info.
+ *
+ * @since New in 1.8.
+ */
+svn_repos_info_t *
+svn_repos_info_dup(const svn_repos_info_t *info,
+ apr_pool_t *result_pool);
+
#ifdef __cplusplus
}
Modified: subversion/trunk/subversion/libsvn_fs/fs-loader.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs/fs-loader.c?rev=1464993&r1=1464992&r2=1464993&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs/fs-loader.c (original)
+++ subversion/trunk/subversion/libsvn_fs/fs-loader.c Fri Apr 5 14:47:37 2013
@@ -1590,3 +1590,24 @@ svn_fs_version(void)
{
SVN_VERSION_BODY;
}
+
+
+/** info **/
+svn_error_t *
+svn_fs_info(const svn_fs_info_t **info,
+ svn_fs_t *fs,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ SVN__NOT_IMPLEMENTED();
+}
+
+svn_fs_info_t *
+svn_fs_info_dup(const svn_fs_info_t *info,
+ apr_pool_t *result_pool)
+{
+ /* Not implemented. */
+ SVN_ERR_MALFUNCTION_NO_RETURN();
+ return NULL;
+}
+
Modified: subversion/trunk/subversion/libsvn_repos/repos.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/repos.c?rev=1464993&r1=1464992&r2=1464993&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/repos.c (original)
+++ subversion/trunk/subversion/libsvn_repos/repos.c Fri Apr 5 14:47:37 2013
@@ -1677,6 +1677,15 @@ svn_repos_has_capability(svn_repos_t *re
return SVN_NO_ERROR;
}
+svn_error_t *
+svn_repos_capabilities(apr_hash_t **capabilities,
+ svn_repos_t *repos,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ SVN__NOT_IMPLEMENTED();
+}
+
svn_fs_t *
svn_repos_fs(svn_repos_t *repos)
@@ -2131,3 +2140,23 @@ svn_repos__fs_type(const char **fs_type,
svn_dirent_join(repos_path, SVN_REPOS__DB_DIR, pool),
pool);
}
+
+
+/** info **/
+svn_error_t *
+svn_repos_info(const svn_repos_info_t **info,
+ svn_repos_t *repos,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ SVN__NOT_IMPLEMENTED();
+}
+
+svn_repos_info_t *
+svn_repos_info_dup(const svn_repos_info_t *info,
+ apr_pool_t *result_pool)
+{
+ /* Not implemented. */
+ SVN_ERR_MALFUNCTION_NO_RETURN();
+ return NULL;
+}
'svnadmin info' API Re: svn commit: r1464993 - in
/subversion/trunk/subversion: include/svn_fs.h include/svn_repos.h
libsvn_fs/fs-loader.c libsvn_repos/repos.c
Posted by Daniel Shahaf <da...@elego.de>.
Soliciting review of this, as apparently most people skipped my previous
mail which had the same entropy in a more-compressed form.
Assuming no objections I'll see about an implementation in libsvn_* and
making svnadmin consume that.
danielsh@apache.org wrote on Fri, Apr 05, 2013 at 14:47:38 -0000:
> Author: danielsh
> Date: Fri Apr 5 14:47:37 2013
> New Revision: 1464993
>
> URL: http://svn.apache.org/r1464993
> Log:
> 'svnadmin info': sketch the public API.
>
> Declare the new APIs:
> * subversion/include/svn_fs.h
> (svn_fs_info, svn_fs_info_t, svn_fs_info_dup): New.
>
> * subversion/include/svn_repos.h
> (svn_repos_info, svn_repos_info_t, svn_repos_info_dup): New.
> (svn_repos_capabilities): New.
>
> And provide "Not implemented" definitions:
>
> * subversion/libsvn_fs/fs-loader.c
> (svn_fs_info, svn_fs_info_dup): Dummy implementations.
>
> * subversion/libsvn_repos/repos.c
> (svn_repos_info, svn_repos_info_dup): Dummy implementations.
> (svn_repos_capabilities): Dummy implementation.
>
> Modified:
> subversion/trunk/subversion/include/svn_fs.h
> subversion/trunk/subversion/include/svn_repos.h
> subversion/trunk/subversion/libsvn_fs/fs-loader.c
> subversion/trunk/subversion/libsvn_repos/repos.c
>
> Modified: subversion/trunk/subversion/include/svn_fs.h
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_fs.h?rev=1464993&r1=1464992&r2=1464993&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/include/svn_fs.h (original)
> +++ subversion/trunk/subversion/include/svn_fs.h Fri Apr 5 14:47:37 2013
> @@ -2500,6 +2500,98 @@ svn_fs_verify_root(svn_fs_root_t *root,
>
> /** @} */
>
> +/**
> + * @defgroup fs_info Filesystem information subsystem
> + * @{
> + */
> +
> +/**
> + * A structure that provides some information about a filesystem.
> + * Returned by svn_fs_info().
> + *
> + * @note Fields may be added to the end of this structure in future
> + * versions. Therefore, users shouldn't allocate structures of this
> + * type, to preserve binary compatibility.
> + *
> + * @since New in 1.8.
> + */
> +typedef struct svn_fs_info_t {
> +
> + /** @see svn_fs_type() */
> + const char *fs_type;
> +
> + /** @see svn_fs_get_uuid() */
> + const char *uuid;
> +
> + /** @see svn_fs_youngest_rev() */
> + svn_revnum_t youngest;
> +
> + /** Filesystem format number: an integer that increases when incompatible
> + * changes are made (such as by #svn_fs_upgrade). */
> + int fs_format;
> +
> + /** The oldest Subversion GA release that can read and write this
> + * filesystem. */
> + svn_version_t *supports_version;
> +
> +#if 0
> + /* Potential future feature. */
> + svn_boolean_t is_write_locked;
> +#endif
> +
> + /** Filesystem backend (#fs_type) -specific information.
> + * @see SVN_FS_FSFS_INFO_* */
> + apr_hash_t *fsap_info;
> +
> + /** List of user-serviceable config files.
> + * Elements are dirents (as const char *). */
> + apr_array_header_t *config_files;
> +
> +} svn_fs_info_t;
> +
> +/**
> + * Set @a *info to an info struct describing @a fs.
> + *
> + * @see #svn_fs_info_t
> + *
> + * @since New in 1.8.
> + */
> +svn_error_t *
> +svn_fs_info(const svn_fs_info_t **info,
> + svn_fs_t *fs,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool);
> +
> +/**
> + * Return a duplicate of @a info, allocated in @a pool. No part of the new
> + * structure will be shared with @a info.
> + *
> + * @since New in 1.8.
> + */
> +svn_fs_info_t *
> +svn_fs_info_dup(const svn_fs_info_t *info,
> + apr_pool_t *result_pool);
> +
> +/** @name FSFS-specific #svn_fs_info_t information.
> + * @since New in 1.8.
> + * @{
> + */
> +
> +/** Value: shard size (as int), or 0 if the filesystem is
> + * not currently sharded. */
> +#define SVN_FS_FSFS_INFO_SHARDED "sharded"
> +
> +/** Value: abspath to rep-cache.db, or absent if that doesn't exist.
> + @note Do not modify the db schema or tables!
> + */
> +#define SVN_FS_FSFS_INFO_REP_CACHE_PATH "rep-cache-path"
> +
> +/** The smallest revision (as #svn_revnum_t) which is not in a pack file.
> + * @note Zero (0) if (but not iff) the format does not support packing. */
> +#define SVN_FS_FSFS_INFO_MIN_UNPACKED_REV "min-unpacked-rev"
> +/** @} */
> +
> +/** @} */
>
> #ifdef __cplusplus
> }
>
> Modified: subversion/trunk/subversion/include/svn_repos.h
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_repos.h?rev=1464993&r1=1464992&r2=1464993&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/include/svn_repos.h (original)
> +++ subversion/trunk/subversion/include/svn_repos.h Fri Apr 5 14:47:37 2013
> @@ -495,6 +495,26 @@ svn_repos_has_capability(svn_repos_t *re
> apr_pool_t *pool);
>
> /**
> + * Return a set capabilities supported by the running Subversion library and by
> + * @a repos. (Capabilities supported by this version of Subversion but not by
> + * @a repos are not listed. This may happen when svn_repos_upgrade2() has not
> + * been called after a software upgrade.)
> + *
> + * The set is represented as a hash whose keys are the set members. The values
> + * are not defined.
> + *
> + * @see svn_repos_info()
> + *
> + * @since New in 1.8.
> + */
> +svn_error_t *
> +svn_repos_capabilities(apr_hash_t **capabilities,
> + svn_repos_t *repos,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool);
> +/** @} */
> +
> +/**
> * The capability of doing the right thing with merge-tracking
> * information, both storing it and responding to queries about it.
> *
> @@ -3387,6 +3407,76 @@ svn_repos_remember_client_capabilities(s
> const apr_array_header_t *capabilities);
>
>
> +
> +/** Info. **/
> +/**
> + * @defgroup repos_info Repository information subsystem
> + * @{
> + */
> +
> +/**
> + * A structure that provides some information about a repository.
> + * Returned by svn_repos_info().
> + *
> + * @note Fields may be added to the end of this structure in future
> + * versions. Therefore, users shouldn't allocate structures of this
> + * type, to preserve binary compatibility.
> + *
> + * @since New in 1.8.
> + */
> +typedef struct svn_repos_info_t {
> +
> + /** Repository format number: an integer that increases when incompatible
> + * changes are made (such as by #svn_repos_upgrade). */
> + int repos_format;
> +
> + /** The oldest Subversion GA release that can read and write this
> + * repository. */
> + svn_version_t *supports_version;
> +
> + /** Set of basenames of hook scripts which have been installed.
> + * Keys are C strings such as "post-commit", values are undefined. */
> + apr_hash_t *hooks_enabled;
> +
> + /** Set of basenames of hook scripts which are respected by this version of
> + * Subversion. Keys are C strings such as "post-commit", values are
> + * undefined.
> + *
> + * @note Hooks are sometimes extended (e.g., by passing additional arguments
> + * to them). In the future we might extend the semantics of this hash to
> + * describe that case, for example by adding keys or defining a meaning for
> + * the values.
> + */
> + apr_hash_t *hooks_known;
> +
> + /** @see svn_fs_info(), svn_repos_fs() */
> + svn_fs_info_t *fs_info;
> +
> +} svn_repos_info_t;
> +
> +/**
> + * Set @a *info to an info struct describing @a repos.
> + *
> + * @see #svn_repos_info_t, svn_repos_capabilities()
> + *
> + * @since New in 1.8.
> + */
> +svn_error_t *
> +svn_repos_info(const svn_repos_info_t **info,
> + svn_repos_t *repos,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool);
> +
> +/**
> + * Return a duplicate of @a info, allocated in @a pool. No part of the new
> + * structure will be shared with @a info.
> + *
> + * @since New in 1.8.
> + */
> +svn_repos_info_t *
> +svn_repos_info_dup(const svn_repos_info_t *info,
> + apr_pool_t *result_pool);
> +
>
> #ifdef __cplusplus
> }
>
> Modified: subversion/trunk/subversion/libsvn_fs/fs-loader.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs/fs-loader.c?rev=1464993&r1=1464992&r2=1464993&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_fs/fs-loader.c (original)
> +++ subversion/trunk/subversion/libsvn_fs/fs-loader.c Fri Apr 5 14:47:37 2013
> @@ -1590,3 +1590,24 @@ svn_fs_version(void)
> {
> SVN_VERSION_BODY;
> }
> +
> +
> +/** info **/
> +svn_error_t *
> +svn_fs_info(const svn_fs_info_t **info,
> + svn_fs_t *fs,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool)
> +{
> + SVN__NOT_IMPLEMENTED();
> +}
> +
> +svn_fs_info_t *
> +svn_fs_info_dup(const svn_fs_info_t *info,
> + apr_pool_t *result_pool)
> +{
> + /* Not implemented. */
> + SVN_ERR_MALFUNCTION_NO_RETURN();
> + return NULL;
> +}
> +
>
> Modified: subversion/trunk/subversion/libsvn_repos/repos.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/repos.c?rev=1464993&r1=1464992&r2=1464993&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_repos/repos.c (original)
> +++ subversion/trunk/subversion/libsvn_repos/repos.c Fri Apr 5 14:47:37 2013
> @@ -1677,6 +1677,15 @@ svn_repos_has_capability(svn_repos_t *re
> return SVN_NO_ERROR;
> }
>
> +svn_error_t *
> +svn_repos_capabilities(apr_hash_t **capabilities,
> + svn_repos_t *repos,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool)
> +{
> + SVN__NOT_IMPLEMENTED();
> +}
> +
>
> svn_fs_t *
> svn_repos_fs(svn_repos_t *repos)
> @@ -2131,3 +2140,23 @@ svn_repos__fs_type(const char **fs_type,
> svn_dirent_join(repos_path, SVN_REPOS__DB_DIR, pool),
> pool);
> }
> +
> +
> +/** info **/
> +svn_error_t *
> +svn_repos_info(const svn_repos_info_t **info,
> + svn_repos_t *repos,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool)
> +{
> + SVN__NOT_IMPLEMENTED();
> +}
> +
> +svn_repos_info_t *
> +svn_repos_info_dup(const svn_repos_info_t *info,
> + apr_pool_t *result_pool)
> +{
> + /* Not implemented. */
> + SVN_ERR_MALFUNCTION_NO_RETURN();
> + return NULL;
> +}
>
>
Re: svn commit: r1464993 - in /subversion/trunk/subversion:
include/svn_fs.h include/svn_repos.h libsvn_fs/fs-loader.c
libsvn_repos/repos.c
Posted by Daniel Shahaf <da...@elego.de>.
Daniel Shahaf wrote on Fri, Apr 05, 2013 at 18:47:26 +0300:
> THanks for the review, commnts inline:
>
> Ivan Zhakov wrote on Fri, Apr 05, 2013 at 19:40:16 +0400:
> > On Fri, Apr 5, 2013 at 6:47 PM, <da...@apache.org> wrote:
> > > + /** Filesystem backend (#fs_type) -specific information.
> > > + * @see SVN_FS_FSFS_INFO_* */
> > > + apr_hash_t *fsap_info;
> > > +
> > What is the values of this hash table? Always strings? What about
> > integers or booleans?
> >
>
> Each SVN_FS_FSFS_INFO_* macro will define its value's type. I suppose
> we can encourage the values to be, say, C strings in most cases.
>
> > > + /** List of user-serviceable config files.
> > > + * Elements are dirents (as const char *). */
> > > + apr_array_header_t *config_files;
> > I don't see real use why config_files information can be useful in
> > svnadmin info command. So I suggest to remove it until we need it.
> >
>
> ACK. I assumed this would be useful. What do others think?
> (this would contain ["DB_CONFIG"] or ["fsfs.conf"], currently.)
FWIW, I've already written the code, and I didn't have any better place
to save it in so I went ahead and committed it. If we end up deciding
it's not a good API to have I'll just 'svn undo' it (err, I mean, revert
it).
Re: svn commit: r1464993 - in /subversion/trunk/subversion:
include/svn_fs.h include/svn_repos.h libsvn_fs/fs-loader.c libsvn_repos/repos.c
Posted by Ivan Zhakov <iv...@visualsvn.com>.
On Fri, Apr 5, 2013 at 7:47 PM, Daniel Shahaf <da...@elego.de> wrote:
> THanks for the review, commnts inline:
>
Sorry for late reply. See my reply inline.
> Ivan Zhakov wrote on Fri, Apr 05, 2013 at 19:40:16 +0400:
>> On Fri, Apr 5, 2013 at 6:47 PM, <da...@apache.org> wrote:
>> > + /** Filesystem backend (#fs_type) -specific information.
>> > + * @see SVN_FS_FSFS_INFO_* */
>> > + apr_hash_t *fsap_info;
>> > +
>> What is the values of this hash table? Always strings? What about
>> integers or booleans?
>>
>
> Each SVN_FS_FSFS_INFO_* macro will define its value's
> type. I suppose
> we can encourage the values to be, say, C strings in most cases.
>
It would be great to guarantee them to be C strings in this case
svnadmin info or any other program could print them as opaque.
>> > + /** List of user-serviceable config files.
>> > + * Elements are dirents (as const char *). */
>> > + apr_array_header_t *config_files;
>> I don't see real use why config_files information can be useful in
>> svnadmin info command. So I suggest to remove it until we need it.
>>
>
> ACK. I assumed this would be useful. What do others think?
> (this would contain ["DB_CONFIG"] or ["fsfs.conf"], currently.)
>
>> > +/** Value: abspath to rep-cache.db, or absent if that doesn't exist.
>> > + @note Do not modify the db schema or tables!
>> > + */
>> > +#define SVN_FS_FSFS_INFO_REP_CACHE_PATH "rep-cache-path"
>> I suggest to replace it with boolean REP_CACHE_ENABLED. In most cases
>> user is interested wheither rep caching is enabled or not.
>> rep-cache.db stored in stable location.
>
> My rationale was that giving the path is more useful than just giving
> a "1" bit. I assume most users will just check
> svn_hash_gets(fsap_info, SVN_FS_FSFS_INFO_REP_CACHE_PATH) != NULL
> , but if someone wants to open the sqlite db and get some statistics
> they have the path right there.
>
I think we should leave it just yes/no value. Otherwise we implicitly
disclose (and promise for future) how rep cache database is stored.
Another argument that rep-cache.db can exist while rep-cache disabled
by fsfs.conf.
Could you please change it to SVN_FS_FSFS_INFO_REP_CACHE_ENABLED? At
least for 1.8.
>> > + /** Set of basenames of hook scripts which have been installed.
>> > + * Keys are C strings such as "post-commit", values are undefined. */
>> > + apr_hash_t *hooks_enabled;
>> > +
>> > + /** Set of basenames of hook scripts which are respected by this version of
>> > + * Subversion. Keys are C strings such as "post-commit", values are
>> > + * undefined.
>> > + *
>> > + * @note Hooks are sometimes extended (e.g., by passing additional arguments
>> > + * to them). In the future we might extend the semantics of this hash to
>> > + * describe that case, for example by adding keys or defining a meaning for
>> > + * the values.
>> > + */
>> > + apr_hash_t *hooks_known;
>> > +
>> Do we really need information about hooks in svnadmin info command?
>> What is the behavior is hook file is present but empty? I suggest to
>> remove this information from svn_repos_info_t and implemented as
>> different API if needed.
>
> It wasn't my idea to add this info in the first place. If people think
> this needs to go it can go.
>
I see that you dropped svn_repos_info_t structure completely. I don't
have strong opinion on this, but API with svn_repos_info_t with basic
information (format, supported version and FS info) was much cleaner
and easier to understand for my taste.
--
Ivan Zhakov
Re: svn commit: r1464993 - in /subversion/trunk/subversion:
include/svn_fs.h include/svn_repos.h libsvn_fs/fs-loader.c
libsvn_repos/repos.c
Posted by Daniel Shahaf <da...@elego.de>.
THanks for the review, commnts inline:
Ivan Zhakov wrote on Fri, Apr 05, 2013 at 19:40:16 +0400:
> On Fri, Apr 5, 2013 at 6:47 PM, <da...@apache.org> wrote:
> > + /** Filesystem backend (#fs_type) -specific information.
> > + * @see SVN_FS_FSFS_INFO_* */
> > + apr_hash_t *fsap_info;
> > +
> What is the values of this hash table? Always strings? What about
> integers or booleans?
>
Each SVN_FS_FSFS_INFO_* macro will define its value's type. I suppose
we can encourage the values to be, say, C strings in most cases.
> > + /** List of user-serviceable config files.
> > + * Elements are dirents (as const char *). */
> > + apr_array_header_t *config_files;
> I don't see real use why config_files information can be useful in
> svnadmin info command. So I suggest to remove it until we need it.
>
ACK. I assumed this would be useful. What do others think?
(this would contain ["DB_CONFIG"] or ["fsfs.conf"], currently.)
> > +/** Value: abspath to rep-cache.db, or absent if that doesn't exist.
> > + @note Do not modify the db schema or tables!
> > + */
> > +#define SVN_FS_FSFS_INFO_REP_CACHE_PATH "rep-cache-path"
> I suggest to replace it with boolean REP_CACHE_ENABLED. In most cases
> user is interested wheither rep caching is enabled or not.
> rep-cache.db stored in stable location.
My rationale was that giving the path is more useful than just giving
a "1" bit. I assume most users will just check
svn_hash_gets(fsap_info, SVN_FS_FSFS_INFO_REP_CACHE_PATH) != NULL
, but if someone wants to open the sqlite db and get some statistics
they have the path right there.
> > + /** Set of basenames of hook scripts which have been installed.
> > + * Keys are C strings such as "post-commit", values are undefined. */
> > + apr_hash_t *hooks_enabled;
> > +
> > + /** Set of basenames of hook scripts which are respected by this version of
> > + * Subversion. Keys are C strings such as "post-commit", values are
> > + * undefined.
> > + *
> > + * @note Hooks are sometimes extended (e.g., by passing additional arguments
> > + * to them). In the future we might extend the semantics of this hash to
> > + * describe that case, for example by adding keys or defining a meaning for
> > + * the values.
> > + */
> > + apr_hash_t *hooks_known;
> > +
> Do we really need information about hooks in svnadmin info command?
> What is the behavior is hook file is present but empty? I suggest to
> remove this information from svn_repos_info_t and implemented as
> different API if needed.
It wasn't my idea to add this info in the first place. If people think
this needs to go it can go.
Cheers,
Daniel
Re: svn commit: r1464993 - in /subversion/trunk/subversion:
include/svn_fs.h include/svn_repos.h libsvn_fs/fs-loader.c libsvn_repos/repos.c
Posted by Ivan Zhakov <iv...@visualsvn.com>.
On Fri, Apr 5, 2013 at 6:47 PM, <da...@apache.org> wrote:
> Author: danielsh
> Date: Fri Apr 5 14:47:37 2013
> New Revision: 1464993
>
> URL: http://svn.apache.org/r1464993
> Log:
> 'svnadmin info': sketch the public API.
>
[..]
Duplicating my comments from IRC inline.
> +typedef struct svn_fs_info_t {
> +
> + /** @see svn_fs_type() */
> + const char *fs_type;
> +
> + /** @see svn_fs_get_uuid() */
> + const char *uuid;
> +
> + /** @see svn_fs_youngest_rev() */
> + svn_revnum_t youngest;
> +
> + /** Filesystem format number: an integer that increases when incompatible
> + * changes are made (such as by #svn_fs_upgrade). */
> + int fs_format;
> +
> + /** The oldest Subversion GA release that can read and write this
> + * filesystem. */
> + svn_version_t *supports_version;
> +
> +#if 0
> + /* Potential future feature. */
> + svn_boolean_t is_write_locked;
> +#endif
> +
> + /** Filesystem backend (#fs_type) -specific information.
> + * @see SVN_FS_FSFS_INFO_* */
> + apr_hash_t *fsap_info;
> +
What is the values of this hash table? Always strings? What about
integers or booleans?
> + /** List of user-serviceable config files.
> + * Elements are dirents (as const char *). */
> + apr_array_header_t *config_files;
I don't see real use why config_files information can be useful in
svnadmin info command. So I suggest to remove it until we need it.
> +
> +} svn_fs_info_t;
> +
> +/**
> + * Set @a *info to an info struct describing @a fs.
> + *
> + * @see #svn_fs_info_t
> + *
> + * @since New in 1.8.
> + */
> +svn_error_t *
> +svn_fs_info(const svn_fs_info_t **info,
> + svn_fs_t *fs,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool);
> +
> +/**
> + * Return a duplicate of @a info, allocated in @a pool. No part of the new
> + * structure will be shared with @a info.
> + *
> + * @since New in 1.8.
> + */
> +svn_fs_info_t *
> +svn_fs_info_dup(const svn_fs_info_t *info,
> + apr_pool_t *result_pool);
> +
> +/** @name FSFS-specific #svn_fs_info_t information.
> + * @since New in 1.8.
> + * @{
> + */
> +
> +/** Value: shard size (as int), or 0 if the filesystem is
> + * not currently sharded. */
> +#define SVN_FS_FSFS_INFO_SHARDED "sharded"
> +
> +/** Value: abspath to rep-cache.db, or absent if that doesn't exist.
> + @note Do not modify the db schema or tables!
> + */
> +#define SVN_FS_FSFS_INFO_REP_CACHE_PATH "rep-cache-path"
I suggest to replace it with boolean REP_CACHE_ENABLED. In most cases
user is interested wheither rep caching is enabled or not.
rep-cache.db stored in stable location.
[...]
> + */
> +typedef struct svn_repos_info_t {
> +
> + /** Repository format number: an integer that increases when incompatible
> + * changes are made (such as by #svn_repos_upgrade). */
> + int repos_format;
> +
> + /** The oldest Subversion GA release that can read and write this
> + * repository. */
> + svn_version_t *supports_version;
> +
> + /** Set of basenames of hook scripts which have been installed.
> + * Keys are C strings such as "post-commit", values are undefined. */
> + apr_hash_t *hooks_enabled;
> +
> + /** Set of basenames of hook scripts which are respected by this version of
> + * Subversion. Keys are C strings such as "post-commit", values are
> + * undefined.
> + *
> + * @note Hooks are sometimes extended (e.g., by passing additional arguments
> + * to them). In the future we might extend the semantics of this hash to
> + * describe that case, for example by adding keys or defining a meaning for
> + * the values.
> + */
> + apr_hash_t *hooks_known;
> +
Do we really need information about hooks in svnadmin info command?
What is the behavior is hook file is present but empty? I suggest to
remove this information from svn_repos_info_t and implemented as
different API if needed.
--
Ivan Zhakov
'svnadmin info' API Re: svn commit: r1464993 - in
/subversion/trunk/subversion: include/svn_fs.h include/svn_repos.h
libsvn_fs/fs-loader.c libsvn_repos/repos.c
Posted by Daniel Shahaf <da...@elego.de>.
Soliciting review of this, as apparently most people skipped my previous
mail which had the same entropy in a more-compressed form.
Assuming no objections I'll see about an implementation in libsvn_* and
making svnadmin consume that.
danielsh@apache.org wrote on Fri, Apr 05, 2013 at 14:47:38 -0000:
> Author: danielsh
> Date: Fri Apr 5 14:47:37 2013
> New Revision: 1464993
>
> URL: http://svn.apache.org/r1464993
> Log:
> 'svnadmin info': sketch the public API.
>
> Declare the new APIs:
> * subversion/include/svn_fs.h
> (svn_fs_info, svn_fs_info_t, svn_fs_info_dup): New.
>
> * subversion/include/svn_repos.h
> (svn_repos_info, svn_repos_info_t, svn_repos_info_dup): New.
> (svn_repos_capabilities): New.
>
> And provide "Not implemented" definitions:
>
> * subversion/libsvn_fs/fs-loader.c
> (svn_fs_info, svn_fs_info_dup): Dummy implementations.
>
> * subversion/libsvn_repos/repos.c
> (svn_repos_info, svn_repos_info_dup): Dummy implementations.
> (svn_repos_capabilities): Dummy implementation.
>
> Modified:
> subversion/trunk/subversion/include/svn_fs.h
> subversion/trunk/subversion/include/svn_repos.h
> subversion/trunk/subversion/libsvn_fs/fs-loader.c
> subversion/trunk/subversion/libsvn_repos/repos.c
>
> Modified: subversion/trunk/subversion/include/svn_fs.h
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_fs.h?rev=1464993&r1=1464992&r2=1464993&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/include/svn_fs.h (original)
> +++ subversion/trunk/subversion/include/svn_fs.h Fri Apr 5 14:47:37 2013
> @@ -2500,6 +2500,98 @@ svn_fs_verify_root(svn_fs_root_t *root,
>
> /** @} */
>
> +/**
> + * @defgroup fs_info Filesystem information subsystem
> + * @{
> + */
> +
> +/**
> + * A structure that provides some information about a filesystem.
> + * Returned by svn_fs_info().
> + *
> + * @note Fields may be added to the end of this structure in future
> + * versions. Therefore, users shouldn't allocate structures of this
> + * type, to preserve binary compatibility.
> + *
> + * @since New in 1.8.
> + */
> +typedef struct svn_fs_info_t {
> +
> + /** @see svn_fs_type() */
> + const char *fs_type;
> +
> + /** @see svn_fs_get_uuid() */
> + const char *uuid;
> +
> + /** @see svn_fs_youngest_rev() */
> + svn_revnum_t youngest;
> +
> + /** Filesystem format number: an integer that increases when incompatible
> + * changes are made (such as by #svn_fs_upgrade). */
> + int fs_format;
> +
> + /** The oldest Subversion GA release that can read and write this
> + * filesystem. */
> + svn_version_t *supports_version;
> +
> +#if 0
> + /* Potential future feature. */
> + svn_boolean_t is_write_locked;
> +#endif
> +
> + /** Filesystem backend (#fs_type) -specific information.
> + * @see SVN_FS_FSFS_INFO_* */
> + apr_hash_t *fsap_info;
> +
> + /** List of user-serviceable config files.
> + * Elements are dirents (as const char *). */
> + apr_array_header_t *config_files;
> +
> +} svn_fs_info_t;
> +
> +/**
> + * Set @a *info to an info struct describing @a fs.
> + *
> + * @see #svn_fs_info_t
> + *
> + * @since New in 1.8.
> + */
> +svn_error_t *
> +svn_fs_info(const svn_fs_info_t **info,
> + svn_fs_t *fs,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool);
> +
> +/**
> + * Return a duplicate of @a info, allocated in @a pool. No part of the new
> + * structure will be shared with @a info.
> + *
> + * @since New in 1.8.
> + */
> +svn_fs_info_t *
> +svn_fs_info_dup(const svn_fs_info_t *info,
> + apr_pool_t *result_pool);
> +
> +/** @name FSFS-specific #svn_fs_info_t information.
> + * @since New in 1.8.
> + * @{
> + */
> +
> +/** Value: shard size (as int), or 0 if the filesystem is
> + * not currently sharded. */
> +#define SVN_FS_FSFS_INFO_SHARDED "sharded"
> +
> +/** Value: abspath to rep-cache.db, or absent if that doesn't exist.
> + @note Do not modify the db schema or tables!
> + */
> +#define SVN_FS_FSFS_INFO_REP_CACHE_PATH "rep-cache-path"
> +
> +/** The smallest revision (as #svn_revnum_t) which is not in a pack file.
> + * @note Zero (0) if (but not iff) the format does not support packing. */
> +#define SVN_FS_FSFS_INFO_MIN_UNPACKED_REV "min-unpacked-rev"
> +/** @} */
> +
> +/** @} */
>
> #ifdef __cplusplus
> }
>
> Modified: subversion/trunk/subversion/include/svn_repos.h
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_repos.h?rev=1464993&r1=1464992&r2=1464993&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/include/svn_repos.h (original)
> +++ subversion/trunk/subversion/include/svn_repos.h Fri Apr 5 14:47:37 2013
> @@ -495,6 +495,26 @@ svn_repos_has_capability(svn_repos_t *re
> apr_pool_t *pool);
>
> /**
> + * Return a set capabilities supported by the running Subversion library and by
> + * @a repos. (Capabilities supported by this version of Subversion but not by
> + * @a repos are not listed. This may happen when svn_repos_upgrade2() has not
> + * been called after a software upgrade.)
> + *
> + * The set is represented as a hash whose keys are the set members. The values
> + * are not defined.
> + *
> + * @see svn_repos_info()
> + *
> + * @since New in 1.8.
> + */
> +svn_error_t *
> +svn_repos_capabilities(apr_hash_t **capabilities,
> + svn_repos_t *repos,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool);
> +/** @} */
> +
> +/**
> * The capability of doing the right thing with merge-tracking
> * information, both storing it and responding to queries about it.
> *
> @@ -3387,6 +3407,76 @@ svn_repos_remember_client_capabilities(s
> const apr_array_header_t *capabilities);
>
>
> +
> +/** Info. **/
> +/**
> + * @defgroup repos_info Repository information subsystem
> + * @{
> + */
> +
> +/**
> + * A structure that provides some information about a repository.
> + * Returned by svn_repos_info().
> + *
> + * @note Fields may be added to the end of this structure in future
> + * versions. Therefore, users shouldn't allocate structures of this
> + * type, to preserve binary compatibility.
> + *
> + * @since New in 1.8.
> + */
> +typedef struct svn_repos_info_t {
> +
> + /** Repository format number: an integer that increases when incompatible
> + * changes are made (such as by #svn_repos_upgrade). */
> + int repos_format;
> +
> + /** The oldest Subversion GA release that can read and write this
> + * repository. */
> + svn_version_t *supports_version;
> +
> + /** Set of basenames of hook scripts which have been installed.
> + * Keys are C strings such as "post-commit", values are undefined. */
> + apr_hash_t *hooks_enabled;
> +
> + /** Set of basenames of hook scripts which are respected by this version of
> + * Subversion. Keys are C strings such as "post-commit", values are
> + * undefined.
> + *
> + * @note Hooks are sometimes extended (e.g., by passing additional arguments
> + * to them). In the future we might extend the semantics of this hash to
> + * describe that case, for example by adding keys or defining a meaning for
> + * the values.
> + */
> + apr_hash_t *hooks_known;
> +
> + /** @see svn_fs_info(), svn_repos_fs() */
> + svn_fs_info_t *fs_info;
> +
> +} svn_repos_info_t;
> +
> +/**
> + * Set @a *info to an info struct describing @a repos.
> + *
> + * @see #svn_repos_info_t, svn_repos_capabilities()
> + *
> + * @since New in 1.8.
> + */
> +svn_error_t *
> +svn_repos_info(const svn_repos_info_t **info,
> + svn_repos_t *repos,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool);
> +
> +/**
> + * Return a duplicate of @a info, allocated in @a pool. No part of the new
> + * structure will be shared with @a info.
> + *
> + * @since New in 1.8.
> + */
> +svn_repos_info_t *
> +svn_repos_info_dup(const svn_repos_info_t *info,
> + apr_pool_t *result_pool);
> +
>
> #ifdef __cplusplus
> }
>
> Modified: subversion/trunk/subversion/libsvn_fs/fs-loader.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs/fs-loader.c?rev=1464993&r1=1464992&r2=1464993&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_fs/fs-loader.c (original)
> +++ subversion/trunk/subversion/libsvn_fs/fs-loader.c Fri Apr 5 14:47:37 2013
> @@ -1590,3 +1590,24 @@ svn_fs_version(void)
> {
> SVN_VERSION_BODY;
> }
> +
> +
> +/** info **/
> +svn_error_t *
> +svn_fs_info(const svn_fs_info_t **info,
> + svn_fs_t *fs,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool)
> +{
> + SVN__NOT_IMPLEMENTED();
> +}
> +
> +svn_fs_info_t *
> +svn_fs_info_dup(const svn_fs_info_t *info,
> + apr_pool_t *result_pool)
> +{
> + /* Not implemented. */
> + SVN_ERR_MALFUNCTION_NO_RETURN();
> + return NULL;
> +}
> +
>
> Modified: subversion/trunk/subversion/libsvn_repos/repos.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/repos.c?rev=1464993&r1=1464992&r2=1464993&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_repos/repos.c (original)
> +++ subversion/trunk/subversion/libsvn_repos/repos.c Fri Apr 5 14:47:37 2013
> @@ -1677,6 +1677,15 @@ svn_repos_has_capability(svn_repos_t *re
> return SVN_NO_ERROR;
> }
>
> +svn_error_t *
> +svn_repos_capabilities(apr_hash_t **capabilities,
> + svn_repos_t *repos,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool)
> +{
> + SVN__NOT_IMPLEMENTED();
> +}
> +
>
> svn_fs_t *
> svn_repos_fs(svn_repos_t *repos)
> @@ -2131,3 +2140,23 @@ svn_repos__fs_type(const char **fs_type,
> svn_dirent_join(repos_path, SVN_REPOS__DB_DIR, pool),
> pool);
> }
> +
> +
> +/** info **/
> +svn_error_t *
> +svn_repos_info(const svn_repos_info_t **info,
> + svn_repos_t *repos,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool)
> +{
> + SVN__NOT_IMPLEMENTED();
> +}
> +
> +svn_repos_info_t *
> +svn_repos_info_dup(const svn_repos_info_t *info,
> + apr_pool_t *result_pool)
> +{
> + /* Not implemented. */
> + SVN_ERR_MALFUNCTION_NO_RETURN();
> + return NULL;
> +}
>
>