l.s.l.i.c.IFileUploadClient(Interface) : interface documentation

Part of lp.services.librarian.interfaces.client View In Hierarchy

Known subclasses: lp.services.librarian.interfaces.client.ILibrarianClient

Upload API for the Librarian client.
Method addFile Add a file to the librarian.
Method remoteAddFile Add a file to the librarian using the remote protocol.
def addFile(name, size, file, contentType, expires=None):
Add a file to the librarian.

Database insertions are done by the client, so access to the LibraryFileAlias and LibraryFileContent objects is available immediately. However, the newly uploaded file cannot be retrieved from the Librarian until the client transaction has been committed.

Returns the id of the newly added LibraryFileAlias

ParametersnameName to store the file as.
sizeSize of the file.
fileFile-like object with the content in it.
expiresExpiry time of file, or None to keep until unreferenced.
RaisesUploadFailedIf the server rejects the upload for some reason
def remoteAddFile(name, size, file, contentType, expires=None):
Add a file to the librarian using the remote protocol.

As per addFile, except that the database insertions are done by the librarian. This means that the corresponding rows in the LibraryFileAlias and LibraryFileContent tables will not be available until the client transaction has been committed. However, the data is retrievable from the Librarian even if the client transaction rolls back.

This method is used to ensure files get placed into the Librarian even when the current transaction may be rolled back (eg. for storing exception information in the Librarian), or when the client does not have a database connection (eg. untrusted code).

Returns the URL of the newly added file.

API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.