EventStore / EventStoreDB-Client-Rust

Rust EventStoreDB gRPC Client
MIT License
50 stars 13 forks source link

Question: Is there a way to pull how many events are currently on the $all stream? #142

Closed WhaleCoded closed 1 year ago

WhaleCoded commented 2 years ago

I have been able to check how many events are on other streams using the following code.

    let metadata_request_result = client
        .get_stream_metadata(stream_name, &eventstore::ReadStreamOptions::default())
        .await; 

    match metadata_request_result {
        Ok(metadata_result) => match metadata_result {
            eventstore::StreamMetadataResult::Deleted(error) => println! {"The stream was deleted: {}", error},
            eventstore::StreamMetadataResult::NotFound(error) => {
                println! {"The stream was not found: {}", error}
            }
            eventstore::StreamMetadataResult::Success(metadata) => {
                  println! {"The stream has {} events", metadata.version()}
            },
        },
        Err(error) => {
            println! {"{}", error.to_string()};
        }
    }

This works for normal streams; however, when I set the "stream_name" to "$all", "all", or even "$$all" I receive a eventstore::StreamMetadataResult::NotFound error. Is there no metadata stored for the $all stream, and if so is there another way to tell how many events are on the $all stream with out having to read all the events and count them?

YoEight commented 1 year ago

No it's not possible