l.s.l.l.FileUploadProtocol(basic.LineReceiver) : class documentation

Part of lp.services.librarianserver.libraryprotocol View In Hierarchy

Simple HTTP-like protocol for file uploads.

A client sends an upload with a request like:

STORE 10000 foo.txt
Optional-Header: value
Optional-Header: value

<....10000 bytes....>

And this server will respond with:

200 1234/5678

Where "1234" is the file id in our system, and "5678" is file alias id.

Recognised headers are:

The File-Content-ID and File-Alias-ID headers are also described in <https://launchpad.canonical.com/LibrarianTransactions>.

Unrecognised headers will be ignored.

If something goes wrong, the server will reply with a 400 (bad request, i.e. client error) or 500 (internal server error) response codes instead, and an appropriate message.

Once the server has replied, the client may re-use the connection as if it were just established to start a new upload.

Unknown Field: content-typea mime-type to associate with the file
Unknown Field: file-content-idif specified, the integer file id for this file. If not specified, the server will generate one.
Unknown Field: file-alias-idif specified, the integer file alias id for this file. If not specified, the server will generate one.
Unknown Field: file-expiresif specified, the expiry time of this alias in ISO 8601 format. As per LibrarianGarbageCollection.
Unknown Field: database-nameif specified, the name of the database the client is connected to. The server will check that this matches, and reject the request if it doesn't.
Method lineReceived Undocumented
Method sendError Sends a correctly formatted error to the client, and closes the
Method unknownError Undocumented
Method translateErrors Errback to translate storage errors to protocol errors.
Method protocolErrors Undocumented
Method badLine Undocumented
Method line_command Undocumented
Method line_header Undocumented
Method badCommand Undocumented
Method command_STORE Undocumented
Method header_content_type Undocumented
Method header_sha1_digest Undocumented
Method header_file_content_id Undocumented
Method header_file_alias_id Undocumented
Method header_file_expires Undocumented
Method header_database_name Undocumented
Method header_debug_id Undocumented
Method rawDataReceived Undocumented
Method logDebugging Undocumented
Method _storeFile Undocumented
def lineReceived(self, line):
Undocumented
def sendError(self, msg, code='400'):
Sends a correctly formatted error to the client, and closes the connection.
def unknownError(self, failure=None):
Undocumented
def translateErrors(self, failure):
Errback to translate storage errors to protocol errors.
def protocolErrors(self, failure):
Undocumented
def badLine(self, line):
Undocumented
def line_command(self, line):
Undocumented
def line_header(self, line):
Undocumented
def badCommand(self, line):
Undocumented
def command_STORE(self, args):
Undocumented
def header_content_type(self, value):
Undocumented
def header_sha1_digest(self, value):
Undocumented
def header_file_content_id(self, value):
Undocumented
def header_file_alias_id(self, value):
Undocumented
def header_file_expires(self, value):
Undocumented
def header_database_name(self, value):
Undocumented
def header_debug_id(self, value):
Undocumented
def rawDataReceived(self, data):
Undocumented
def logDebugging(self, result_or_failure):
Undocumented
def _storeFile(self):
Undocumented
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.