Function pravega_controller_client::paginator::list_streams
source · pub fn list_streams(
scope: Scope,
client: &dyn ControllerClient
) -> impl Stream<Item = Result<ScopedStream, RetryError<ControllerError>>> + '_
Expand description
Helper method to iterated over the all the Pravega streams under the provided Scope. This method returns a stream of values,Pravega streams, produced asynchronously.
The below snippets show case the example uses. Sample 1:
use pravega_client_shared::Scope;
use pravega_client_shared::ScopedStream;
use futures::future;
use futures::stream::StreamExt;
use pravega_controller_client::paginator::list_streams;
let stream = list_streams(
Scope {
name: "testScope".to_string(),
},
controller_client,
);
// collect all the Streams in a single vector
let stream_list:Vec<ScopedStream> = stream.map(|str| str.unwrap()).collect::<Vec<ScopedStream>>().await;
Sample 2:
use pravega_client_shared::Scope;
use pravega_client_shared::ScopedStream;
use futures::future;
use futures::stream::StreamExt;
use pravega_controller_client::paginator::list_streams;
let stream = list_streams(
Scope {
name: "testScope".to_string(),
},
controller_client,
);
futures::pin_mut!(stream);
let pravega_stream_1 = stream.next().await;
let pravega_stream_2 = stream.next().await;
// A None is returned at the end of the stream.