Skip to content

Commit a4cdce5

Browse files
committed
fix: made ShardStorage mutable across all tests
1 parent f801b2e commit a4cdce5

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ Here’s how you can set up and use SwarmNL's sharding capabilities:
371371

372372
// Implement the `ShardStorage` trait for our local storage
373373
impl ShardStorage for LocalStorage {
374-
fn fetch_data(&self, key: ByteVector) -> ByteVector {
374+
fn fetch_data(&mut self, key: ByteVector) -> ByteVector {
375375
// Process each key in the ByteVector
376376
for sub_key in key.iter() {
377377
let key_str = String::from_utf8_lossy(sub_key);

examples/sharding/hash-based/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl LocalStorage {
8383

8484
// Implement the `ShardStorage` trait for our local storage
8585
impl ShardStorage for LocalStorage {
86-
fn fetch_data(&self, key: ByteVector) -> ByteVector {
86+
fn fetch_data(&mut self, key: ByteVector) -> ByteVector {
8787
// Process each key in the ByteVector
8888
for sub_key in key.iter() {
8989
let key_str = String::from_utf8_lossy(sub_key);

examples/sharding/range-based/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ struct LocalStorage {
7373

7474
// Implement the `ShardStorage` trait for our local storage
7575
impl ShardStorage for LocalStorage {
76-
fn fetch_data(&self, key: ByteVector) -> ByteVector {
76+
fn fetch_data(&mut self, key: ByteVector) -> ByteVector {
7777
// Convert the key to a UTF-8 string
7878
let key_str = String::from_utf8_lossy(&key[0]);
7979

research.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ The `ShardStorage` trait allows nodes to `trap` into their application logic and
353353
/// forwarded data requests. This is a mechanism to trap into the application storage layer to read
354354
/// sharded data.
355355
pub trait ShardStorage: Send + Sync + Debug {
356-
fn fetch_data(&self, key: ByteVector) -> ByteVector;
356+
fn fetch_data(&mut self, key: ByteVector) -> ByteVector;
357357
}
358358
```
359359

@@ -386,7 +386,7 @@ This approach ensures flexibility, efficiency, and thread-safe handling of data.
386386

387387
// Implement the `ShardStorage` trait for our local storage
388388
impl ShardStorage for LocalStorage {
389-
fn fetch_data(&self, key: ByteVector) -> ByteVector {
389+
fn fetch_data(&mut self, key: ByteVector) -> ByteVector {
390390
// Process each key in the ByteVector
391391
for sub_key in key.iter() {
392392
let key_str = String::from_utf8_lossy(sub_key);

swarm-nl/src/core/tests/sharding.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ struct LocalStorage {
5353

5454
// Implement the `ShardStorage` trait for our local storage
5555
impl ShardStorage for LocalStorage {
56-
fn fetch_data(&self, key: ByteVector) -> ByteVector {
56+
fn fetch_data(&mut self, key: ByteVector) -> ByteVector {
5757
// Convert the key to a UTF-8 string
5858
let key_str = String::from_utf8_lossy(&key[0]);
5959

0 commit comments

Comments
 (0)