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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user