Skip to content

Commit

Permalink
feat: Implement multi-get for more backends
Browse files Browse the repository at this point in the history
  • Loading branch information
netrome committed Oct 29, 2024
1 parent 35b25d5 commit 833ade0
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/fuel-core/src/state/data_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ where
self.data.get(key, column)
}

fn get_batch<'a>(
&'a self,
keys: BoxedIter<'a, Vec<u8>>,
column: Self::Column,
) -> BoxedIter<'a, StorageResult<Option<Value>>> {
self.data.get_batch(keys, column)
}

fn read(
&self,
key: &[u8],
Expand Down
8 changes: 8 additions & 0 deletions crates/fuel-core/src/state/generic_database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ where
KeyValueInspect::get(&self.storage, key, column)
}

fn get_batch<'a>(
&'a self,
keys: BoxedIter<'a, Vec<u8>>,
column: Self::Column,
) -> BoxedIter<'a, StorageResult<Option<Value>>> {
KeyValueInspect::get_batch(&self.storage, keys, column)
}

fn read(
&self,
key: &[u8],
Expand Down
8 changes: 8 additions & 0 deletions crates/fuel-core/src/state/iterable_key_value_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ where
self.0.get(key, column)
}

fn get_batch<'a>(
&'a self,
keys: BoxedIter<'a, Vec<u8>>,
column: Self::Column,
) -> BoxedIter<'a, StorageResult<Option<Value>>> {
self.0.get_batch(keys, column)
}

fn read(
&self,
key: &[u8],
Expand Down
9 changes: 9 additions & 0 deletions crates/fuel-core/src/state/key_value_view.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use fuel_core_storage::{
iter::BoxedIter,
kv_store::{
KeyValueInspect,
StorageColumn,
Expand Down Expand Up @@ -50,6 +51,14 @@ where
self.0.get(key, column)
}

fn get_batch<'a>(
&'a self,
keys: BoxedIter<'a, Vec<u8>>,
column: Self::Column,
) -> BoxedIter<'a, StorageResult<Option<Value>>> {
self.0.get_batch(keys, column)
}

fn read(
&self,
key: &[u8],
Expand Down
8 changes: 8 additions & 0 deletions crates/storage/src/structured_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@ where
self.inner.get(key, column)
}

fn get_batch<'a>(
&'a self,
keys: BoxedIter<'a, Vec<u8>>,
column: Self::Column,
) -> BoxedIter<'a, StorageResult<Option<Value>>> {
self.inner.get_batch(keys, column)
}

fn read(
&self,
key: &[u8],
Expand Down

0 comments on commit 833ade0

Please sign in to comment.