tangled
alpha
login
or
join now
ptr.pet
/
hydrant
28
fork
atom
at protocol indexer with flexible filtering, xrpc queries, and a cursor-backed event stream, built on fjall
at-protocol
atproto
indexer
rust
fjall
28
fork
atom
overview
issues
6
pulls
pipelines
[backfill] fix utf-8 error when reading binary TrimmedDid keys
ptr.pet
1 month ago
505a93c8
c74104c4
verified
This commit was signed with the committer's
known signature
.
ptr.pet
SSH Key Fingerprint:
SHA256:Abmvag+juovVufZTxyWY8KcVgrznxvBjQpJesv071Aw=
+14
-12
1 changed file
expand all
collapse all
unified
split
src
backfill
mod.rs
+14
-12
src/backfill/mod.rs
···
486
486
for (col_name, ks) in partitions {
487
487
for guard in ks.prefix(&prefix) {
488
488
let (key, cid_bytes) = guard.into_inner().into_diagnostic()?;
489
489
-
// key: {DID}|{RKey}
490
490
-
let key_str = std::str::from_utf8(&key).into_diagnostic()?;
491
491
-
let parts: Vec<&str> = key_str.split(keys::SEP as char).collect();
492
492
-
if parts.len() == 2 {
493
493
-
let rkey = parts[1].to_smolstr();
494
494
-
let cid = if let Ok(c) = cid::Cid::read_bytes(cid_bytes.as_ref()) {
495
495
-
c.to_string().to_smolstr()
496
496
-
} else {
497
497
-
continue;
498
498
-
};
489
489
+
let Some(sep_pos) = key.iter().position(|&b| b == keys::SEP) else {
490
490
+
error!("invalid key for {did}: {key:?}");
491
491
+
continue;
492
492
+
};
493
493
+
let rkey = std::str::from_utf8(&key[sep_pos + 1..])
494
494
+
.into_diagnostic()?
495
495
+
.to_smolstr();
496
496
+
let cid = if let Ok(c) = cid::Cid::read_bytes(cid_bytes.as_ref()) {
497
497
+
c.to_string().to_smolstr()
498
498
+
} else {
499
499
+
error!("invalid cid for {did}: {cid_bytes:?}");
500
500
+
continue;
501
501
+
};
499
502
500
500
-
existing_cids.insert((col_name.as_str().into(), rkey), cid);
501
501
-
}
503
503
+
existing_cids.insert((col_name.as_str().into(), rkey), cid);
502
504
}
503
505
}
504
506