pub struct FileSource { /* private fields */ }Expand description
Source that reads a text file line-by-line.
The file is divided in chunks and is read concurrently by multiple replicas.
Implementations§
Source§impl FileSource
impl FileSource
Sourcepub fn new<P>(path: P) -> Self
pub fn new<P>(path: P) -> Self
Create a new source that reads the lines from a text file.
The file is partitioned into as many chunks as replicas, each replica has to have the same file in the same path. It is guaranteed that each line of the file is emitted by exactly one replica.
Note: the file must be readable and its size must be available. This means that only regular files can be read.
§Example
let source = FileSource::new("/datasets/huge.txt");
let s = env.stream(source);Trait Implementations§
Source§impl Clone for FileSource
impl Clone for FileSource
Source§impl Debug for FileSource
impl Debug for FileSource
Source§impl Display for FileSource
impl Display for FileSource
Source§impl Operator for FileSource
impl Operator for FileSource
type Out = String
Source§fn setup(&mut self, metadata: &mut ExecutionMetadata<'_>)
fn setup(&mut self, metadata: &mut ExecutionMetadata<'_>)
Setup the operator chain. This is called before any call to
next and it’s used to
initialize the operator. When it’s called the operator has already been cloned and it will
never be cloned again. Therefore it’s safe to store replica-specific metadata inside of it. Read moreSource§fn next(&mut self) -> StreamElement<String>
fn next(&mut self) -> StreamElement<String>
Take a value from the previous operator, process it and return it.
Source§fn structure(&self) -> BlockStructure
fn structure(&self) -> BlockStructure
A more refined representation of the operator and its predecessors.
Source§impl Source for FileSource
impl Source for FileSource
Source§fn replication(&self) -> Replication
fn replication(&self) -> Replication
The maximum parallelism offered by this operator.
Auto Trait Implementations§
impl Freeze for FileSource
impl RefUnwindSafe for FileSource
impl Send for FileSource
impl Sync for FileSource
impl Unpin for FileSource
impl UnwindSafe for FileSource
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
fn clone_storage(&self) -> Box<dyn CloneDebuggableStorage>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CloneableStorage for T
impl<T> CloneableStorage for T
fn clone_storage(&self) -> Box<dyn CloneableStorage>
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>
Converts
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>
Converts
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