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

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)
 
- Public Member Functions inherited from LazyMixin
def __getattr__ (self, attr)
 

Static Public Attributes

 pack_signature
 
 pack_version_default
 
 first_object_offset
 
 footer_size
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  packpath 
)

Member Function Documentation

◆ checksum()

def checksum (   self)
:return: 20 byte sha1 hash on all object sha's contained in this file

◆ close()

def close (   self)

◆ collect_streams()

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

◆ data()

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

◆ info()

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

◆ path()

def path (   self)
:return: path to the packfile

◆ size()

def size (   self)
:return: The amount of objects stored in this pack

◆ stream()

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

◆ stream_iter()

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

◆ version()

def version (   self)
:return: the version of this pack

Field Documentation

◆ first_object_offset

first_object_offset
static

◆ footer_size

footer_size
static

◆ pack_signature

pack_signature
static

◆ pack_version_default

pack_version_default
static

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