pub struct PyStreamingFeatherWriter { /* private fields */ }Expand description
Python binding for the Rust FeatherWriter.
This provides a streaming writer of Nautilus objects into feather files with rotation
capabilities, matching the interface of Python’s StreamingFeatherWriter.
Implementations§
Source§impl PyStreamingFeatherWriter
impl PyStreamingFeatherWriter
Sourcepub fn new(
path: String,
cache: PyCache,
clock: PyClock,
fs_protocol: Option<&str>,
fs_storage_options: Option<HashMap<String, String>>,
include_types: Option<Vec<String>>,
rotation_mode: u8,
max_file_size: u64,
rotation_interval_ns: Option<u64>,
rotation_time_ns: Option<u64>,
rotation_timezone: &str,
flush_interval_ms: Option<u64>,
replace: bool,
) -> PyResult<Self>
pub fn new( path: String, cache: PyCache, clock: PyClock, fs_protocol: Option<&str>, fs_storage_options: Option<HashMap<String, String>>, include_types: Option<Vec<String>>, rotation_mode: u8, max_file_size: u64, rotation_interval_ns: Option<u64>, rotation_time_ns: Option<u64>, rotation_timezone: &str, flush_interval_ms: Option<u64>, replace: bool, ) -> PyResult<Self>
Creates a new StreamingFeatherWriter instance.
§Parameters
path: The path to persist the stream to. Must be a directory.cache: The cache for query info (PyCache).clock: The clock to use for time-related operations (PyClock).fs_protocol: Optional filesystem protocol (default: “file”).fs_storage_options: Optional storage options for cloud backends.include_types: Optional list of type names to include (e.g., [“quotes”, “trades”]).rotation_mode: Rotation mode (0=SIZE, 1=INTERVAL, 2=SCHEDULED_DATES, 3=NO_ROTATION).max_file_size: Maximum file size in bytes before rotation (for SIZE mode).rotation_interval_ns: Rotation interval in nanoseconds (for INTERVAL/SCHEDULED_DATES modes).rotation_time_ns: Scheduled rotation time in nanoseconds (for SCHEDULED_DATES mode).flush_interval_ms: Flush interval in milliseconds (default: 1000). Set to 0 to disable auto-flush.replace: If existing files at the given path should be replaced (default: False).
Sourcepub fn subscribe(&mut self) -> PyResult<()>
pub fn subscribe(&mut self) -> PyResult<()>
Subscribes to all messages on the message bus (pattern “*”).
This matches the behavior of Python’s StreamingFeatherWriter when subscribed
via trader.subscribe("*", writer.write).
Sourcepub fn unsubscribe(&mut self) -> PyResult<()>
pub fn unsubscribe(&mut self) -> PyResult<()>
Unsubscribes from the message bus.
Sourcepub fn write(&self, py: Python<'_>, data: Py<PyAny>) -> PyResult<()>
pub fn write(&self, py: Python<'_>, data: Py<PyAny>) -> PyResult<()>
Writes a data object to the stream.
§Parameters
data: The data object to write (must be a Nautilus data type from pyo3).
Sourcepub fn flush(&self) -> PyResult<()>
pub fn flush(&self) -> PyResult<()>
Flushes all active buffers by writing any remaining buffered bytes to the object store.
This is called automatically based on flush_interval_ms if configured, but can also
be called manually by the client.
Sourcepub fn close(&self) -> PyResult<()>
pub fn close(&self) -> PyResult<()>
Closes all writers by flushing and removing them.
After calling this, no further writes should be performed.
Sourcepub fn is_closed(&self) -> bool
pub fn is_closed(&self) -> bool
Returns whether the writer has been closed (no active writers).
Trait Implementations§
Source§impl<'py> IntoPyObject<'py> for PyStreamingFeatherWriter
impl<'py> IntoPyObject<'py> for PyStreamingFeatherWriter
Source§type Target = PyStreamingFeatherWriter
type Target = PyStreamingFeatherWriter
Source§type Output = Bound<'py, <PyStreamingFeatherWriter as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <PyStreamingFeatherWriter as IntoPyObject<'py>>::Target>
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
Source§impl PyClass for PyStreamingFeatherWriter
impl PyClass for PyStreamingFeatherWriter
Source§impl PyClassImpl for PyStreamingFeatherWriter
impl PyClassImpl for PyStreamingFeatherWriter
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§const IS_IMMUTABLE_TYPE: bool = false
const IS_IMMUTABLE_TYPE: bool = false
Source§const RAW_DOC: &'static CStr = /// Python binding for the Rust `FeatherWriter`.
///
/// This provides a streaming writer of Nautilus objects into feather files with rotation
/// capabilities, matching the interface of Python's `StreamingFeatherWriter`.
const RAW_DOC: &'static CStr = /// Python binding for the Rust `FeatherWriter`. /// /// This provides a streaming writer of Nautilus objects into feather files with rotation /// capabilities, matching the interface of Python's `StreamingFeatherWriter`.
Source§const DOC: &'static CStr
const DOC: &'static CStr
text_signature if a constructor is defined. Read moreSource§type Layout = <<PyStreamingFeatherWriter as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<PyStreamingFeatherWriter>
type Layout = <<PyStreamingFeatherWriter as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<PyStreamingFeatherWriter>
Source§type ThreadChecker = ThreadCheckerImpl
type ThreadChecker = ThreadCheckerImpl
type Inventory = Pyo3MethodsInventoryForPyStreamingFeatherWriter
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
§fn dict_offset() -> Option<PyObjectOffset>
fn dict_offset() -> Option<PyObjectOffset>
§fn weaklist_offset() -> Option<PyObjectOffset>
fn weaklist_offset() -> Option<PyObjectOffset>
Source§impl PyClassNewTextSignature for PyStreamingFeatherWriter
impl PyClassNewTextSignature for PyStreamingFeatherWriter
const TEXT_SIGNATURE: &'static str = "(path, cache, clock, fs_protocol=None, fs_storage_options=None, include_types=None, rotation_mode=3, max_file_size=..., rotation_interval_ns=None, rotation_time_ns=None, rotation_timezone=\"UTC\", flush_interval_ms=None, replace=False)"
Source§impl PyStubType for PyStreamingFeatherWriter
impl PyStubType for PyStreamingFeatherWriter
Source§fn type_output() -> TypeInfo
fn type_output() -> TypeInfo
§fn type_input() -> TypeInfo
fn type_input() -> TypeInfo
Source§impl PyTypeInfo for PyStreamingFeatherWriter
impl PyTypeInfo for PyStreamingFeatherWriter
Source§const NAME: &str = <Self as ::pyo3::PyClass>::NAME
const NAME: &str = <Self as ::pyo3::PyClass>::NAME
prefer using ::type_object(py).name() to get the correct runtime value
Source§const MODULE: Option<&str> = <Self as ::pyo3::impl_::pyclass::PyClassImpl>::MODULE
const MODULE: Option<&str> = <Self as ::pyo3::impl_::pyclass::PyClassImpl>::MODULE
prefer using ::type_object(py).module() to get the correct runtime value
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
§fn is_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_type_of(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type or a subclass of this type.§fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type.impl DerefToPyAny for PyStreamingFeatherWriter
impl ExtractPyClassWithClone for PyStreamingFeatherWriter
Auto Trait Implementations§
impl Freeze for PyStreamingFeatherWriter
impl !RefUnwindSafe for PyStreamingFeatherWriter
impl !Send for PyStreamingFeatherWriter
impl !Sync for PyStreamingFeatherWriter
impl Unpin for PyStreamingFeatherWriter
impl UnsafeUnpin for PyStreamingFeatherWriter
impl !UnwindSafe for PyStreamingFeatherWriter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self into an owned Python object, dropping type information.§fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
self into an owned Python object, dropping type information and unbinding it
from the 'py lifetime.§fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
self into a Python object. Read more§impl<'py, T> IntoPyObjectNautilusExt<'py> for Twhere
T: IntoPyObjectExt<'py>,
impl<'py, T> IntoPyObjectNautilusExt<'py> for Twhere
T: IntoPyObjectExt<'py>,
§fn into_py_any_unwrap(self, py: Python<'py>) -> Py<PyAny>
fn into_py_any_unwrap(self, py: Python<'py>) -> Py<PyAny>
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
§const NAME: &'static str = T::NAME
const NAME: &'static str = T::NAME
Use ::classinfo_object() instead and format the type name at runtime. Note that using built-in cast features is often better than manual PyTypeCheck usage.
§fn type_check(object: &Bound<'_, PyAny>) -> bool
fn type_check(object: &Bound<'_, PyAny>) -> bool
§fn classinfo_object(py: Python<'_>) -> Bound<'_, PyAny>
fn classinfo_object(py: Python<'_>) -> Bound<'_, PyAny>
isinstance and issubclass function. Read more