OpenQuizz
Une application de gestion des contenus pédagogiques
|
Public Member Functions | |
def | __init__ (self, root_path) |
def | has_object (self, sha) |
def | info (self, sha) |
def | stream (self, sha) |
def | sha_iter (self) |
def | size (self) |
def | store (self, istream) |
def | update_cache (self, force=False) |
def | entities (self) |
def | partial_to_complete_sha (self, partial_binsha, canonical_length) |
![]() | |
def | root_path (self) |
def | db_path (self, rela_path) |
![]() | |
def | __contains__ (self, sha) |
![]() | |
def | __getattr__ (self, attr) |
A database operating on a set of object packs
def __init__ | ( | self, | |
root_path | |||
) |
Initialize this instance to look for its files at the given root path All subsequent operations will be relative to this path :raise InvalidDBRoot: **Note:** The base will not perform any accessablity checking as the base might not yet be accessible, but become accessible before the first access.
Reimplemented from FileDBBase.
def entities | ( | self | ) |
:return: list of pack entities operated upon by this database
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 partial_to_complete_sha | ( | self, | |
partial_binsha, | |||
canonical_length | |||
) |
:return: 20 byte sha as inferred by the given partial binary sha :param partial_binsha: binary sha with less than 20 bytes :param canonical_length: length of the corresponding canonical representation. It is required as binary sha's cannot display whether the original hex sha had an odd or even number of characters :raise AmbiguousObjectName: :raise BadObject:
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 | |||
) |
Storing individual objects is not feasible as a pack is designed to hold multiple objects. Writing or rewriting packs for single objects is inefficient
def stream | ( | self, | |
sha | |||
) |
:return: OStream instance :param sha: 20 bytes binary sha :raise BadObject:
Reimplemented from ObjectDBR.
def update_cache | ( | self, | |
force = False |
|||
) |
Update our cache with the acutally existing packs on disk. Add new ones, and remove deleted ones. We keep the unchanged ones :param force: If True, the cache will be updated even though the directory does not appear to have changed according to its modification timestamp. :return: True if the packs have been updated so there is new information, False if there was no change to the pack database
Reimplemented from CachingDB.