feat: Add SharedValueSeries and PipelineNode

Introduces `SharedValueSeries` for read-only access to generic `Value`
buffers, and `PipelineNode` which combines an `ObservableStream` with a
`Series` view. This is a foundational step for implementing the `pipe`
operator.
This commit is contained in:
Michael Schimmel
2026-03-01 23:12:09 +01:00
parent 2579e2b1fd
commit b177aa8854
3 changed files with 138 additions and 9 deletions
+30
View File
@@ -386,6 +386,36 @@ impl<T: ScalarValue> crate::ast::types::Series for SharedSeries<T> {
}
}
/// A read-only series for generic Values that shares its buffer with the pipeline.
#[derive(Clone)]
pub struct SharedValueSeries {
pub buffer: Rc<std::cell::RefCell<RingBuffer<Value>>>,
}
impl Debug for SharedValueSeries {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "SharedValueSeries[len: {}]", self.buffer.borrow().len())
}
}
impl Object for SharedValueSeries {
fn type_name(&self) -> &'static str {
"SharedValueSeries"
}
fn as_any(&self) -> &dyn Any {
self
}
fn as_series(&self) -> Option<&dyn crate::ast::types::Series> {
Some(self)
}
}
impl crate::ast::types::Series for SharedValueSeries {
fn get_item(&self, index: usize) -> Option<Value> {
self.buffer.borrow().get(index).cloned()
}
}
/// A read-only series for Records that shares its buffers with the pipeline.
#[derive(Clone)]
pub struct SharedRecordSeries {