Constellation, Spacedust, Slingshot, UFOs: atproto crates and services for microcosm

Merge pull request #26 from jvalinsky/main

fixes at-microcosm/links#24 for constellation /links/distinct-dids to…

Changed files
+31 -2
constellation
+2 -2
constellation/src/server/mod.rs
···
Ok(acceptable(
accept,
GetLinkItemsResponse {
-
total: paged.version.0,
linking_records: paged.items,
cursor,
query: (*query).clone(),
···
Ok(acceptable(
accept,
GetDidItemsResponse {
-
total: paged.version.0,
linking_dids: paged.items,
cursor,
query: (*query).clone(),
···
Ok(acceptable(
accept,
GetLinkItemsResponse {
+
total: paged.total,
linking_records: paged.items,
cursor,
query: (*query).clone(),
···
Ok(acceptable(
accept,
GetDidItemsResponse {
+
total: paged.total,
linking_dids: paged.items,
cursor,
query: (*query).clone(),
+6
constellation/src/storage/mem_store.rs
···
version: (0, 0),
items: Vec::new(),
next: None,
});
};
let Some(did_rkeys) = paths.get(&Source::new(collection, path)) else {
···
version: (0, 0),
items: Vec::new(),
next: None,
});
};
···
version: (total as u64, gone as u64),
items,
next,
})
}
···
version: (0, 0),
items: Vec::new(),
next: None,
});
};
let Some(did_rkeys) = paths.get(&Source::new(collection, path)) else {
···
version: (0, 0),
items: Vec::new(),
next: None,
});
};
···
version: (total as u64, gone as u64),
items,
next,
})
}
···
version: (0, 0),
items: Vec::new(),
next: None,
+
total: 0,
});
};
let Some(did_rkeys) = paths.get(&Source::new(collection, path)) else {
···
version: (0, 0),
items: Vec::new(),
next: None,
+
total: 0,
});
};
···
version: (total as u64, gone as u64),
items,
next,
+
total: alive as u64,
})
}
···
version: (0, 0),
items: Vec::new(),
next: None,
+
total: 0,
});
};
let Some(did_rkeys) = paths.get(&Source::new(collection, path)) else {
···
version: (0, 0),
items: Vec::new(),
next: None,
+
total: 0,
});
};
···
version: (total as u64, gone as u64),
items,
next,
+
total: alive as u64,
})
}
+19
constellation/src/storage/mod.rs
···
pub version: (u64, u64), // (collection length, deleted item count) // TODO: change to (total, active)? since dedups isn't "deleted"
pub items: Vec<T>,
pub next: Option<u64>,
}
#[derive(Debug, Deserialize, Serialize, PartialEq)]
···
version: (0, 0),
items: vec![],
next: None,
}
);
assert_eq!(
···
version: (0, 0),
items: vec![],
next: None,
}
);
assert_eq!(storage.get_all_counts("bad-example.com")?, HashMap::new());
···
rkey: "asdf".into(),
}],
next: None,
}
);
assert_eq!(
···
version: (1, 0),
items: vec!["did:plc:asdf".into()],
next: None,
}
);
assert_stats(storage.get_stats()?, 1..=1, 1..=1, 1..=1);
···
},
],
next: Some(3),
}
);
assert_eq!(
···
version: (5, 0),
items: vec!["did:plc:asdf-5".into(), "did:plc:asdf-4".into()],
next: Some(3),
}
);
let links = storage.get_links("a.com", "app.t.c", ".abc.uri", 2, links.next)?;
···
},
],
next: Some(1),
}
);
assert_eq!(
···
version: (5, 0),
items: vec!["did:plc:asdf-3".into(), "did:plc:asdf-2".into()],
next: Some(1),
}
);
let links = storage.get_links("a.com", "app.t.c", ".abc.uri", 2, links.next)?;
···
rkey: "asdf".into(),
},],
next: None,
}
);
assert_eq!(
···
version: (5, 0),
items: vec!["did:plc:asdf-1".into()],
next: None,
}
);
assert_stats(storage.get_stats()?, 5..=5, 1..=1, 5..=5);
···
},
],
next: Some(2),
}
);
let links = storage.get_links("a.com", "app.t.c", ".abc.uri", 2, links.next)?;
···
},
],
next: None,
}
);
assert_stats(storage.get_stats()?, 4..=4, 1..=1, 4..=4);
···
},
],
next: Some(2),
}
);
storage.push(
···
},
],
next: None,
}
);
assert_stats(storage.get_stats()?, 5..=5, 1..=1, 5..=5);
···
},
],
next: Some(2),
}
);
storage.push(
···
rkey: "asdf".into(),
},],
next: None,
}
);
assert_stats(storage.get_stats()?, 4..=4, 1..=1, 3..=3);
···
},
],
next: Some(2),
}
);
storage.push(
···
rkey: "asdf".into(),
},],
next: None,
}
);
assert_stats(storage.get_stats()?, 4..=4, 1..=1, 4..=4);
···
pub version: (u64, u64), // (collection length, deleted item count) // TODO: change to (total, active)? since dedups isn't "deleted"
pub items: Vec<T>,
pub next: Option<u64>,
+
pub total: u64,
}
#[derive(Debug, Deserialize, Serialize, PartialEq)]
···
version: (0, 0),
items: vec![],
next: None,
+
total: 0,
}
);
assert_eq!(
···
version: (0, 0),
items: vec![],
next: None,
+
total: 0,
}
);
assert_eq!(storage.get_all_counts("bad-example.com")?, HashMap::new());
···
rkey: "asdf".into(),
}],
next: None,
+
total: 1,
}
);
assert_eq!(
···
version: (1, 0),
items: vec!["did:plc:asdf".into()],
next: None,
+
total: 1,
}
);
assert_stats(storage.get_stats()?, 1..=1, 1..=1, 1..=1);
···
},
],
next: Some(3),
+
total: 5,
}
);
assert_eq!(
···
version: (5, 0),
items: vec!["did:plc:asdf-5".into(), "did:plc:asdf-4".into()],
next: Some(3),
+
total: 5,
}
);
let links = storage.get_links("a.com", "app.t.c", ".abc.uri", 2, links.next)?;
···
},
],
next: Some(1),
+
total: 5,
}
);
assert_eq!(
···
version: (5, 0),
items: vec!["did:plc:asdf-3".into(), "did:plc:asdf-2".into()],
next: Some(1),
+
total: 5,
}
);
let links = storage.get_links("a.com", "app.t.c", ".abc.uri", 2, links.next)?;
···
rkey: "asdf".into(),
},],
next: None,
+
total: 5,
}
);
assert_eq!(
···
version: (5, 0),
items: vec!["did:plc:asdf-1".into()],
next: None,
+
total: 5,
}
);
assert_stats(storage.get_stats()?, 5..=5, 1..=1, 5..=5);
···
},
],
next: Some(2),
+
total: 4,
}
);
let links = storage.get_links("a.com", "app.t.c", ".abc.uri", 2, links.next)?;
···
},
],
next: None,
+
total: 4,
}
);
assert_stats(storage.get_stats()?, 4..=4, 1..=1, 4..=4);
···
},
],
next: Some(2),
+
total: 4,
}
);
storage.push(
···
},
],
next: None,
+
total: 5,
}
);
assert_stats(storage.get_stats()?, 5..=5, 1..=1, 5..=5);
···
},
],
next: Some(2),
+
total: 4,
}
);
storage.push(
···
rkey: "asdf".into(),
},],
next: None,
+
total: 3,
}
);
assert_stats(storage.get_stats()?, 4..=4, 1..=1, 3..=3);
···
},
],
next: Some(2),
+
total: 4,
}
);
storage.push(
···
rkey: "asdf".into(),
},],
next: None,
+
total: 4,
}
);
assert_stats(storage.get_stats()?, 4..=4, 1..=1, 4..=4);
+4
constellation/src/storage/rocks_store.rs
···
version: (0, 0),
items: Vec::new(),
next: None,
});
};
···
version: (total, gone),
items,
next,
})
}
···
version: (0, 0),
items: Vec::new(),
next: None,
});
};
···
version: (total, gone),
items,
next,
})
}
···
version: (0, 0),
items: Vec::new(),
next: None,
+
total: 0,
});
};
···
version: (total, gone),
items,
next,
+
total: alive,
})
}
···
version: (0, 0),
items: Vec::new(),
next: None,
+
total: 0,
});
};
···
version: (total, gone),
items,
next,
+
total: alive,
})
}