OpenQuizz
Une application de gestion des contenus pédagogiques
|
Public Member Functions | |
def | __init__ (self, packpath) |
def | close (self) |
def | size (self) |
def | version (self) |
def | data (self) |
def | checksum (self) |
def | path (self) |
def | collect_streams (self, offset) |
def | info (self, offset) |
def | stream (self, offset) |
def | stream_iter (self, start_offset=0) |
![]() | |
def | __getattr__ (self, attr) |
Static Public Attributes | |
pack_signature | |
pack_version_default | |
first_object_offset | |
footer_size | |
A pack is a file written according to the Version 2 for git packs As we currently use memory maps, it could be assumed that the maximum size of packs therefor is 32 bit on 32 bit systems. On 64 bit systems, this should be fine though. **Note:** at some point, this might be implemented using streams as well, or streams are an alternate path in the case memory maps cannot be created for some reason - one clearly doesn't want to read 10GB at once in that case
def __init__ | ( | self, | |
packpath | |||
) |
def checksum | ( | self | ) |
:return: 20 byte sha1 hash on all object sha's contained in this file
def close | ( | self | ) |
def collect_streams | ( | self, | |
offset | |||
) |
:return: list of pack streams which are required to build the object at the given offset. The first entry of the list is the object at offset, the last one is either a full object, or a REF_Delta stream. The latter type needs its reference object to be locked up in an ODB to form a valid delta chain. If the object at offset is no delta, the size of the list is 1. :param offset: specifies the first byte of the object within this pack
def data | ( | self | ) |
:return: read-only data of this pack. It provides random access and usually is a memory map. :note: This method is unsafe as it returns a window into a file which might be larger than than the actual window size
def info | ( | self, | |
offset | |||
) |
Retrieve information about the object at the given file-absolute offset :param offset: byte offset :return: OPackInfo instance, the actual type differs depending on the type_id attribute
def path | ( | self | ) |
:return: path to the packfile
def size | ( | self | ) |
:return: The amount of objects stored in this pack
def stream | ( | self, | |
offset | |||
) |
Retrieve an object at the given file-relative offset as stream along with its information :param offset: byte offset :return: OPackStream instance, the actual type differs depending on the type_id attribute
def stream_iter | ( | self, | |
start_offset = 0 |
|||
) |
:return: iterator yielding OPackStream compatible instances, allowing to access the data in the pack directly. :param start_offset: offset to the first object to iterate. If 0, iteration starts at the very first object in the pack. **Note:** Iterating a pack directly is costly as the datastream has to be decompressed to determine the bounds between the objects
def version | ( | self | ) |
:return: the version of this pack
|
static |
|
static |
|
static |
|
static |