Skip to content

Commit

Permalink
feat(iroh-sync): implement file system backed for documents (#1315)
Browse files Browse the repository at this point in the history
* start refactoring store into its own module

* implement more details

* works again

* draft fs db and integrate error handling

* fill out more of the implemenation

* lifetime sadness

* self referential fight: Rust 0 - Dig 1

* basic tests and range fixes

* introduce Store trait and update tests to test against both impls

* implement remove

* integrate new storage into the example

* implement iterators

* fixes and more tests

* clippy and deny cleanup
  • Loading branch information
dignifiedquire authored Aug 3, 2023
1 parent e7a25d1 commit 594c54a
Show file tree
Hide file tree
Showing 16 changed files with 2,059 additions and 799 deletions.
59 changes: 59 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ multiple-versions = "allow"
[licenses]
allow = [
"Apache-2.0",
"Apache-2.0 WITH LLVM-exception",
"BSD-2-Clause",
"BSD-3-Clause",
"BSL-1.0", # BOSL license
Expand Down
6 changes: 6 additions & 0 deletions iroh-bytes/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ impl From<[u8; 32]> for Hash {
}
}

impl From<&[u8; 32]> for Hash {
fn from(value: &[u8; 32]) -> Self {
Hash(blake3::Hash::from(*value))
}
}

impl PartialOrd for Hash {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.0.as_bytes().cmp(other.0.as_bytes()))
Expand Down
2 changes: 1 addition & 1 deletion iroh-gossip/src/proto/plumtree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ mod test {
// now we recv with a spoofed id and expect no event to be emitted
let content: Bytes = b"hello2".to_vec().into();
let message = Message::Gossip(Gossip {
content: content.clone(),
content,
round: Round(1),
id: MessageId::from_content(b"foo"),
});
Expand Down
9 changes: 9 additions & 0 deletions iroh-sync/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,14 @@ bytes = "1.4.0"
parking_lot = "0.12.1"
hex = "0.4"

# fs-store
redb = { version = "1.0.5", optional = true }
ouroboros = { version = "0.17", optional = true }

[dev-dependencies]
tokio = { version = "1.28.2", features = ["sync", "macros"] }
tempfile = "3.4"

[features]
default = ["fs-store"]
fs-store = ["redb", "ouroboros"]
1 change: 1 addition & 0 deletions iroh-sync/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pub mod ranger;
pub mod store;
pub mod sync;
Loading

0 comments on commit 594c54a

Please sign in to comment.