|
morph 0.1.0
Asynchronous bridge between GUI thread and business models
|
The table engine: sort, filter and view mapping, on and off the owner. More...
#include <algorithm>#include <chrono>#include <core/async/StopToken.hpp>#include <cstddef>#include <cstdint>#include <exception>#include <expected>#include <functional>#include <limits>#include <memory>#include <morph/core/callback_scope.hpp>#include <morph/core/executor.hpp>#include <morph/core/profiler.hpp>#include <morph/table/data_source.hpp>#include <morph/table/filter.hpp>#include <morph/table/sort.hpp>#include <morph/table/view_change.hpp>#include <numeric>#include <optional>#include <span>#include <string>#include <unordered_map>#include <unordered_set>#include <utility>#include <vector>Go to the source code of this file.
Classes | |
| struct | morph::table::EngineOptions |
| How an engine runs and what it is given. More... | |
| struct | morph::table::EngineStats |
| Counters for tests, benchmarks and profiler plots. More... | |
| class | morph::table::ColumnLayout |
| Column order and visibility, kept apart from the engine's view. More... | |
| struct | morph::table::detail::JobInput |
| Everything one view job reads. Immutable once the job starts. More... | |
| struct | morph::table::detail::JobResult |
| What a finished job hands back to the owner. More... | |
| class | morph::table::detail::ViewJob |
| One recomputation of a view, runnable in steps. More... | |
| class | morph::table::Engine |
| Sorts, filters and maps the view of one table. More... | |
Enumerations | |
| enum class | morph::table::ReorderPolicy : std::uint8_t { Immediate , Deferred } |
| What an updated row that would move does. More... | |
The table engine: sort, filter and view mapping, on and off the owner.
An Engine owns a table's view: the sort chain, the filter, and the mapping between source rows and view rows. It is owner-affine — every member is called on the owner thread — and toolkit-free: a renderer applies the ViewChange it emits as list-model operations.
Execution. Every recomputation is a job over an immutable snapshot of the rows, the key columns it may reuse, and the compiled sort and filter. A job never touches the engine. A small table (below EngineOptions::smallTable rows), or an engine with no owner executor, computes in one step inside the call. Otherwise the job runs on the worker executor, or, with no worker, in frame-budgeted steps posted to the owner; pending() is true until its result is applied on the owner, and the previous view stays visible meanwhile. One job runs at a time: a request that makes the running job's result useless (a new sort, filter or structural change) stops it and its result is dropped; updated rows wait for it and are repaired after.
Changes. Updated rows re-key only themselves and are merged back into the order, once per owner turn however many updates arrived. Inserted, removed and reset rows recompute the view. Work a dropped job had taken (updated rows, rows owed a Changed) is kept for the next one. With ReorderPolicy::Deferred an updated row keeps its place until the view has been quiet for the settle interval, or until its edit ends.
Callbacks. Every handler the engine calls (onViewChange, onPending, onError, the progress sink, the settle scheduler) may call the engine again or destroy it: the engine calls out last, or checks that it is still alive before it goes on.
See docs/spec/table/engine.md.
Definition in file engine.hpp.
|
strong |
What an updated row that would move does.
| Enumerator | |
|---|---|
| Immediate | It moves at once. |
| Deferred | It keeps its place until the view is quiet for settle, or its edit ends. |
Definition at line 70 of file engine.hpp.