(
&self,
sep_key: &str,
sep_value: &[u8],
controller: Option<String>,
stream_id: Option<String>,
)
| 819 | } |
| 820 | |
| 821 | fn build_start_stop_range( |
| 822 | &self, |
| 823 | sep_key: &str, |
| 824 | sep_value: &[u8], |
| 825 | controller: Option<String>, |
| 826 | stream_id: Option<String>, |
| 827 | ) -> Result<(EventId, EventId), ErrorResponse> { |
| 828 | let start_builder = EventId::builder() |
| 829 | .with_network(&self.network) |
| 830 | .with_sep(sep_key, sep_value); |
| 831 | let stop_builder = EventId::builder() |
| 832 | .with_network(&self.network) |
| 833 | .with_sep(sep_key, sep_value); |
| 834 | |
| 835 | let (start_builder, stop_builder) = match (controller, stream_id) { |
| 836 | (Some(controller), Some(stream_id)) => { |
| 837 | let stream_id = StreamId::from_str(&stream_id) |
| 838 | .map_err(|err| ErrorResponse::new(format!("stream_id: {err}")))?; |
| 839 | ( |
| 840 | start_builder |
| 841 | .with_controller(&controller) |
| 842 | .with_init(&stream_id.cid), |
| 843 | stop_builder |
| 844 | .with_controller(&controller) |
| 845 | .with_init(&stream_id.cid), |
| 846 | ) |
| 847 | } |
| 848 | (Some(controller), None) => ( |
| 849 | start_builder.with_controller(&controller).with_min_init(), |
| 850 | stop_builder.with_controller(&controller).with_max_init(), |
| 851 | ), |
| 852 | (None, Some(_)) => { |
| 853 | return Err(ErrorResponse::new( |
| 854 | "controller is required if stream_id is specified".to_owned(), |
| 855 | )) |
| 856 | } |
| 857 | (None, None) => ( |
| 858 | start_builder.with_min_controller().with_min_init(), |
| 859 | stop_builder.with_max_controller().with_max_init(), |
| 860 | ), |
| 861 | }; |
| 862 | |
| 863 | let start = start_builder.with_min_event().build_fencepost(); |
| 864 | let stop = stop_builder.with_max_event().build_fencepost(); |
| 865 | Ok((start, stop)) |
| 866 | } |
| 867 | |
| 868 | async fn get_stream_state( |
| 869 | &self, |
no test coverage detected