Skip to content

Commit e35f877

Browse files
committed
update Storage fn bounds
1 parent a24d4ec commit e35f877

2 files changed

Lines changed: 18 additions & 12 deletions

File tree

libsql-wal/src/storage/backend/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,19 @@ pub trait Backend: Send + Sync + 'static {
4242
segment_index: Vec<u8>,
4343
) -> impl Future<Output = Result<()>> + Send;
4444

45-
async fn find_segment(
45+
fn find_segment(
4646
&self,
4747
config: &Self::Config,
4848
namespace: &NamespaceName,
4949
frame_no: u64,
50-
) -> Result<SegmentKey>;
50+
) -> impl Future<Output = Result<SegmentKey>> + Send;
5151

52-
async fn fetch_segment_index(
52+
fn fetch_segment_index(
5353
&self,
5454
config: &Self::Config,
5555
namespace: &NamespaceName,
5656
key: &SegmentKey,
57-
) -> Result<Map<Arc<[u8]>>>;
57+
) -> impl Future<Output = Result<Map<Arc<[u8]>>>> + Send;
5858

5959
/// Fetch a segment for `namespace` containing `frame_no`, and writes it to `dest`.
6060
async fn fetch_segment_data_to_file(
@@ -67,12 +67,12 @@ pub trait Backend: Send + Sync + 'static {
6767

6868
// this method taking self: Arc<Self> is an infortunate consequence of rust type system making
6969
// impl FileExt variant with all the arguments, with no escape hatch...
70-
async fn fetch_segment_data(
70+
fn fetch_segment_data(
7171
self: Arc<Self>,
7272
config: Self::Config,
7373
namespace: NamespaceName,
7474
key: SegmentKey,
75-
) -> Result<impl FileExt>;
75+
) -> impl Future<Output = Result<impl FileExt>> + Send;
7676

7777
// /// Fetch a segment for `namespace` containing `frame_no`, and writes it to `dest`.
7878
async fn fetch_segment(

libsql-wal/src/storage/mod.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,30 +164,36 @@ pub trait Storage: Send + Sync + 'static {
164164
config_override: Option<Self::Config>,
165165
) -> Result<()>;
166166

167-
async fn find_segment(
167+
fn find_segment(
168168
&self,
169169
namespace: &NamespaceName,
170170
frame_no: u64,
171-
) -> Result<SegmentKey>;
172171
config_override: Option<Self::Config>,
172+
) -> impl Future<Output = Result<SegmentKey>> + Send;
173173

174-
async fn fetch_segment_index(
174+
fn fetch_segment_index(
175175
&self,
176176
namespace: &NamespaceName,
177177
key: &SegmentKey,
178-
) -> Result<Map<Arc<[u8]>>>;
179178
config_override: Option<Self::Config>,
179+
) -> impl Future<Output = Result<Map<Arc<[u8]>>>> + Send;
180+
181+
fn fetch_segment_data(
182+
&self,
183+
namespace: &NamespaceName,
184+
key: &SegmentKey,
180185
config_override: Option<Self::Config>,
186+
) -> impl Future<Output = Result<CompactedSegment<impl FileExt>>> + Send;
181187

182-
async fn fetch_segment_data(
183188
fn shutdown(&self) -> impl Future<Output = ()> + Send {
184189
async { () }
185190
}
191+
fn fetch_segment_index(
186192
&self,
187193
namespace: &NamespaceName,
188194
key: &SegmentKey,
189-
) -> Result<CompactedSegment<impl FileExt>>;
190195
config_override: Option<Self::Config>,
196+
) -> impl Future<Output = Result<Map<Arc<[u8]>>>> + Send {
191197
}
192198

193199
/// a placeholder storage that doesn't store segment

0 commit comments

Comments
 (0)