transactions module
Manage a set of transactions.
- class pdbstore.store.transactions.FilesUsage
Bases:
objectManage dictionary with all transactions for each file
- add_entry(entry: TransactionEntry, transaction: Transaction) None
Add a new transaction entry given its associated transaction object
- Parameters:
entry – The transaction entry object to add
transaction – The transaction object associated to
entry
- find_unused_entries(transaction: Transaction) List[Tuple[str, str]]
Determine the list of entries that are not used anymore from a transaction
This function will loop over all registered entries and check how many transactions are associated to each file. When an entry is referenced only once, this function will consider it as unused.
- Parameters:
transaction – A
Transactionobject- Returns:
List of tuple pairs
- class pdbstore.store.transactions.Transactions(store: Store)
Bases:
objectA SymbolStore transactions representation
- add(transaction: Transaction) None
Add new transaction into the server file
- Parameters:
transaction – The transaction object to be added into server file
- Raise:
- WriteFileError:
Failed to update history file
- property count: int
Retrieve the total number of transactions
- Returns:
The total number of registered transactions
- delete(transaction: Transaction, dry_run: bool = False) Summary
Delete a transaction.
- Parameters:
transaction – The transaction 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:
- WriteFileError:
Failed to update history file
- find(transaction_id: str) Transaction | None
Get transaction given by its ID
- Parameters:
transaction_id – The transaction ID to be found
- Returns:
The
Transactionobject found if successful, else None
- get_files_usage() FilesUsage
Build the dictionary of file usage from all registered transactions
- Returns:
A
FilesUsageobject containing all required information
- items() ItemsView[str, Transaction]
Iterate over registered transactions given their ID
- Returns:
Iterator for iterating over all registered transactions.
- reset() None
Reset transactions to an empty dictionary.
- property transactions: Dict[str, Transaction]
Get the Transaction dictionary given by their ID.
If the the server text file will be automatically loaded and parser if not done yet
- Returns:
Dictonary containing the
Transactionobject for a given transaction id.