[RFC] Repository.get_file_texts API and planning for it
Robert Collins
robertc at robertcollins.net
Wed Aug 15 01:51:31 BST 2007
Aaron and I chatted on IRC earlier today. We'd like to add an interface
which will extract a number of file texts from a repository in whatever
manner is best for that repository, calling back to a tree transform (or
possibly a callback ?) for each text.
This lets the repository optimise access. For instance, an RPC based
repository like RemoteRepository might ask for a stream of texts. A knit
based one might group all the texts with the same disk hash prefix to
maximise locality of reference. And a pack based one will group readvs
to do single passes over each pack (as much as possible).
This needs changes to Repository - adding the new method (we need a good
name - its not a regular getter, because it calls back with the text, or
the text lines, or a file object - we should decide what is least
friction here too).
And code like checkout, merge, revert will need to learn about it.
the proposed signature is:
def FOO(self, requestor, file_details):
"""Extract a number of historyical file texts.
:param requestor: An object which offers a create_file method which
will be called for each element of file_details, though not
necessarily in the order supplied. The create_file method has
the signature (callback_data, bytes).
:param file_details: An iterable containing tuples
(text_key, callback_data). text_key is a (file_id, revision_id)
tuple, and callback_data is opaque to this function and simply
serves to identify the file to the requestor.
"""
I propose that I will write up an implementation for our generic
repository asap, and Aaron do the tree-transform related changes,
because I'll be writing the pack based version anyhow, I may as well do
both the generic and specialised versions.
-Rob
--
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070815/435be438/attachment.pgp
More information about the bazaar
mailing list