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

[PROPOSAL] Abstract property handling in working copy library

From: Ivan Zhakov <chemodax_at_gmail.com>
Date: 2005-10-25 01:24:12 CEST


Don't be strict with me. Check idea for the first.

For present time property handling in working copy is mess. Many
places in libsvn_wc know about prop files. It copies, moves, updates
timestamp files directly. Even small improvement in libsvn_wc causes
problems and "dancing with tambourine" . Wc-replacements branch for
example and planned wc-propcaching branch. And tasks such Daniel
Berlin's idea use sqlite for storing props cannot be implemented.

I propose to introduce lightweight API for props operations. I have
called it "propdb".

/* Kind of prop hashes maintained for each item. */

/* Accesing props */

/** Set *HASH to a hash table mapping <tt>char *</tt> names onto
 * <tt>svn_string_t *</tt> values for all the KIND properties of
 * PATH. Allocate the table, names, and values in POOL. If
 * the node has no properties, an empty hash is returned. ADM_ACCESS
 * is an access baton set that contains PATH.
svn_wc__propdb_get_list (apr_hash_t **hash,
                         svn_wc_propdb_kind_t kind,
                         const char *path,
                         svn_wc_adm_access_t *adm_access,
                         apr_pool_t *pool);

/* Get a single prop NAME for versioned object PATH, return in
   *VALUE. ADM_ACCESS is an access baton set that contains PATH. */
svn_wc__propdb_get_one (const svn_string_t **value,
                         const char *name,
                         prop_kind, path,
                         svn_wc_adm_access_t *adm_access,
                         apr_pool_t *pool);

/* Sets PROPCHANGES to difference between KIND_1 and KIND_2
 * properties of PATH. *HASH1 and HASH2 will be set coresponding
 * properties if non zero. */
svn_wc__propdb_diff (apr_array_header_t **propchanges,
                         apr_hash_t **hash_1,
                         svn_wc_propdb_kind_t kind_1,
                         apr_hash_t **hash_2,
                         svn_wc_propdb_kind_t kind_2,
                         const char *path,
                         svn_wc_adm_acces_t *adm_access,
                         apr_pool_t *pool);

/** Set *MODIFIED to non-zero if PATH properties are modified
 * with regard to the base props, else set MODIFIED to zero.
 * ADM_ACCESS must be an access baton for PATH.
svn_wc__propdb_modified (svn_boolean_t *modified,
                         const char *path,
                         svn_wc_adm_access_t *adm_access,
                         apr_pool_t *pool);

/* Write props */

/* Given a HASH full of property name/values, set it for file
   PATH and PROP_KIND */
svn_wc__propdb_set_list (apr_hash_t **hash,
                         svn_wc_propdb_kind_t prop_kind,
                         const char *path,
                         svn_wc_adm_access_t *adm_access,
                         apr_pool_t *pool);

/* Set a single prop NAME to VALUE for versioned object PATH.
   If VALUE is null, remove property NAME. ADM_ACCESS is an access
   baton set that contains PATH. */
svn_wc__propdb_set_one (const svn_string_t *value,
                         const char *name,
                         svn_wc_propdb_kind_t prop_kind,
                         const char *path,
                         svn_wc_adm_access_t *adm_access,
                         apr_pool_t *pool);

/* Adminstrative. */
/* Cleanup prop files for PATH */
svn_wc__propdb_cleanup (const char *path,
                        svn_wc_adm_access_t *adm_access,
                        apr_pool_t *pool);

As you see it don't have loggy. It is part of idea. Each operation
atomic, but atomicity of operations group should be implemented out of
"propdb" API using two new log commands:
1. set-prop-list
Reads props hash from passed temporary file then calls
svn_wc__propdb_set_list() with read props and recorded arguments.

2. set-one-prop
Calls svn_wc__propdb_set_one() with recorded arguments.

Performance Payoff
There is no copy and move operation. Therefore we cannot revert props
in one operation. We should read base props, then write it to
temporary file and then log operation to set new working props from
temporary file.

PS: Thank you for your patience and sorry for my english.

Ivan Zhakov
Received on Tue Oct 25 01:25:30 2005

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.