Single-keyspace APIs (was Re: RFC: versionedfile overhaul)

Aaron Bentley aaron.bentley at utoronto.ca
Mon Mar 17 12:14:17 GMT 2008


Robert Collins wrote:
> Aaron and I agreed on a cautious first step, which is to change the keys
> used in the VersionedFile interface from strings to tuples of strings;
> this will be used to create a single 'Knit' for the file texts in a
> repository, rather than one knit per file-id (with a key for a single
> text such as (fileid, versionid). Aaron would like to move to a single
> key-space such as ('text', fileid, versionid); however I think this is
> significantly harder to do due to the current index layer (and I'm not
> convinced a single keyspace is really a good idea, but thats a different
> discussion - we are both agreed that a single keyspace for all file
> texts _is_ good).

I think that a single namespace for keys is the right thing.  If we're
going to go through the pain of migrating to new APIs, let's make them
the right APIs so that we don't have to go through more pain later.

Many of our operations require access to multiple datatypes at once:

- fetch requires access to all repository datatypes
- generating a bundle requires access to all repository datatypes
- log -v requires access to revisions, inventories and the revision graph
- status requires access to inventories and revisions and the revision graph
- merge requires access to inventories and files and the revision graph
(and lca merge uses the per-file graph)
- diff requires access to inventories and files
- upgrade requires access to all repository datatypes

If we don't have a single keyspace, we will have, in the worst case, 4x
as many roundtrips as are necessary to perform the operations.

This is API friction, because packs can certainly satisfy the request
using a single roundtrip for all types-- it's our APIs that would
prevent it.

A unified keyspace would mean that every repository record could carry
its unique name.  This would move towards our goal of making indices an
optimization only.

Bundle format 4 uses a unified keyspace, and it has worked out quite
well.  So there's every reason to believe it would work out well for
other pack formats.

So I think the time for a unified keyspace is now.

Aaron



More information about the bazaar mailing list