Skip to content

Commit 25f85bf

Browse files
rsky-relay: add tree inversion
1 parent 25f715f commit 25f85bf

File tree

5 files changed

+899
-12
lines changed

5 files changed

+899
-12
lines changed

rsky-relay/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ serde_bytes = "0.11"
3434
serde_cbor = "0.11"
3535
serde_ipld_dagcbor = "0.6"
3636
serde_json = { version = "1", features = ["raw_value"] }
37+
sha2 = "0.10"
3738
signal-hook = { version = "0.3", features = ["extended-siginfo"] }
3839
sled = { version = "0.34", features = ["compression"] }
3940
thingbuf = "0.1"

rsky-relay/src/validator/event.rs

+32
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::borrow::Cow;
2+
use std::cmp::Ordering;
23
use std::convert::Infallible;
34
use std::io::Write;
45
use std::{fmt, io};
@@ -76,7 +77,38 @@ pub enum SubscribeReposCommitOperation {
7677
Delete { path: String, prev_data: Option<Cid> },
7778
}
7879

80+
impl PartialEq for SubscribeReposCommitOperation {
81+
#[inline]
82+
fn eq(&self, other: &Self) -> bool {
83+
self.path().eq(other.path())
84+
}
85+
}
86+
87+
impl Eq for SubscribeReposCommitOperation {}
88+
89+
impl PartialOrd for SubscribeReposCommitOperation {
90+
#[inline]
91+
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
92+
Some(self.cmp(other))
93+
}
94+
}
95+
96+
impl Ord for SubscribeReposCommitOperation {
97+
#[inline]
98+
fn cmp(&self, other: &Self) -> Ordering {
99+
self.path().cmp(other.path())
100+
}
101+
}
102+
79103
impl SubscribeReposCommitOperation {
104+
fn path(&self) -> &String {
105+
match self {
106+
Self::Create { path, .. } => path,
107+
Self::Update { path, .. } => path,
108+
Self::Delete { path, .. } => path,
109+
}
110+
}
111+
80112
pub const fn is_valid(&self) -> bool {
81113
match self {
82114
Self::Create { .. } => true,

rsky-relay/src/validator/resolver.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ impl Resolver {
166166
let (req, hostname) = if let Some(hostname) = hostname {
167167
(self.client.get(format!("https://{hostname}/{DOC_PATH}")), Some(hostname.to_owned()))
168168
} else if let Some(after) = self.after.take() {
169-
tracing::debug!("fetching after: {after}");
169+
tracing::trace!("fetching after: {after}");
170170
self.last = Instant::now();
171171
(self.client.get(format!("{PLC_URL}={after}")), None)
172172
} else {

0 commit comments

Comments
 (0)