b.s.r.SmartServerRequest(object) : class documentation

Part of bzrlib.smart.request View In Hierarchy

Known subclasses: bzrlib.smart.branch.SmartServerBranchRequest, bzrlib.smart.bzrdir.SmartServerRequestBzrDir, bzrlib.smart.bzrdir.SmartServerRequestInitializeBzrDir, bzrlib.smart.bzrdir.SmartServerRequestOpenBzrDir, bzrlib.smart.bzrdir.SmartServerRequestOpenBzrDir_2_1, bzrlib.smart.repository.SmartServerRepositoryRequest, bzrlib.smart.request.GetBundleRequest, bzrlib.smart.request.HelloRequest, bzrlib.smart.request.SmartServerIsReadonly, bzrlib.smart.vfs.VfsRequest, bzrlib.tests.test_smart_request.CheckJailRequest, bzrlib.tests.test_smart_request.ChunkErrorRequest, bzrlib.tests.test_smart_request.DoErrorRequest, bzrlib.tests.test_smart_request.DoUnexpectedErrorRequest, bzrlib.tests.test_smart_request.EndErrorRequest, bzrlib.tests.test_smart_request.NoBodyRequest

Base class for request handlers.

To define a new request, subclass this class and override the do method (and if appropriate, do_body as well). Request implementors should take care to call translate_client_path and transport_from_client_path as appropriate when dealing with paths received from the client.

Method __init__ Constructor.
Method do Mandatory extension point for SmartServerRequest subclasses.
Method execute Public entry point to execute this request.
Method do_body Called if the client sends a body with the request.
Method do_chunk Called with each body chunk if the request has a streamed body.
Method do_end Called when the end of the request has been received.
Method setup_jail Undocumented
Method teardown_jail Undocumented
Method translate_client_path Translate a path received from a network client into a local
Method transport_from_client_path Get a backing transport corresponding to the location referred to by
Method _check_enabled Raises DisabledMethod if this method is disabled.
def __init__(self, backing_transport, root_client_path='/', jail_root=None):
Constructor.
Parametersbacking_transportthe base transport to be used when performing this request.
root_client_paththe client path that maps to the root of backing_transport. This is used to interpret relpaths received from the client. Clients will not be able to refer to paths above this root. If root_client_path is None, then no translation will be performed on client paths. Default is '/'.
jail_rootif specified, the root of the BzrDir.open jail to use instead of backing_transport.
def _check_enabled(self):
Raises DisabledMethod if this method is disabled.
def do(self, *args):
Mandatory extension point for SmartServerRequest subclasses.

Subclasses must implement this.

This should return a SmartServerResponse if this command expects to receive no body.

def execute(self, *args):
Public entry point to execute this request.

It will return a SmartServerResponse if the command does not expect a body.

Parametersargsthe arguments of the request.
def do_body(self, body_bytes):
Called if the client sends a body with the request.

The do() method is still called, and must have returned None.

Must return a SmartServerResponse.

def do_chunk(self, chunk_bytes):
Called with each body chunk if the request has a streamed body.

The do() method is still called, and must have returned None.

def do_end(self):
Called when the end of the request has been received.
def setup_jail(self):
Undocumented
def teardown_jail(self):
Undocumented
def translate_client_path(self, client_path):
Translate a path received from a network client into a local relpath.

All paths received from the client must be translated.

Parametersclient_paththe path from the client.
Returnsa relpath that may be used with self._backing_transport (unlike the untranslated client_path, which must not be used with the backing transport).
def transport_from_client_path(self, client_path):
Get a backing transport corresponding to the location referred to by a network client.
Returnsa transport cloned from self._backing_transport
See Alsotranslate_client_path
API Documentation for Bazaar, generated by pydoctor at 2019-07-23 00:29:00.