Part of lp.codehosting.vfs
The way Launchpad presents branches is very different from the way it stores them. Externally, branches are reached using URLs that look like <schema>://launchpad.net/~owner/product/branch-name. Internally, they are stored by branch ID. Branch 1 is stored at 00/00/00/01 and branch 10 is stored at 00/00/00/0A. Further, these branches might not be stored on the same physical machine.
This means that our services need to translate the external paths into internal paths.
We also want to let users create new branches on Launchpad simply by pushing them up.
This means our services must detect events like 'make directory' and 'unlock branch' and translate them into Launchpad operations like 'create branch' and 'request mirror' before performing those operations.
So, we have a LaunchpadServer
which implements the core operations --
translate a path, make a branch and request a mirror -- in terms of virtual
paths.
This server does most of its work by querying an XML-RPC server that provides
the IBranchFileSystem
interface and passing what that returns to a
ITransportDispatch
object.
We hook the LaunchpadServer
into Bazaar by implementing a
AsyncVirtualTransport
, a bzrlib.transport.Transport
that wraps all of its
operations so that they are translated by an object that implements
translateVirtualPath
. See transport.py for more information.
This virtual transport isn't quite enough, since it only does dumb path
translation. We also need to be able to interpret filesystem events in terms
of Launchpad branches. To do this, we provide a LaunchpadTransport
that
hooks into operations like mkdir
and ask the LaunchpadServer
to make a
branch if appropriate.
Class | NotABranchPath | Raised when we cannot translate a virtual URL fragment to a branch. |
Class | UnknownTransportType | Raised when we don't know the transport type. |
Function | get_path_segments | Break up the given path into segments. |
Function | is_lock_directory | Is 'absolute_path' a Bazaar branch lock directory? |
Function | get_real_branch_path | Return the on-disk location of a branch. |
Interface | ITransportDispatch | Turns descriptions of transports into transports. |
Class | BranchTransportDispatch | Turns BRANCH_TRANSPORT tuples into transports that point to branches. |
Class | TransportDispatch | Make transports for hosted branch areas and virtual control dirs. |
Class | LaunchpadInternalServer | Server for Launchpad internal services. |
Class | DirectDatabaseLaunchpadServer | No class docstring; 2/4 methods documented |
Class | _BaseLaunchpadServer | Bazaar Server for translating Lanuchpad paths via XML-RPC. |