OpenQuizz
Une application de gestion des contenus pédagogiques
|
Public Member Functions | |
def | __init__ (self) |
def | set_ostream (self, stream) |
def | store (self, istream) |
def | has_object (self, sha) |
def | info (self, sha) |
def | stream (self, sha) |
def | size (self) |
def | sha_iter (self) |
def | stream_copy (self, sha_iter, odb) |
![]() | |
def | __contains__ (self, sha) |
![]() | |
def | __init__ (self, *args, **kwargs) |
def | ostream (self) |
A memory database stores everything to memory, providing fast IO and object retrieval. It should be used to buffer results and obtain SHAs before writing it to the actual physical storage, as it allows to query whether object already exists in the target storage before introducing actual IO
def __init__ | ( | self | ) |
def has_object | ( | self, | |
sha | |||
) |
:return: True if the object identified by the given 20 bytes binary sha is contained in the database
Reimplemented from ObjectDBR.
def info | ( | self, | |
sha | |||
) |
:return: OInfo instance :param sha: bytes binary sha :raise BadObject:
Reimplemented from ObjectDBR.
def set_ostream | ( | self, | |
stream | |||
) |
Adjusts the stream to which all data should be sent when storing new objects :param stream: if not None, the stream to use, if None the default stream will be used. :return: previously installed stream, or None if there was no override :raise TypeError: if the stream doesn't have the supported functionality
Reimplemented from ObjectDBW.
def sha_iter | ( | self | ) |
Return iterator yielding 20 byte shas for all objects in this data base
Reimplemented from ObjectDBR.
def size | ( | self | ) |
:return: amount of objects in this database
Reimplemented from ObjectDBR.
def store | ( | self, | |
istream | |||
) |
Create a new object in the database :return: the input istream object with its sha set to its corresponding value :param istream: IStream compatible instance. If its sha is already set to a value, the object will just be stored in the our database format, in which case the input stream is expected to be in object format ( header + contents ). :raise IOError: if data could not be written
Reimplemented from ObjectDBW.
def stream | ( | self, | |
sha | |||
) |
:return: OStream instance :param sha: 20 bytes binary sha :raise BadObject:
Reimplemented from ObjectDBR.
def stream_copy | ( | self, | |
sha_iter, | |||
odb | |||
) |
Copy the streams as identified by sha's yielded by sha_iter into the given odb The streams will be copied directly **Note:** the object will only be written if it did not exist in the target db :return: amount of streams actually copied into odb. If smaller than the amount of input shas, one or more objects did already exist in odb