pub async fn delete_stream<S: AsRef<str>>(
    connection: &GrpcClient,
    stream: S,
    options: &DeleteStreamOptions,
) -> crate::Result<Option<Position>> {
    let credentials = options
        .credentials
        .clone()
        .or_else(|| connection.default_credentials());

    use streams::delete_req::options::ExpectedStreamRevision;
    use streams::delete_req::Options;
    use streams::delete_resp::PositionOption;

    let expected_stream_revision = match options.version {
        ExpectedRevision::Any => ExpectedStreamRevision::Any(Empty {}),
        ExpectedRevision::NoStream => ExpectedStreamRevision::NoStream(Empty {}),
        ExpectedRevision::StreamExists => ExpectedStreamRevision::StreamExists(Empty {}),
        ExpectedRevision::Exact(rev) => ExpectedStreamRevision::Revision(rev),
    };

    let expected_stream_revision = Some(expected_stream_revision);
    let stream_identifier = Some(StreamIdentifier {
        stream_name: stream.as_ref().to_string().into_bytes(),
    });
    let options = Options {
        stream_identifier,
        expected_stream_revision,
    };

    let mut req = Request::new(streams::DeleteReq {
        options: Some(options),
    });

    configure_auth_req(&mut req, credentials);

    connection
        .execute(|channel| async {
            let mut client = StreamsClient::new(channel.channel);
            let result = client.delete(req).await?.into_inner();

            if let Some(opts) = result.position_option {
                match opts {
                    PositionOption::Position(pos) => {
                        let pos = Position {
                            commit: pos.commit_position,
                            prepare: pos.prepare_position,
                        };

                        Ok(Some(pos))
                    }

                    PositionOption::NoPosition(_) => Ok(None),
                }
            } else {
                Ok(None)
            }
        })
        .await
}
/// Sends asynchronously the delete command to the server.
Sends asynchronously the delete command to the server.
Sends asynchronously the delete command to the server .
pub async fn delete_stream<S: AsRef<str>>(
    connection: &GrpcClient,
    stream: S,
    options: &DeleteStreamOptions,
) -> crate::Result<Option<Position>> {
    let credentials = options
        .credentials
        .clone()
        .or_else(|| connection.default_credentials());
    use streams::delete_req::options::ExpectedStreamRevision;
    use streams::delete_req::Options;
    use streams::delete_resp::PositionOption;
    let expected_stream_revision = match options.version {
        ExpectedRevision::Any => ExpectedStreamRevision::Any(Empty {}),
        ExpectedRevision::NoStream => ExpectedStreamRevision::NoStream(Empty {}),
        ExpectedRevision::StreamExists => ExpectedStreamRevision::StreamExists(Empty {}),
        ExpectedRevision::Exact(rev) => ExpectedStreamRevision::Revision(rev),
    };
    let expected_stream_revision = Some(expected_stream_revision);
    let stream_identifier = Some(StreamIdentifier {
        stream_name: stream.as_ref().to_string().into_bytes(),
    });
    let options = Options {
        stream_identifier,
        expected_stream_revision,
    };
    let mut req = Request::new(streams::DeleteReq {
        options: Some(options),
    });
    configure_auth_req(&mut req, credentials);
    connection
        .execute(|channel| async {
            let mut client = StreamsClient::new(channel.channel);
            let result = client.delete(req).await?.into_inner();
            if let Some(opts) = result.position_option {
                match opts {
                    PositionOption::Position(pos) => {
                        let pos = Position {
                            commit: pos.commit_position,
                            prepare: pos.prepare_position,
                        };
                        Ok(Some(pos))
                    }
                    PositionOption::NoPosition(_) => Ok(None),
                }
            } else {
                Ok(None)
            }
        })
        .await
}
pub async fn delete_stream < S : AsRef < str > > ( connection : & GrpcClient , stream : S , options : & DeleteStreamOptions , ) -> crate :: Result < Option < Position > > { let credentials = options . credentials . clone ( ) . or_else ( | | connection . default_credentials ( ) ) ; use streams :: delete_req :: options :: ExpectedStreamRevision ; use streams :: delete_req :: Options ; use streams :: delete_resp :: PositionOption ; let expected_stream_revision = match options . version { ExpectedRevision :: Any => ExpectedStreamRevision :: Any ( Empty { } ) , ExpectedRevision :: NoStream => ExpectedStreamRevision :: NoStream ( Empty { } ) , ExpectedRevision :: StreamExists => ExpectedStreamRevision :: StreamExists ( Empty { } ) , ExpectedRevision :: Exact ( rev ) => ExpectedStreamRevision :: Revision ( rev ) , } ; let expected_stream_revision = Some ( expected_stream_revision ) ; let stream_identifier = Some ( StreamIdentifier { stream_name : stream . as_ref ( ) . to_string ( ) . into_bytes ( ) , } ) ; let options = Options { stream_identifier , expected_stream_revision , } ; let mut req = Request :: new ( streams :: DeleteReq { options : Some ( options ) , } ) ; configure_auth_req ( & mut req , credentials ) ; connection . execute ( | channel | async { let mut client = StreamsClient :: new ( channel . channel ) ; let result = client . delete ( req ) . await ? . into_inner ( ) ; if let Some ( opts ) = result . position_option { match opts { PositionOption :: Position ( pos ) => { let pos = Position { commit : pos . commit_position , prepare : pos . prepare_position , } ; Ok ( Some ( pos ) ) } PositionOption :: NoPosition ( _ ) => Ok ( None ) , } } else { Ok ( None ) } } ) . await }
Sends asynchronously the delete command to the server.
Sends asynchronously the delete command to the server .
connection
&GrpcClient
stream
S
options
&DeleteStreamOptions
connection
&GrpcClient
stream
S
options
&DeleteStreamOptions