···6464#[cfg(feature = "relay")]
6565mod subscribe_repos;
66666767-pub fn router() -> Router<Hydrant> {
6767+pub fn router(blocks_available: bool) -> Router<Hydrant> {
6868 let r = Router::new()
6969 .route(GetHostStatusRequest::PATH, get(get_host_status::handle))
7070 .route(ListHostsRequest::PATH, get(list_hosts::handle))
···74747575 #[cfg(feature = "indexer")]
7676 let r = r
7777- .route(GetRecordRequest::PATH, get(get_record::handle))
7878- .route(ListRecordsRequest::PATH, get(list_records::handle))
7977 .route(CountRecords::PATH, get(count_records::handle))
8080- .route(GetRepoRequest::PATH, get(get_repo::handle))
8178 .route(DescribeRepo::PATH, get(describe_repo::handle))
8279 .route(
8380 AtprotoDescribeRepoRequest::PATH,
8481 get(com_atproto_describe_repo::handle),
8582 );
8383+8484+ #[cfg(feature = "indexer")]
8585+ let r = if blocks_available {
8686+ r.route(GetRecordRequest::PATH, get(get_record::handle))
8787+ .route(ListRecordsRequest::PATH, get(list_records::handle))
8888+ .route(GetRepoRequest::PATH, get(get_repo::handle))
8989+ } else {
9090+ r
9191+ };
86928793 #[cfg(feature = "relay")]
8894 let r = r
+6-6
src/control/repos/indexer.rs
···334334impl<'i> RepoHandle<'i> {
335335 /// gets a record from this repository.
336336 pub async fn get_record(&self, collection: &str, rkey: &str) -> Result<Option<Record>> {
337337- if self.state.only_index_links {
338338- miette::bail!("block storage is disabled (HYDRANT_ONLY_INDEX_LINKS)");
337337+ if !self.state.is_block_storage_enabled() {
338338+ miette::bail!("block storage is not available in this mode");
339339 }
340340341341 let did = self.did.clone().into_static();
···380380 reverse: bool,
381381 cursor: Option<&str>,
382382 ) -> Result<RecordList> {
383383- if self.state.only_index_links {
384384- miette::bail!("block storage is disabled (HYDRANT_ONLY_INDEX_LINKS)");
383383+ if !self.state.is_block_storage_enabled() {
384384+ miette::bail!("block storage is not available in this mode");
385385 }
386386 let did = self.did.clone().into_static();
387387···486486 &self,
487487 ) -> Result<Option<impl futures::Stream<Item = std::io::Result<bytes::Bytes>> + Send + 'static>>
488488 {
489489- if self.state.only_index_links {
490490- miette::bail!("block storage is disabled (HYDRANT_ONLY_INDEX_LINKS)");
489489+ if !self.state.is_block_storage_enabled() {
490490+ miette::bail!("block storage is not available in this mode");
491491 }
492492 use iroh_car::{CarHeader, CarWriter};
493493 use jacquard_repo::{BlockStore, MemoryBlockStore, Mst};