[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r34866 - trunk/subversion/libsvn_wc

From: Greg Stein <gstein_at_gmail.com>
Date: Sat, 27 Dec 2008 05:34:05 -0800

I don't understand why transactions would be exposed to users of this
API. Each API "should" leave the db in a consistent state. If each API
does *not*, then you are placing a burden on the caller to make
specific sets of calls in a specific order, which is usually hard to
document, so you end up with unwritten assumptions.

Optimizations around our use of SQLite should preferably be internal.

Is there something about your thinking which I'm missing?

Thanks,
-g

On Fri, Dec 19, 2008 at 13:28, Hyrum K. Wright <hyrum_at_hyrumwright.org> wrote:
> Author: hwright
> Date: Fri Dec 19 13:28:09 2008
> New Revision: 34866
>
> Log:
> WC-NG: Add a few more database administrative APIs. This mainly just fleshes
> out some ideas I've had about transaction handling and general db
> administration.
>
> * subversion/libsvn_wc/wc_db.c
> (svn_wc__db_txn_begin, svn_wc__db_txn_rollback, svn_wc__db_txn_commit,
> svn_wc__db_close): New.
>
> * subversion/libsvn_wc/wc_db.h
> (svn_wc__db_txn_begin, svn_wc__db_txn_rollback, svn_wc__db_txn_commit,
> svn_wc__db_close): New.
>
> Modified:
> trunk/subversion/libsvn_wc/wc_db.c
> trunk/subversion/libsvn_wc/wc_db.h
>
> Modified: trunk/subversion/libsvn_wc/wc_db.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/wc_db.c?pathrev=34866&r1=34865&r2=34866
> ==============================================================================
> --- trunk/subversion/libsvn_wc/wc_db.c Fri Dec 19 12:02:22 2008 (r34865)
> +++ trunk/subversion/libsvn_wc/wc_db.c Fri Dec 19 13:28:09 2008 (r34866)
> @@ -214,6 +214,43 @@ svn_wc__db_open_many(svn_wc__db_t **db,
>
>
> svn_error_t *
> +svn_wc__db_txn_begin(svn_wc__db_t *db,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool)
> +{
> + return svn_error__malfunction(TRUE, __FILE__, __LINE__, "Not implemented.");
> +}
> +
> +
> +svn_error_t *
> +svn_wc__db_txn_rollback(svn_wc__db_t *db,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool)
> +{
> + return svn_error__malfunction(TRUE, __FILE__, __LINE__, "Not implemented.");
> +}
> +
> +
> +svn_error_t *
> +svn_wc__db_txn_commit(svn_wc__db_t *db,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool)
> +{
> + return svn_error__malfunction(TRUE, __FILE__, __LINE__, "Not implemented.");
> +}
> +
> +
> +svn_error_t *
> +svn_wc__db_close(svn_wc__db_t *db,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool)
> +{
> + SVN_ERR(svn_wc__db_txn_rollback(db, result_pool, scratch_pool));
> + return SVN_NO_ERROR;
> +}
> +
> +
> +svn_error_t *
> svn_wc__db_pristine_dirhandle(svn_wc__db_pdh_t **pdh,
> svn_wc__db_t *db,
> const char *dirpath,
>
> Modified: trunk/subversion/libsvn_wc/wc_db.h
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/wc_db.h?pathrev=34866&r1=34865&r2=34866
> ==============================================================================
> --- trunk/subversion/libsvn_wc/wc_db.h Fri Dec 19 12:02:22 2008 (r34865)
> +++ trunk/subversion/libsvn_wc/wc_db.h Fri Dec 19 13:28:09 2008 (r34866)
> @@ -119,6 +119,11 @@ typedef enum {
> /* ### some kind of _create() call to set things up? */
>
> /**
> + * @defgroup svn_wc__db_admin General administractive functions
> + * @{
> + */
> +
> +/**
> * Open the administrative database for the working copy identified by the
> * (absolute) @a path. The (opaque) handle for interacting with the database
> * will be returned in @a *db. Note that the database MAY NOT be specific
> @@ -181,6 +186,55 @@ svn_wc__db_open_many(svn_wc__db_t **db,
> apr_pool_t *scratch_pool);
>
> /**
> + * Start a transaction for the database(s) which are part of @a db.
> + *
> + * Any results will be alloated in @a result_pool, and temporary allocations
> + * will be made in @a scratch_pool.
> + */
> +svn_error_t *
> +svn_wc__db_txn_begin(svn_wc__db_t *db,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool);
> +
> +/**
> + * Rollback any changes to @a db which have happened since the last
> + * call to svn_wc__db_txn_begin(). If a transaction is not currently in
> + * progress, nothing occurs.
> + *
> + * Any results will be alloated in @a result_pool, and temporary allocations
> + * will be made in @a scratch_pool.
> + */
> +svn_error_t *
> +svn_wc__db_txn_rollback(svn_wc__db_t *db,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool);
> +
> +/**
> + * Commit the currently active transaction for @a db. If a transaction is not
> + * currently in progress, nothing occurs.
> + *
> + * Any results will be alloated in @a result_pool, and temporary allocations
> + * will be made in @a scratch_pool.
> + */
> +svn_error_t *
> +svn_wc__db_txn_commit(svn_wc__db_t *db,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool);
> +
> +/**
> + * Close @a db, and rollback any pending transaction associated with it.
> + *
> + * Any results will be alloated in @a result_pool, and temporary allocations
> + * will be made in @a scratch_pool.
> + */
> +svn_error_t *
> +svn_wc__db_close(svn_wc__db_t *db,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool);
> +
> +/** @} */
> +
> +/**
> * @defgroup svn_wc__db_base BASE tree management
> * @{
> */
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=495&dsMessageId=987826
>

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=993713
Received on 2008-12-27 14:34:22 CET

This is an archived mail posted to the Subversion Dev mailing list.