morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
edits.hpp File Reference

Committing edited cells: one row's edits in order, stale and error state per cell, and the row patched with the server's reply. More...

#include <cstddef>
#include <deque>
#include <expected>
#include <functional>
#include <map>
#include <morph/core/callback_scope.hpp>
#include <morph/table/data_source.hpp>
#include <morph/table/engine.hpp>
#include <optional>
#include <string>
#include <string_view>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

struct  morph::table::EditRequest
 One edited cell to commit. More...
struct  morph::table::FieldError
 A server's refusal of an edit, attached to the cell. More...
class  morph::table::CellEdits
 Commits cell edits row by row, in order. More...

Typedefs

using morph::table::EditDone = std::function<void(std::expected<std::vector<Cell>, FieldError>)>
 Settles one commit, on the owner thread: the row as the server returned it, or the field error.
using morph::table::EditCommit = std::function<void(EditRequest const& request, EditDone done)>
 Runs a commit: the table's mutation for request, calling done once with its outcome.

Detailed Description

Committing edited cells: one row's edits in order, stale and error state per cell, and the row patched with the server's reply.

A commit runs an injected function — the table's mutation — and hands it a completion. A success carries the row as the server returned it, which replaces the row through a RowPatcher; a failure carries the field error, which the cell shows. Edits to one row run one at a time, in the order they were committed, so a later edit never overtakes an earlier one. A cell is stale from its commit until its edit settles.

With an engine attached, a row holds its place while it has an edit in flight (Engine::beginEdit), which a Deferred reorder honours.

See docs/spec/table/engine.md.

Definition in file edits.hpp.

Typedef Documentation

◆ EditDone

using morph::table::EditDone = std::function<void(std::expected<std::vector<Cell>, FieldError>)>

Settles one commit, on the owner thread: the row as the server returned it, or the field error.

Definition at line 59 of file edits.hpp.

◆ EditCommit

using morph::table::EditCommit = std::function<void(EditRequest const& request, EditDone done)>

Runs a commit: the table's mutation for request, calling done once with its outcome.

Definition at line 63 of file edits.hpp.