|
morph 0.1.0
Asynchronous bridge between GUI thread and business models
|
In-memory implementation of IActionLog, owned by one executor. More...
#include <action_log.hpp>
Public Member Functions | |
| InMemoryActionLog (::morph::exec::IExecutor &owner) | |
Constructs an empty log belonging to owner. | |
| void | append (LogEntry entry) override |
Appends entry, assigning a monotonically increasing seq, on the owner. | |
| void | flush () override |
| No-op — there is no external backend to flush to. Callable anywhere. | |
| std::vector< LogEntry > | entries (std::string_view entityKey={}) const override |
| Returns a snapshot of matching entries in append order. On the owner. | |
| ::morph::exec::IExecutor * | owner () const noexcept override |
| The executor given at construction. | |
| ::morph::async::Completion< std::vector< LogEntry > > | entries (::morph::exec::IExecutor &replyExec, std::string entityKey={}) const |
Returns recorded entries in append order, read on the log's owner and delivered on replyExec. | |
| ::morph::async::Completion< bool > | flush (::morph::exec::IExecutor &replyExec) |
Pushes buffered entries to the durable backend on the log's owner; the answer is delivered on replyExec. | |
| Public Member Functions inherited from morph::journal::IActionLog | |
| ::morph::async::Completion< std::vector< LogEntry > > | entries (::morph::exec::IExecutor &replyExec, std::string entityKey={}) const |
Returns recorded entries in append order, read on the log's owner and delivered on replyExec. | |
| ::morph::async::Completion< bool > | flush (::morph::exec::IExecutor &replyExec) |
Pushes buffered entries to the durable backend on the log's owner; the answer is delivered on replyExec. | |
Protected Member Functions | |
| ::morph::async::Completion< std::vector< LogEntry > > | askEntries (::morph::exec::IExecutor &replyExec, std::string entityKey) const override |
Reads the entries on the owner, delivered on replyExec. | |
| Protected Member Functions inherited from morph::journal::IActionLog | |
| virtual ::morph::async::Completion< bool > | askFlush (::morph::exec::IExecutor &replyExec) |
| What flush(replyExec) asks. The default flushes where it is called, for an implementation with no owner; one with an owner flushes there. | |
In-memory implementation of IActionLog, owned by one executor.
Suitable for testing and for applications that do not need cross-process durability. Mirrors morph::offline::InMemoryOfflineQueue's shape. Dedups append() on a non-empty LogEntry::idempotencyKey — see IActionLog's class docs.
Definition at line 322 of file action_log.hpp.
|
inlineexplicit |
Constructs an empty log belonging to owner.
| owner | The executor every access runs on; must run one task at a time. Borrowed: it must outlive this log and run what it posts. |
Definition at line 330 of file action_log.hpp.
|
inlineoverridevirtual |
Appends entry, assigning a monotonically increasing seq, on the owner.
| entry | Entry to append; seq is overwritten regardless of the input value. |
Implements morph::journal::IActionLog.
Definition at line 336 of file action_log.hpp.
|
inlineoverridevirtual |
No-op — there is no external backend to flush to. Callable anywhere.
Implements morph::journal::IActionLog.
Definition at line 347 of file action_log.hpp.
|
inlinenodiscardoverridevirtual |
Returns a snapshot of matching entries in append order. On the owner.
| entityKey | If non-empty, restricts the result to that entity's entries. |
Implements morph::journal::IActionLog.
Definition at line 352 of file action_log.hpp.
|
inlinenodiscardoverridevirtualnoexcept |
The executor given at construction.
Reimplemented from morph::journal::IActionLog.
Definition at line 358 of file action_log.hpp.
|
inlinenodiscardoverrideprotectedvirtual |
Reads the entries on the owner, delivered on replyExec.
| replyExec | Where the answer is delivered. |
| entityKey | If non-empty, restricts the result to that entity's entries. |
Reimplemented from morph::journal::IActionLog.
Definition at line 365 of file action_log.hpp.
|
inlinenodiscard |
Returns recorded entries in append order, read on the log's owner and delivered on replyExec.
The form for a caller that is not on the owner: a model's strand, an application thread the log does not belong to. The read is ordered after every append() posted to the owner before it.
| replyExec | Where the answer is delivered, and where the caller attaches to it. Borrowed: it must outlive the completion. |
| entityKey | If non-empty, restricts the result to that entity's entries. |
Definition at line 231 of file action_log.hpp.
|
inlinenodiscard |
Pushes buffered entries to the durable backend on the log's owner; the answer is delivered on replyExec.
The form of flush() for a caller that is not on the owner. It is ordered after every append() posted to the owner before it.
| replyExec | Where the answer is delivered. Borrowed: it must outlive the completion. |
Definition at line 245 of file action_log.hpp.