Skip to content

Commit 43a6df0

Browse files
fix: implement quilt patch methods for ClientMultiplexer (#2813)
* fix(daemon): implement quilt patch methods for ClientMultiplexer The daemon's ClientMultiplexer was missing implementations for quilt patch reading methods, causing "quilt functionality not supported by this client" errors when calling quilt patch endpoints. Add the following method implementations by delegating to the underlying read_client: - get_blobs_by_quilt_patch_ids - get_patch_by_quilt_id_and_identifier - list_patches_in_quilt * chore: remove default impls from trait --------- Co-authored-by: Will Bradley <[email protected]>
1 parent 93d6667 commit 43a6df0

File tree

2 files changed

+50
-37
lines changed

2 files changed

+50
-37
lines changed

crates/walrus-service/src/client/daemon.rs

Lines changed: 25 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -118,54 +118,21 @@ pub trait WalrusReadClient {
118118
fn get_blobs_by_quilt_patch_ids(
119119
&self,
120120
_quilt_patch_ids: &[QuiltPatchId],
121-
) -> impl std::future::Future<Output = ClientResult<Vec<QuiltStoreBlob<'static>>>> + Send {
122-
async {
123-
use walrus_sdk::error::ClientErrorKind;
124-
Err(ClientError::from(ClientErrorKind::Other(
125-
format!(
126-
"quilt functionality not supported by this client ({})",
127-
std::any::type_name::<Self>()
128-
)
129-
.into(),
130-
)))
131-
}
132-
}
121+
) -> impl std::future::Future<Output = ClientResult<Vec<QuiltStoreBlob<'static>>>> + Send;
133122

134123
/// Retrieves a blob from quilt by quilt ID and identifier.
135124
/// Default implementation returns an error indicating quilt is not supported.
136125
fn get_patch_by_quilt_id_and_identifier(
137126
&self,
138127
_quilt_id: &BlobId,
139128
_identifier: &str,
140-
) -> impl std::future::Future<Output = ClientResult<QuiltStoreBlob<'static>>> + Send {
141-
async {
142-
use walrus_sdk::error::ClientErrorKind;
143-
Err(ClientError::from(ClientErrorKind::Other(
144-
format!(
145-
"quilt functionality not supported by this client ({})",
146-
std::any::type_name::<Self>()
147-
)
148-
.into(),
149-
)))
150-
}
151-
}
129+
) -> impl std::future::Future<Output = ClientResult<QuiltStoreBlob<'static>>> + Send;
152130

153131
/// Lists patches in a quilt.
154132
fn list_patches_in_quilt(
155133
&self,
156134
_quilt_id: &BlobId,
157-
) -> impl std::future::Future<Output = ClientResult<Vec<QuiltPatchItem>>> + Send {
158-
async {
159-
use walrus_sdk::error::ClientErrorKind;
160-
Err(ClientError::from(ClientErrorKind::Other(
161-
format!(
162-
"quilt functionality not supported by this client ({})",
163-
std::any::type_name::<Self>()
164-
)
165-
.into(),
166-
)))
167-
}
168-
}
135+
) -> impl std::future::Future<Output = ClientResult<Vec<QuiltPatchItem>>> + Send;
169136
}
170137

171138
/// Trait representing a client that can write blobs to Walrus.
@@ -821,6 +788,28 @@ mod tests {
821788
) -> ClientResult<ReadByteRangeResult> {
822789
unimplemented!("not needed for rate limit tests")
823790
}
791+
792+
async fn get_blobs_by_quilt_patch_ids(
793+
&self,
794+
_quilt_patch_ids: &[QuiltPatchId],
795+
) -> ClientResult<Vec<QuiltStoreBlob<'static>>> {
796+
unimplemented!("not needed for rate limit tests")
797+
}
798+
799+
async fn get_patch_by_quilt_id_and_identifier(
800+
&self,
801+
_quilt_id: &BlobId,
802+
_identifier: &str,
803+
) -> ClientResult<QuiltStoreBlob<'static>> {
804+
unimplemented!("not needed for rate limit tests")
805+
}
806+
807+
async fn list_patches_in_quilt(
808+
&self,
809+
_quilt_id: &BlobId,
810+
) -> ClientResult<Vec<QuiltPatchItem>> {
811+
unimplemented!("not needed for rate limit tests")
812+
}
824813
}
825814

826815
#[tokio::test]

crates/walrus-service/src/client/multiplexer.rs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use walrus_core::{
1717
BlobId,
1818
EncodingType,
1919
EpochCount,
20+
QuiltPatchId,
2021
encoding::{
2122
ConsistencyCheckType,
2223
quilt_encoding::{QuiltStoreBlob, QuiltVersion},
@@ -51,7 +52,7 @@ use walrus_utils::metrics::Registry;
5152

5253
use super::{
5354
cli::PublisherArgs,
54-
daemon::{WalrusReadClient, WalrusWriteClient},
55+
daemon::{QuiltPatchItem, WalrusReadClient, WalrusWriteClient},
5556
refill::{RefillHandles, Refiller},
5657
};
5758
use crate::client::refill::should_refill;
@@ -190,6 +191,29 @@ impl WalrusReadClient for ClientMultiplexer {
190191
) -> ClientResult<BlobWithAttribute> {
191192
self.read_client.get_blob_by_object_id(blob_object_id).await
192193
}
194+
195+
async fn get_blobs_by_quilt_patch_ids(
196+
&self,
197+
quilt_patch_ids: &[QuiltPatchId],
198+
) -> ClientResult<Vec<QuiltStoreBlob<'static>>> {
199+
self.read_client
200+
.get_blobs_by_quilt_patch_ids(quilt_patch_ids)
201+
.await
202+
}
203+
204+
async fn get_patch_by_quilt_id_and_identifier(
205+
&self,
206+
quilt_id: &BlobId,
207+
identifier: &str,
208+
) -> ClientResult<QuiltStoreBlob<'static>> {
209+
self.read_client
210+
.get_patch_by_quilt_id_and_identifier(quilt_id, identifier)
211+
.await
212+
}
213+
214+
async fn list_patches_in_quilt(&self, quilt_id: &BlobId) -> ClientResult<Vec<QuiltPatchItem>> {
215+
self.read_client.list_patches_in_quilt(quilt_id).await
216+
}
193217
}
194218

195219
impl WalrusWriteClient for ClientMultiplexer {

0 commit comments

Comments
 (0)