reifydb-sub-flow 0.10.1

Flow subsystem for stream processing and data flows
Documentation
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2026 ReifyDB

use reifydb_engine::engine::StandardEngine;
use reifydb_flow_async::transaction::substrate::FlowSubstrate;

use crate::progress::output_frontier;

pub struct FlowShutdownState {
	engine: StandardEngine,
	substrate: FlowSubstrate,
}

impl FlowShutdownState {
	pub fn new(engine: StandardEngine, substrate: FlowSubstrate) -> Self {
		Self {
			engine,
			substrate,
		}
	}

	pub fn persist_frontiers(&self) {
		if let Err(e) = output_frontier::try_sweep(self.engine.single(), &self.substrate.frontiers) {
			panic!("flow shutdown could not persist its output frontiers: {e}");
		}
	}
}