Repository navigation
Description
This issue serves as the parent issue for discussing the design of sinks and preservers.
Introduction
The notion of the preserver is prevalent in the Phlex conceptual design report (see the beginning of Chapter 3 and Section 3.8). Until now, the phlex implementation has supported only the concept of declared_outputs, which originates from Meld, Phlex's precursor. This issue describes an initial design for including preservers as part of the workflow graph, as depicted in Fig. 3.1 of the CDR and shown below for reference.
Reminder of providers, sources, and drivers
The graph above suggests an interesting interplay between providers, sources, and drivers. Sources are not explicitly depicted in that graph, but they serve the role of provider "factories", where providers can be implicitly created through a source whenever an explicit provider cannot satisfy the product-selection constraints imposed by a computational node.
In addition, any framework driver can access one or more configured sources, enabling the definition of the "event loop" from the sources themselves.
Where do preservers fit in?
Preservers have, until now, been unrepresented in the phlex implementation. Just like providers, each preserver is intended to preserve data products of one (and only one) data-product specification (e.g., the
This provides the following complementarity:
- Sources are factories for (implicit) providers
- Sinks are factories for (implicit) preservers
Note
It is an open question whether explicit preservers would be useful. I am not certain they would be.
Initial support
For the first release of preservers, I suggest supporting one preserver per producer (transform, fold, unfold). Any data products created by the producer will be included in the phlex::experimental::product_store that is passed to the preserver.
Sink interface
class sink {
public:
virtual ~sink() = default;
virtual preserver_bundle create_preserver(/*<creator-specific information>*/) = 0;
};where the structure of preserver_bundle is not yet defined but will serve as the counterpart to the existing phlex::experimental::provider_bundle.
Preserver interface
A registered preserver function should have the signature
void fcn(phlex::experiment::product_store const&) { ... }Each preserver node's preserver function will only receive product stores from its single upstream producer. This enables the setting of preserver state at preserver-construction time, and repeated invocations of the preserver function can treat that state as immutable.
Eventual support
Eventually, I believe it will be helpful for one preserver to be created per data-product specification. This does introduce some complications for marshaling data-products from the same data cell into a given FORM output container. These issues should be discussed.
Activity
knoepfel commentedon Nov 20, 2026
GPT-6.1 Astra evaluation of terminology
[This evaluation was gently adjusted from analysis by GPT-6.1 Sol]
Context
The output side of
framework_graph, currently represented bydeclared_output, is being redesigned. The terminology should distinguish output destinations from the executable operations that deliver data products to them, and distinguish framework-managed output delivery from observers' user-visible side effects.The proposed relationship is:
This makes
sinka counterpart tosource, rather than a direct rename of the executabledeclared_outputclass.Proposed Vocabulary
Sources and sinks describe where data comes from and goes. Providers and preservers perform the corresponding work. This mirrors the existing separation between a source and its executable provider nodes.
Providers make products available to the framework for processing; preservers make products, or information about them, available at output destinations for subsequent use. These names describe responsibilities rather than mechanisms such as reading and writing.
Why Sink Fits
Sinkis established dataflow terminology for a destination that receives data without producing downstream data within the same graph. For this redesign, its more specific meaning is an output-boundary abstraction:The term does not prescribe a storage backend. A sink could represent a file, an external service, an in-memory collection, or another output destination.
It also reduces the ambiguity of
output. Output products are values produced by algorithms; a sink is a destination receiving those products. The existing.output(...)and.output_product(...)interfaces use the same word for these different concepts.Distinction from Observers
Graph topology alone does not distinguish a preserver from an observer: both can consume data without producing downstream framework products.
The distinction is responsibility:
Both an observer and a preserver might write a file. That implementation detail does not determine their category. What matters is whether the operation is a user algorithm with side effects or part of framework-managed output delivery.
Relationship to the Current Implementation
The current
declared_outputis an executable object, not merely output-declaration metadata. It owns a TBB node, accepts a callback of typevoid(product_store const&), and exposes a receiving port without a framework data-producing port.This makes
preserverthe closer conceptual successor todeclared_output.Sinknames the separate destination abstraction capable of creating those executable operations. The redesign therefore introduces a responsibility split, not just a vocabulary substitution.The current implementation also illustrates why an output destination should not be equated with receiving only final results. The
output_products_test.cpptest expects three output callback invocations for one spill: one store from each of two providers and one from a transform. These are separate deliveries, not one consolidated completed-cell output.These observations describe the existing implementation, not requirements that the redesign must retain. The same test already notes the intended replacement of output nodes with preserver nodes.
Contract Implications
The names alone should not promise:
Those properties belong in the redesigned interfaces and execution contract. A destination can be terminal along its own output branch while receiving intermediate products that remain available to other computations.
Preserverintentionally implies preservation, but preservation does not require persistence. Products, or information about them, may be preserved in a file, an in-memory collection, a queue, or a buffer retained long enough for a downstream process to consume them. Handing products to another system can fulfill this responsibility when it maintains their availability for subsequent use; transmission alone is not the defining responsibility.The duration of availability and any delivery or retention guarantees belong in the execution contract, not the name.
Recommendation
Use
sourceandsinkfor the input and output boundary abstractions, andproviderandpreserverfor the executable operations they can create.Reserve
observerfor user-visible side effects outside the framework-managed output-delivery contract. Continue using output product and output port for the data and interfaces through which algorithms produce results.Under this model,
sinkis a suitable name for the new counterpart tosource;preserveris the closer conceptual successor todeclared_output.