l.c.c.w.ImportDataStore : class documentation

Part of lp.codehosting.codeimport.worker View In Hierarchy

A store for data associated with an import.

Import workers can store and retreive files into and from the store using put() and fetch().

So this store can find files stored by previous versions of this code, the files are stored at <BRANCH ID IN HEX>.<EXT> where BRANCH ID comes from the CodeImportSourceDetails used to construct the instance and EXT comes from the local name passed to put or fetch.

Method __init__ Initialize an ImportDataStore.
Method fetch Retrieve filename from the store.
Method put Put filename into the store.
Method _getRemoteName Convert local_name to the name used to store a file.
def __init__(self, transport, source_details):
Initialize an ImportDataStore.
ParameterstransportThe transport files will be stored on.
source_detailsThe CodeImportSourceDetails object, used to know where to store files on the remote transport.
def _getRemoteName(self, local_name):
Convert local_name to the name used to store a file.

The algorithm is a little stupid for historical reasons: we chop off the extension and stick that on the end of the branch id from the source_details we were constructed with, in hex padded to 8 characters. For example 'tree.tar.gz' might become '0000a23d.tar.gz' or 'git.db' might become '00003e4.db'.

Parameterslocal_nameThe local name of the file to be stored.
ReturnsThe name to store the file as on the remote transport.
def fetch(self, filename, dest_transport=None):
Retrieve filename from the store.
ParametersfilenameThe name of the file to retrieve (must be a filename, not a path).
dest_transportThe transport to retrieve the file to, defaulting to get_transport_from_path('.').
ReturnsA boolean, true if the file was found and retrieved, false otherwise.
def put(self, filename, source_transport=None):
Put filename into the store.
ParametersfilenameThe name of the file to store (must be a filename, not a path).
source_transportThe transport to look for the file on, defaulting to get_transport('.').
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.