Deprecating svn_fs_id_t
From: Stefan Fuhrmann <stefan.fuhrmann_at_wandisco.com>
Date: Sun, 22 Dec 2013 13:56:06 +0100
For some time now, this thing has been a nuisance to me
Why
---
svn_fs_id_t is ill-conceived and unnecessary concept with
an under-developed API:
* Ill-conceived - as this is not used as an ID / key to
anything in the rest of the API. The API looks like
get_infoA(root, path)
get_infoB(root, path)
instead of
get_ID(root, path)
get_infoA(id)
get_infoB(id)
So, we rather exposed an implementation detail and had
to deprecate svn_fs_parse_id() early on to prevent the
most severe consequences.
* Unnecessary - as it gets in the way instead of actually
contributing to an operation. We use svn_fs_id_t to test
for noderev identity and relationship but all code uses
the following pattern:
id_a = get_ID(rootA, pathA)
id_b = get_ID(rootB, pathB)
compare(id_a, id_b)
Shorter and in keeping with the rest of the API, we should
simply do
compare(rootA, pathA, rootB, pathB)
There are two more uses. One for "debugging" (svnlook)
which could use a similar private API call. The other
one is as a basis for an optimization and there is an
alternative implementation for that.
* Under-developed - as it does not provide the API that
it could. For instance, it might return a root object
(telling us the txn / rev that the noderev was created in).
There is also no check on the copy id sub-struct that
might answer a question like: refer these noderevs to
the same node with no copy operation in between?
id_a = get_ID(rootA, path)
id_b = get_ID(rootB, path)
if (same_node(id_a, id_b) && same_copy(id_a, id_b))
doIt()
Note that the IDs in this scenario are still derived
from Subversion's versioned file system semantics and
independent from any concrete implementation.
How / what
-----------
* Introduce a root+path based svn_fs_compare and deprecate
svn_fs_compare_ids as well as svn_fs_check_related.
* Deprecate svn_fs_dirent_t and replace it with svn_fs_dirent2_t
containing no ID member. Bump svn_fs_dir_entries API as well.
* Similarly bump svn_fs_path_change2_t plus related API.
* Deprecate svn_fs_unparse_id and svn_fs_node_id. Introduce
svn_fs__unparse_id and svn_fs__node_id as private API for
debugging and tools like svnlook. Also, use these to
implement the deprecated directory and changed path list APIs.
-- Stefan^2.
Received on 2013-12-22 13:57:36 CET
|
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.