l.c.i.c.ICodehostingAPI(Interface) : interface documentation

Part of lp.code.interfaces.codehosting View In Hierarchy

The codehosting XML-RPC interface to Launchpad.

Published at 'codehosting' on the private XML-RPC server.

The code hosting service and puller use this to register branches, to retrieve information about a user's branches, and to update their status.

Method acquireBranchToPull Return a Branch to pull and mark it as mirror-started.
Method mirrorFailed Notify Launchpad that the branch could not be mirrored.
Method recordSuccess Notify Launchpad that a mirror script has successfully completed.
Method createBranch Register a new hosted branch in Launchpad.
Method requestMirror Mark a branch as needing to be mirrored.
Method branchChanged Record that a branch has been changed.
Method translatePath Translate 'path' so that the codehosting transport can access it.
def acquireBranchToPull(branch_type_names):
Return a Branch to pull and mark it as mirror-started.
Parametersbranch_type_namesOnly consider branches of these type names. An empty list means consider HOSTED, MIRRORED and IMPORTED branches.
ReturnsA 5-tuple:

(branch_id, pull_url, unique_name, default_branch, branch_type)

where:

  • branch_id is the database id of the branch,
  • pull_url is where to pull from,
  • unique_name is the unique_name of the branch,
  • default_branch is the unique name of the default stacked on branch for the branch's target (or '' if there is no such branch), and
  • branch_type is one of 'hosted', 'mirrored', or 'imported'.

or (), the empty tuple, if there is no branch to pull.

def mirrorFailed(branchID, reason):
Notify Launchpad that the branch could not be mirrored.

The mirror_failures counter for the given branch record will be incremented and the next_mirror_time will be set to NULL.

ParametersbranchIDThe database ID of the given branch.
reasonA string giving the reason for the failure.
ReturnsTrue if the branch status was successfully updated. NoBranchWithID fault if there's no branch with the given id.
def recordSuccess(name, hostname, date_started, date_completed):
Notify Launchpad that a mirror script has successfully completed.

Create an entry in the ScriptActivity table with the provided data.

ParametersnameName of the script.
hostnameWhere the script was running.
date_startedWhen the script started, as an UTC time tuple.
date_completedWhen the script completed (now), as an UTC time tuple.
ReturnsTrue if the ScriptActivity record was successfully inserted.
def createBranch(login_id, branch_path):
Register a new hosted branch in Launchpad.

This is called by the bazaar.launchpad.net server when a user pushes a new branch to it. See also https://launchpad.canonical.com/SupermirrorFilesystemHierarchy.

Parameterslogin_idthe person ID of the user creating the branch.
branch_paththe path of the branch to be created. This should be a URL-escaped string representing an absolute path.
Returnsthe ID for the new branch or a Fault if the branch cannot be created.
def requestMirror(loginID, branchID):
Mark a branch as needing to be mirrored.
ParametersloginIDthe person ID of the user requesting the mirror.
branchIDa branch ID.
def branchChanged(login_id, branch_id, stacked_on_url, last_revision_id, control_string, branch_string, repository_string):
Record that a branch has been changed.

See IBranch.branchChanged.

Parameterslogin_idthe person ID of the user changing the branch.
branch_idThe database id of the branch to operate on.
stacked_on_urlThe unique name of the branch this branch is stacked on, or '' if this branch is not stacked.
last_revision_idThe tip revision ID of the branch.
control_stringThe format string of the control directory of the branch.
branch_stringThe format string of the branch.
repository_stringThe format string of the branch's repository.
def translatePath(requester_id, path):
Translate 'path' so that the codehosting transport can access it.
Parametersrequester_idthe database ID of the person requesting the path translation.
paththe path being translated. This should be a URL escaped string representing an absolute path.
Returns(transport_type, transport_parameters, path_in_transport) where 'transport_type' is one of BRANCH_TRANSPORT or CONTROL_TRANSPORT, 'transport_parameters' is a dict of data that the client can use to construct the transport and 'path_in_transport' is a path relative to that transport. e.g. (BRANCH_TRANSPORT, {'id': 3, 'writable': False}, '.bzr/README').
RaisesPathTranslationErrorif 'path' cannot be translated.
InvalidPathif 'path' is known to be invalid.
PermissionDeniedif the requester cannot see the branch.
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.