OpenQuizz
Une application de gestion des contenus pédagogiques
PackedDB Class Reference
Inheritance diagram for PackedDB:
Collaboration diagram for PackedDB:

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)
 
- Public Member Functions inherited from FileDBBase
def root_path (self)
 
def db_path (self, rela_path)
 
- Public Member Functions inherited from ObjectDBR
def __contains__ (self, sha)
 
- Public Member Functions inherited from LazyMixin
def __getattr__ (self, attr)
 

Detailed Description

A database operating on a set of object packs

Constructor & Destructor Documentation

◆ __init__()

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.

Member Function Documentation

◆ entities()

def entities (   self)
:return: list of pack entities operated upon by this database

◆ has_object()

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.

◆ info()

def info (   self,
  sha 
)
:return: OInfo instance
:param sha: bytes binary sha
:raise BadObject:

Reimplemented from ObjectDBR.

◆ partial_to_complete_sha()

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: 

◆ sha_iter()

def sha_iter (   self)
Return iterator yielding 20 byte shas for all objects in this data base

Reimplemented from ObjectDBR.

◆ size()

def size (   self)
:return: amount of objects in this database

Reimplemented from ObjectDBR.

◆ store()

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

◆ stream()

def stream (   self,
  sha 
)
:return: OStream instance
:param sha: 20 bytes binary sha
:raise BadObject:

Reimplemented from ObjectDBR.

◆ update_cache()

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.


The documentation for this class was generated from the following file: