alpha
Login
or
Join now
microcosm.blue
/
microcosm-rs
Star
0
Fork
3
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Constellation, Spacedust, Slingshot, UFOs: atproto crates and services for microcosm
Star
0
Fork
3
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
overflowing deletes maxes out
author
phil
date
1 year ago
(Apr 7, 2025, 10:35 PM -0400)
commit
374e29e3
374e29e34c3480ea80d92bc1cc01c21bd8825da0
parent
d6975d98
d6975d9895c28488c1ae751f4bbe89442ad760e6
+38
1 changed file
Expand all
Collapse all
Unified
Split
ufos
src
lib.rs
+38
ufos/src/lib.rs
Reviewed
···
318
318
319
319
Ok(())
320
320
}
321
321
+
322
322
+
#[test]
323
323
+
fn test_truncating_insert_maxes_out_deletes() -> anyhow::Result<()> {
324
324
+
let mut commits: CollectionCommits<2> = Default::default();
325
325
+
326
326
+
commits.truncating_insert(UFOsCommit {
327
327
+
cursor: Cursor::from_raw_u64(100),
328
328
+
did: Did::new("did:plc:whatever".to_string()).unwrap(),
329
329
+
rkey: RecordKey::new("rkey-asdf-a".to_string()).unwrap(),
330
330
+
rev: "rev-asdf".to_string(),
331
331
+
action: CommitAction::Cut,
332
332
+
}).unwrap();
333
333
+
334
334
+
commits.truncating_insert(UFOsCommit {
335
335
+
cursor: Cursor::from_raw_u64(101),
336
336
+
did: Did::new("did:plc:whatever".to_string()).unwrap(),
337
337
+
rkey: RecordKey::new("rkey-asdf-b".to_string()).unwrap(),
338
338
+
rev: "rev-asdg".to_string(),
339
339
+
action: CommitAction::Cut,
340
340
+
}).unwrap();
341
341
+
342
342
+
let res = commits.truncating_insert(UFOsCommit {
343
343
+
cursor: Cursor::from_raw_u64(102),
344
344
+
did: Did::new("did:plc:whatever".to_string()).unwrap(),
345
345
+
rkey: RecordKey::new("rkey-asdf-c".to_string()).unwrap(),
346
346
+
rev: "rev-asdh".to_string(),
347
347
+
action: CommitAction::Cut,
348
348
+
});
349
349
+
350
350
+
assert!(res.is_err());
351
351
+
let overflowed = match res {
352
352
+
Err(BatchInsertError::BatchFull(c)) => c,
353
353
+
e => panic!("expected overflow but a different error happened: {e:?}"),
354
354
+
};
355
355
+
assert_eq!(overflowed.rev, "rev-asdh");
356
356
+
357
357
+
Ok(())
358
358
+
}
321
359
}