|
rogue
|
Memory transaction container passed between master and slave. More...
#include <Transaction.h>
Public Types | |
| typedef uint8_t * | iterator |
| Iterator alias for transaction byte access. | |
Public Member Functions | |
| Transaction (struct timeval timeout) | |
| Constructs a transaction container. | |
| ~Transaction () | |
| Destroy object. | |
| std::shared_ptr< rogue::interfaces::memory::TransactionLock > | lock () |
| Locks the transaction and returns a lock wrapper. | |
| bool | expired () |
| Returns whether this transaction has expired. | |
| uint32_t | id () |
| Returns the transaction ID. | |
| uint64_t | address () |
| Returns the transaction address. | |
| uint32_t | size () |
| Returns the transaction size. | |
| uint32_t | type () |
| Returns the transaction type constant. | |
| std::shared_ptr< rogue::interfaces::memory::Transaction > | createSubTransaction () |
| Creates a subtransaction linked to this parent transaction. | |
| void | doneSubTransactions () |
| Marks subtransaction creation as complete for this transaction. | |
| void | refreshTimer (std::shared_ptr< rogue::interfaces::memory::Transaction > reference) |
| Refreshes the transaction timer. | |
| void | done () |
| Marks transaction completion without error. | |
| void | errorStr (std::string error) |
| Marks transaction completion with an error string (Python interface). | |
| void | error (const char *fmt,...) |
| Marks transaction completion with a formatted C-string error. | |
| uint8_t * | begin () |
| Returns iterator to the beginning of transaction data. | |
| uint8_t * | end () |
| Returns iterator to the end of transaction data. | |
| void | getData (boost::python::object p, uint32_t offset) |
| Copies transaction data into a Python byte-array-like object. | |
| void | setData (boost::python::object p, uint32_t offset) |
| Copies data from a Python byte-array-like object into the transaction. | |
Public Member Functions inherited from rogue::EnableSharedFromThis< rogue::interfaces::memory::Transaction > | |
| std::shared_ptr< rogue::interfaces::memory::Transaction > | shared_from_this () |
Returns a shared_ptr<T> for this instance. | |
Public Member Functions inherited from rogue::EnableSharedFromThisBase | |
| virtual | ~EnableSharedFromThisBase () |
| Virtual destructor for polymorphic base usage. | |
Static Public Member Functions | |
| static void | setup_python () |
Protected Member Functions | |
| std::string | wait () |
| Wait for the transaction to complete. | |
| void | subTransactionDone (uint32_t subId, const std::string &subError) |
| Records completion of one sub-transaction. | |
Static Protected Member Functions | |
| static std::shared_ptr< rogue::interfaces::memory::Transaction > | create (struct timeval timeout) |
| Creates a transaction container. | |
Protected Attributes | |
| struct timeval | timeout_ |
| struct timeval | endTime_ |
| struct timeval | startTime_ |
| struct timeval | warnTime_ |
| Py_buffer | pyBuf_ |
| bool | pyValid_ |
| iterator | iter_ |
| uint64_t | address_ |
| uint32_t | size_ |
| uint32_t | type_ |
| std::string | error_ |
| uint32_t | id_ |
| bool | done_ |
| std::mutex | lock_ |
| TransactionMap | subTranMap_ |
| bool | doneCreatingSubTransactions_ |
| std::string | subTranError_ |
| bool | isSubTransaction_ |
| std::shared_ptr< rogue::Logging > | log_ |
| std::weak_ptr< rogue::interfaces::memory::Transaction > | parentTransaction_ |
Friends | |
| class | TransactionLock |
| class | Master |
| class | Hub |
Memory transaction container passed between master and slave.
Encapsulates a single memory operation request and completion state while it moves between Master and Slave layers.
Lifecycle and ownership:
Master; callers do not construct them directly.TransactionLock.done() or error*() and may be observed by wait logic.Timeout and completion behavior:
Subtransaction behavior:
subTranMap_ and completes only after all children complete.Python integration:
id(), address(), size(), type(), and expired() are exposed to Python bindings. Definition at line 79 of file Transaction.h.
| typedef uint8_t* rogue::interfaces::memory::Transaction::iterator |
Iterator alias for transaction byte access.
Definition at line 86 of file Transaction.h.
|
explicit |
Constructs a transaction container.
Create object.
This constructor is a low-level C++ allocation path. Prefer create() for normal transaction lifecycle management. Do not call this constructor directly in normal use; transactions are expected to be created by Master through the internal create() path. That path ensures consistent ownership and integration with transaction request/wait bookkeeping.
| timeout | Initial timeout value copied into this transaction. |
Definition at line 72 of file Transaction.cpp.
| rogue::interfaces::memory::Transaction::~Transaction | ( | ) |
Destroy object.
Definition at line 102 of file Transaction.cpp.
| uint64_t rogue::interfaces::memory::Transaction::address | ( | ) |
Returns the transaction address.
Get address.
Exposed as address() in Python.
Definition at line 130 of file Transaction.cpp.
| rogue::interfaces::memory::Transaction::iterator rogue::interfaces::memory::Transaction::begin | ( | ) |
Returns iterator to the beginning of transaction data.
start iterator, caller must lock around access
Not exposed to Python. Lock must be held before calling this method and while updating transaction data.
Definition at line 305 of file Transaction.cpp.
|
staticprotected |
Creates a transaction container.
Create a master container.
Private/internal factory used by Master to allocate transaction instances with shared ownership and lifecycle tracking. Parameter semantics are identical to the constructor; see Transaction(). This static factory is the preferred construction path when shared ownership is required across asynchronous request/response paths.
Definition at line 50 of file Transaction.cpp.
| rogue::interfaces::memory::TransactionPtr rogue::interfaces::memory::Transaction::createSubTransaction | ( | ) |
Creates a subtransaction linked to this parent transaction.
Create a subtransaction.
Definition at line 145 of file Transaction.cpp.
| void rogue::interfaces::memory::Transaction::done | ( | ) |
Marks transaction completion without error.
Complete transaction without error, lock must be held.
The transaction lock must be held before calling this method. Exposed as done() in Python.
Definition at line 162 of file Transaction.cpp.
| void rogue::interfaces::memory::Transaction::doneSubTransactions | ( | ) |
Marks subtransaction creation as complete for this transaction.
Definition at line 157 of file Transaction.cpp.
| rogue::interfaces::memory::Transaction::iterator rogue::interfaces::memory::Transaction::end | ( | ) |
Returns iterator to the end of transaction data.
end iterator, caller must lock around access
Not exposed to Python. Lock must be held before calling this method and while updating transaction data.
Definition at line 311 of file Transaction.cpp.
| void rogue::interfaces::memory::Transaction::error | ( | const char * | fmt, |
| ... | |||
| ) |
Marks transaction completion with a formatted C-string error.
Complete transaction with passed error, lock must be held.
The transaction lock must be held before calling this method.
Definition at line 226 of file Transaction.cpp.
| void rogue::interfaces::memory::Transaction::errorStr | ( | std::string | error | ) |
Marks transaction completion with an error string (Python interface).
Complete transaction with passed error, lock must be held.
The transaction lock must be held before calling this method. Exposed as error() in Python.
| error | Transaction error message. |
Definition at line 181 of file Transaction.cpp.
| bool rogue::interfaces::memory::Transaction::expired | ( | ) |
Returns whether this transaction has expired.
Get expired state.
Expiration is set by Master when timeout occurs and no further waiting is performed. The lock must be held before checking expiration state. Exposed as expired() in Python.
true if transaction is expired; otherwise false. Definition at line 110 of file Transaction.cpp.
| void rogue::interfaces::memory::Transaction::getData | ( | boost::python::object | p, |
| uint32_t | offset | ||
| ) |
Copies transaction data into a Python byte-array-like object.
Get transaction data from python.
Exposed to Python as getData(). The copy size is defined by the provided destination buffer size.
| p | Python byte-array-like destination object. |
| offset | Offset for transaction data access. |
Definition at line 342 of file Transaction.cpp.
| uint32_t rogue::interfaces::memory::Transaction::id | ( | ) |
Returns the transaction ID.
Get id.
Exposed as id() in Python.
Definition at line 125 of file Transaction.cpp.
| rogue::interfaces::memory::TransactionLockPtr rogue::interfaces::memory::Transaction::lock | ( | ) |
Locks the transaction and returns a lock wrapper.
Get lock.
Exposed as lock() in Python.
Definition at line 105 of file Transaction.cpp.
| void rogue::interfaces::memory::Transaction::refreshTimer | ( | std::shared_ptr< rogue::interfaces::memory::Transaction > | reference | ) |
Refreshes the transaction timer.
Refresh the timer.
Timer is refreshed when reference is null or when this transaction start time is later than the reference transaction start time. Not exposed to Python.
| reference | Reference transaction. |
Definition at line 277 of file Transaction.cpp.
| void rogue::interfaces::memory::Transaction::setData | ( | boost::python::object | p, |
| uint32_t | offset | ||
| ) |
Copies data from a Python byte-array-like object into the transaction.
Set transaction data from python.
Exposed to Python as setData(). The copy size is defined by the provided source buffer size.
| p | Python byte-array-like source object. |
| offset | Offset for transaction data access. |
Definition at line 319 of file Transaction.cpp.
|
static |
Definition at line 55 of file Transaction.cpp.
| uint32_t rogue::interfaces::memory::Transaction::size | ( | ) |
Returns the transaction size.
Get size.
Exposed as size() in Python.
Definition at line 135 of file Transaction.cpp.
|
protected |
Records completion of one sub-transaction.
Record completion of a sub-transaction, called with the child's lock held.
Removes the child from the pending map and retains its error, if any. The parent completes only after every child has finished, so a caller cannot release the shared buffer while other children still access it. The parent reports an error when any child failed.
| subId | Identifier of the completed sub-transaction. |
| subError | Sub-transaction error string, empty on success. |
Definition at line 203 of file Transaction.cpp.
| uint32_t rogue::interfaces::memory::Transaction::type | ( | ) |
Returns the transaction type constant.
Get type.
Type values are defined in rogue/interfaces/memory/Constants.h, including:
rogue::interfaces::memory::Readrogue::interfaces::memory::Writerogue::interfaces::memory::Postrogue::interfaces::memory::VerifyExposed as type() in Python.
Definition at line 140 of file Transaction.cpp.
|
protected |
Wait for the transaction to complete.
Definition at line 238 of file Transaction.cpp.
|
friend |
Definition at line 82 of file Transaction.h.
|
friend |
Definition at line 81 of file Transaction.h.
|
friend |
Definition at line 80 of file Transaction.h.
|
protected |
Definition at line 123 of file Transaction.h.
|
protected |
Definition at line 138 of file Transaction.h.
|
protected |
Definition at line 147 of file Transaction.h.
|
protected |
Definition at line 103 of file Transaction.h.
|
protected |
Definition at line 132 of file Transaction.h.
|
protected |
Definition at line 135 of file Transaction.h.
|
protected |
Definition at line 153 of file Transaction.h.
|
protected |
Definition at line 120 of file Transaction.h.
|
protected |
Definition at line 141 of file Transaction.h.
|
protected |
Logger for transaction activity.
Definition at line 156 of file Transaction.h.
|
protected |
Definition at line 159 of file Transaction.h.
|
protected |
Definition at line 113 of file Transaction.h.
|
protected |
Definition at line 117 of file Transaction.h.
|
protected |
Definition at line 126 of file Transaction.h.
|
protected |
Definition at line 106 of file Transaction.h.
|
protected |
Definition at line 150 of file Transaction.h.
|
protected |
Definition at line 144 of file Transaction.h.
|
protected |
Definition at line 100 of file Transaction.h.
|
protected |
Definition at line 129 of file Transaction.h.
|
protected |
Definition at line 109 of file Transaction.h.