entry module

class pdbstore.store.entry.TransactionEntry(store: Store, file_name: str, file_hash: str, source_file: str | Path, compressed: bool = False)

Bases: object

A SymbolStore transaction entry representation

MAX_COMPRESSED_FILE_SIZE: int = 2147482624
clone(store: Store | None = None, promoted: bool | None = False) TransactionEntry

Clone the transaction entry.

Parameters:

store – Optional Store object to be associated to the cloned entry

Returns:

The cloned TransactionEntry object

commit(force: bool | None = False, store: Store | None = None, skip_if_exists: bool | None = False) bool

Commit transaction entry by storing the required filse into the symbol store.

If store is None, this function will consider as a standard transaction entry, else this function will promote the files referenced by this entry object and stored them in store as a new entry.

Parameters:
  • forceTrue to overwrite any existing file from the store, else False.

  • store – Optional Store object.

  • skip_if_existsTrue to skip entry creation if the file already exists in the store, else False

Returns:

True if the file is stored successfully, else False if the file was alredy present.

Raise:
CabCompressionError:

if an error occurs during compressed file operation

CopyFileError:

if an error occurs during file storage without compression

static create(store: Store, file_path: str | Path) TransactionEntry | None

Create a new transaction entry given store and file path

This function will ceate a new TransactionEntry based on input information. This function assumes that the file is at least present without any compression.

Parameters:
  • store – The associated Store object

  • file_path – The file name for the transaction entry

Returns:

TransactionEntry object if successful, else None on error.

Raise:
FileNotExistsError:

The specified file doesn’t exists

extract(dest_dir: str | Path) str | Path | None

Extract file from store to specific directory.

Parameters:

dest_dir – Path to output directory

Returns:

Path to the output file if successful, else None

Raise:
DecompressionNotSupportedError:

Decompression is not supported

CabCompressionError:

if an error occurs during compressed file operation

CopyFileError:

if an error occurs during file storage without compression

property file_path: Path

Retrieve the original file path.

Returns:

The original file path

get_disk_usage() int

Compute the disk space usage related to this transaction entry

Returns:

The disk space usage in bytes.

is_committed() bool

Determine if this entry has been commit on the disk or not

Returns:

True if this entry is valid/published, else False

is_compressed() bool

Determine if compression activated or not

Returns:

True if compression is enabled, else False

static load(store: Store, file_name: str, file_hash: str, source_file: str | Path) TransactionEntry

Load transaction entry from disk.

Examine files in symbol store directory and create an transaction entry object that represents it.

Parameters:
  • store – The associated SymbolSymbolStore object

  • file_name – The file name for the transaction entry

  • file_hash – The file hash

  • source_file – Full path to the input source file

Returns:

The new TransactionEntry object

property rel_path: Path

Retrieve the relative path to the stored file

Returns:

Relative path name to the stored file

property stored_path: Path

Retrieve the full path to the stored file

Returns:

Full path name to the stored file