Initialization

Before a process is started, make sure all the necessary information is provided.

In function graph, data types in Resources are inserted by the consumer, separate from the graph.

In Peace, Item::setup is run for each item, which allows data types to be inserted into Resources.

let graph = /* .. */;

let resources = graph.setup(Resources::new()).await?;

%3fn1fn1fn3fn3fn1->fn3fn2fn2fn2->fn3fn4fn4fn2->fn4fn3->fn4
// Item1::setup
resources.insert(param1);

// Item2::setup
resources.insert(param2);

// Item3::setup
// no-op

// Item4::setup
resources.insert(param3);
resources.insert(param4);

ℹ️ Note: Each initialization parameter should be specified in each item's setup method, even though the parameter is inserted by a predecessor item.

This is because when only a subset of the graph is executed, or if the item is used in a different graph, the parameter should still be inserted.

🚧 A wrapper type should conditionally insert the initialization parameter into Resources