Nous.Workflow.Scratch (nous v0.16.0)
View SourceOptional per-workflow ETS table for large/binary data exchange between steps.
Use when workflow steps produce large data (fetched HTML, images, CSVs) that shouldn't be copied through the immutable state pipeline. The scratch table is created lazily and auto-cleaned on workflow completion.
Usage
Enable via scratch: true option when running a workflow:
{:ok, state} = Nous.Workflow.run(graph, %{}, scratch: true)Inside a transform or handler:
# Write large data
Nous.Workflow.Scratch.put(scratch, :raw_html, large_binary)
# Read it later
html = Nous.Workflow.Scratch.get(scratch, :raw_html)The scratch reference is available in state.metadata.scratch.
Summary
Functions
Clean up the scratch ETS table. Called automatically on workflow completion.
Delete a key from the scratch space.
Retrieve a value from the scratch space.
Create a new scratch space (lazily — ETS table created on first write).
Store a value in the scratch space.
Types
Functions
@spec cleanup(t()) :: :ok
Clean up the scratch ETS table. Called automatically on workflow completion.
Delete a key from the scratch space.
Retrieve a value from the scratch space.
@spec new() :: t()
Create a new scratch space (lazily — ETS table created on first write).
Store a value in the scratch space.