store module
- class pdbstore.store.store.Store(store_path: str | Path)
Bases:
objectManage symbol store.
- property admin_dir: Path
Retrieve the full path name of 000Admin directory
- check_admin_dir() None
Check that all required directories exists
- commit(transaction: Transaction, force: bool | None = False, store: Store | None = None) Summary
Commit a transaction on the disk.
If
storeis None, this function will consider as a standard transaction, else this function will promote the files referenced bytransactionobject and stored instoreas a new transaction from thisStoreobject.- Parameters:
transaction – The transaction to be committed.
force – If True and a file is already present in the store, the existing file will be overwritten and the file will be associated to
transaction, else this function will only make the associated between the file andtransaction.store – Optional
Storeobject
- Returns:
A
Summaryobject- Raise:
- UnexpectedError:
Failed to create missing directories or update global files
- WriteFileError:
An error occurs when updating a file
- ReadFileError:
Failed to read lastid file
- delete_transaction(transaction_id: str | int, dry_run: bool = False) Summary
Delete an existing transaction given by its id
- Parameters:
transaction_id – The transaction id to be deleted.
dry_run – True to just print the list of files to be deleted, else False to delete the requested transaction.
- Returns:
A
Summaryobject- Raise:
- TransactionNotFoundError:
The specified transition cannot be found.
- ImproperTransactionTypeError:
The specified transition exists but with a different transaction type.
- WriteFileError:
An error occurs when updating global file.
- fetch_symbol(file_path: str | Path) Tuple[Transaction, TransactionEntry] | None
Fetch pdb file given an executable file.
This function will first try to fetch debugging information from file_path pe file. If exists, the function will search for the required pdb file from the store based on extracted information.
- Parameters:
file_path – Path to the pe file
- Returns:
A tuple containing the first transaction if successful, else None. The returned tuple is composed by: * item[0]: The associated
Transactionobject * item[1]: The associatedTransactionEntryobject
- find_entries(file_path: str | Path, full: bool | None = False) List[Tuple[Transaction, TransactionEntry]]
Find a transaction entry given by a file path
Call this function to retrieve the first or all transaction entries associated to file_path
- Parameters:
file_path – Path to the request file
full – True to retrieve all transaction entries associated to file_path, else False to retrieve only the first transaction entry.
- Returns:
A list of associated transaction entries where for each item:
item[0]: The associated
Transactionobjectitem[1]: The associated
TransactionEntryobject
- find_transaction(transaction_id: str | int, transaction_type: TransactionType | None = None) Transaction
Find an existing transaction given by its id
- Parameters:
transaction_id – The transaction id.
transaction_type – Optional transaction type. It can be
add,delorNone.
- Returns:
A
Transactionobject if transaction_id exists, else None- Raise:
- TransactionNotFoundError:
The specified transition cannot be found.
- ImproperTransactionTypeError:
The specified transition exists but with a different transaction type.
- WriteFileError:
An error occurs when updating global file.
- property history_file_path: Path
Retrieve the full path name of history.txt
- iterator(filter_cb: Callable[[Transaction], bool] | None = None) Generator[Tuple[Transaction, TransactionEntry], None, None]
Iterate over all transactions and file entries.
- Parameters:
product – Optional callback function to filter transactions.
- property last_id_file_path: Path
Retrieve the full path name of lastid.txt
- new_transaction(product: str, version: str, comment: str | None = None, transaction_type: TransactionType = TransactionType.ADD) Transaction
Create a new transaction.
- Parameters:
product – The product name
version – The product version
product – The product name
comment – Optional transaction comment
transaction_type – The transaction type. It can be
addordel
- Returns:
The new
Transactionobject
- property next_transaction_id: str
Generate next valid transaction id
- Returns:
The next transaction id
- Raise:
- ReadFileError:
Failed to read lastid file
- UnexpectedError:
Failed to convert read string into an integer
- property pingme_file_path: Path
Retrieve the full path name of pingme.txt
- promote_transaction(transaction: Transaction, comment: str | None = None) Summary
Copy an existing transaction from another store.
This function will clone the
transactionobject, :param transaction: TheTransactionobject to be copied. :return: The newTransactionobject from the store
- remove_old_versions(product: str, version: str, keep: int, comment: str | None = None, dry_run: bool = False) Summary
Remove previous transactions associated to a product name and version
- Parameters:
product – The product name.
version – The product version.
keep – The maximum number of transactions to keep for the same product name and version.
comment – Optional to filter the transactions to be deleted. Ignored if None.
dry_run – True to just print the list of transactions id to be deleted, else False to delete the requested transactions.
- Returns:
A
Summaryobject
- reset() None
Reset to an empty store from memory only.
- property server_file_path: Path
Retrieve the full path name of server.txt