l.s.l.d.Library : class documentation

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

Class that encapsulates the database interface for the librarian.
Method __init__ Create a new database access object.
Method lookupBySHA1 Undocumented
Method getAlias Returns a LibraryFileAlias, or raises LookupError.
Method getAliases Undocumented
Method add Undocumented
Method addAlias Add an alias, and return its ID.
Method _verifyMacaroon Verify an LFA-authorising macaroon with the authserver.
def __init__(self, restricted=False):
Create a new database access object.
ParametersrestrictedIf this is set to true, only restricted will be served. Otherwise only public files will be served. Files created in this library will marked as restricted.
def lookupBySHA1(self, digest):
Undocumented
@defer.inlineCallbacks
def _verifyMacaroon(self, macaroon, aliasid):
Verify an LFA-authorising macaroon with the authserver.

This must be called in the reactor thread.

ParametersmacaroonA Macaroon.
aliasidA LibraryFileAlias ID.
ReturnsTrue if the authserver reports that macaroon authorises access to aliasid; False if it reports that it does not.
RaisesFaultif the authserver request fails.
def getAlias(self, aliasid, token, path):
Returns a LibraryFileAlias, or raises LookupError.

A LookupError is raised if no record with the given ID exists or if not related LibraryFileContent exists.

ParametersaliasidA LibraryFileAlias ID.
tokenThe token for the file. If None no token is present. When a token is supplied, it is looked up with path.
pathThe path the request is for, unused unless a token is supplied; when supplied it must match the token. The value of path is expected to be that from a twisted request.args e.g. /foo/bar.
def getAliases(self, fileid):
Undocumented
def add(self, digest, size, md5_digest, sha256_digest):
Undocumented
def addAlias(self, fileid, filename, mimetype, expires=None):
Add an alias, and return its ID.

If a matching alias already exists, it will return that ID instead.

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