radicle: identity caching
Add caching for the Identity COB.
A migration file is added for the sqlite COB cache, which inserts the
new identities table.
A new module identity::cache is added, similar to patch::cache and
issue::cache.
To achieve the same pattern as patches and issues, it was necessary to
introduce a new type Identities in the identity module, which
offers the same functionality as methods that existed on the
Identity type.
The caching is implemented using write-through semantics, again similar to patches and issues.
19 files changed
+338
-130
6569449f
→
18b0f389
modified radicle-cli/src/commands/id.rs
@@ -272,7 +272,8 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
|
|
|
|
|
| - | |
| + | |
| + | |
|
|
|
|
|
@@ -613,13 +614,18 @@ and description.
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
|
| - | |
| + | |
|
|
| - | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
modified radicle-cli/src/commands/inbox.rs
@@ -6,8 +6,8 @@ use anyhow::anyhow;
|
|
|
|
|
|
| + | |
|
|
| - | |
|
|
|
|
|
@@ -273,6 +273,7 @@ where
|
|
|
|
|
|
| + | |
|
|
|
|
|
@@ -306,7 +307,7 @@ where
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -401,17 +402,17 @@ impl NotificationRow {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
| - | |
|
|
|
|
| + | |
|
|
|
|
|
@@ -435,7 +436,7 @@ impl NotificationRow {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -548,7 +549,8 @@ fn show(
|
|
|
|
|
|
| - | |
| + | |
| + | |
|
|
|
|
|
modified radicle-cli/src/commands/init.rs
@@ -17,7 +17,7 @@ use radicle::identity::{RepoId, Visibility};
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -265,8 +265,13 @@ pub fn init(options: Options, profile: &profile::Profile) -> anyhow::Result<()>
|
|
|
|
|
|
| + | |
| + | |
| + | |
| + | |
|
|
|
|
| + | |
|
|
|
|
|
modified radicle-cli/src/commands/inspect.rs
@@ -7,8 +7,9 @@ use std::str::FromStr;
|
|
|
|
|
|
| + | |
| + | |
|
|
| - | |
|
|
|
|
|
@@ -213,7 +214,8 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
|
|
|
|
|
| - | |
| + | |
| + | |
|
|
|
|
|
modified radicle-cli/src/commands/publish.rs
@@ -2,7 +2,7 @@ use std::ffi::OsString;
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -76,7 +76,8 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
|
|
|
|
|
| - | |
| + | |
| + | |
|
|
|
|
|
modified radicle-httpd/src/test.rs
@@ -19,7 +19,7 @@ use radicle::git::{raw as git2, RefString};
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -129,8 +129,10 @@ fn seed_with_signer<G: Signer>(dir: &Path, profile: radicle::Profile, signer: &G
|
|
|
|
|
|
| + | |
|
|
|
|
| + | |
|
|
|
|
|
@@ -221,8 +223,10 @@ fn seed_with_signer<G: Signer>(dir: &Path, profile: radicle::Profile, signer: &G
|
|
|
|
|
|
| + | |
|
|
|
|
| + | |
|
|
|
|
|
modified radicle-node/src/test/environment.rs
@@ -153,6 +153,7 @@ pub struct Node<G> {
|
|
|
|
|
|
| + | |
|
|
|
|
|
@@ -163,6 +164,8 @@ impl Node<MemorySigner> {
|
|
|
|
|
|
| + | |
| + | |
|
|
|
|
|
@@ -172,6 +175,7 @@ impl Node<MemorySigner> {
|
|
|
|
|
|
| + | |
|
|
|
|
|
@@ -412,6 +416,8 @@ impl Node<MockSigner> {
|
|
|
|
|
|
| + | |
| + | |
|
|
|
|
|
@@ -422,6 +428,7 @@ impl Node<MockSigner> {
|
|
|
|
|
|
| + | |
|
|
|
|
|
@@ -469,6 +476,7 @@ impl<G: cyphernet::Ecdh<Pk = NodeId> + Signer + Clone> Node<G> {
|
|
|
|
|
|
| + | |
|
|
|
|
|
modified radicle-node/src/test/peer.rs
@@ -6,6 +6,7 @@ use std::str::FromStr;
|
|
|
|
|
|
| + | |
|
|
|
|
|
@@ -136,8 +137,10 @@ impl<G: Signer> Peer<Storage, G> {
|
|
|
|
|
|
| + | |
|
|
|
|
| + | |
|
|
|
|
|
modified radicle-node/src/tests.rs
@@ -8,6 +8,7 @@ use std::time;
|
|
|
|
|
|
| + | |
|
|
|
|
|
@@ -1570,10 +1571,11 @@ fn test_push_and_pull() {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
|
| + | |
|
|
|
|
|
modified radicle-node/src/worker/fetch.rs
@@ -210,11 +210,14 @@ fn cache_cobs<S, C>(
|
|
|
|
|
|
| - | |
| + | |
| + | |
| + | |
|
|
|
|
|
|
|
|
| + | |
|
|
|
|
|
@@ -246,6 +249,17 @@ where
|
|
|
|
|
|
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
modified radicle-tools/src/rad-init.rs
@@ -1,6 +1,6 @@
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -8,8 +8,10 @@ fn main() -> anyhow::Result<()> {
|
|
|
|
|
|
| + | |
|
|
|
|
| + | |
|
|
|
|
|
modified radicle/src/cob/cache.rs
@@ -23,7 +23,10 @@ const DB_WRITE_TIMEOUT: time::Duration = time::Duration::from_secs(6);
|
|
|
|
|
|
| - | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
@@ -247,6 +250,7 @@ where
|
|
|
|
|
|
| + | |
|
|
|
|
|
modified radicle/src/cob/identity.rs
@@ -1,3 +1,5 @@
| + | |
| + | |
|
|
|
|
|
@@ -21,11 +23,13 @@ use crate::{
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
|
|
|
| + | |
| + | |
|
|
|
|
|
@@ -130,10 +134,23 @@ pub enum Error {
|
|
|
|
|
|
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
|
| - | |
| + | |
| + | |
|
|
|
|
|
@@ -179,64 +196,6 @@ impl Identity {
|
|
|
|
|
|
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
|
|
|
|
|
@@ -612,11 +571,12 @@ impl<R: ReadRepository> cob::Evaluate<R> for Identity {
|
|
|
|
|
|
| - | |
| + | |
| + | |
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -656,7 +616,8 @@ impl std::fmt::Display for State {
|
|
|
|
|
|
| - | |
| + | |
| + | |
|
|
|
|
|
@@ -692,7 +653,7 @@ impl std::ops::Deref for Revision {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -715,7 +676,7 @@ impl Revision {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -739,7 +700,7 @@ impl Revision {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -770,7 +731,7 @@ impl Revision {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -852,14 +813,15 @@ impl<R: ReadRepository> store::Transaction<Identity, R> {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
|
| - | |
| + | |
| + | |
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -868,16 +830,14 @@ impl<'a, R> fmt::Debug for IdentityMut<'a, R> {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
| + | |
|
|
|
|
|
|
| - | |
| - | |
| - | |
| - | |
| + | |
|
|
|
|
|
@@ -895,7 +855,13 @@ where
|
|
|
|
|
|
| - | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
@@ -963,7 +929,7 @@ where
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -971,6 +937,99 @@ impl<'a, R> Deref for IdentityMut<'a, R> {
|
|
|
|
|
|
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
@@ -1037,7 +1096,9 @@ mod test {
|
|
|
|
|
|
| - | |
| + | |
| + | |
| + | |
|
|
|
|
|
@@ -1093,7 +1154,9 @@ mod test {
|
|
|
|
|
|
| - | |
| + | |
| + | |
| + | |
|
|
|
|
|
@@ -1143,7 +1206,12 @@ mod test {
|
|
|
|
|
|
| - | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
@@ -1153,7 +1221,7 @@ mod test {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -1195,7 +1263,11 @@ mod test {
|
|
|
|
|
|
| - | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
@@ -1214,7 +1286,7 @@ mod test {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -1234,7 +1306,12 @@ mod test {
|
|
|
|
|
|
| - | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
@@ -1253,11 +1330,11 @@ mod test {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -1291,7 +1368,12 @@ mod test {
|
|
|
|
|
|
| - | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
@@ -1311,11 +1393,11 @@ mod test {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -1360,7 +1442,13 @@ mod test {
|
|
|
|
|
|
| - | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
@@ -1375,7 +1463,7 @@ mod test {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -1396,7 +1484,7 @@ mod test {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -1424,6 +1512,7 @@ mod test {
|
|
|
|
|
|
| + | |
|
|
|
|
|
@@ -1433,7 +1522,8 @@ mod test {
|
|
|
|
|
|
| - | |
| + | |
| + | |
|
|
|
|
|
@@ -1467,7 +1557,7 @@ mod test {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
modified radicle/src/identity/doc.rs
@@ -15,6 +15,7 @@ use serde::{Deserialize, Serialize};
|
|
|
|
|
|
| + | |
|
|
|
|
|
@@ -354,12 +355,18 @@ impl Doc<Verified> {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
| + | |
|
|
| - | |
| - | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
@@ -462,6 +469,7 @@ mod test {
|
|
|
|
|
|
| + | |
|
|
|
|
|
@@ -509,6 +517,7 @@ mod test {
|
|
|
|
|
|
| + | |
|
|
|
|
|
modified radicle/src/profile.rs
@@ -543,6 +543,40 @@ impl Home {
|
|
|
|
|
|
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
modified radicle/src/rad.rs
@@ -6,7 +6,7 @@ use std::str::FromStr;
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -44,15 +44,21 @@ pub enum InitError {
|
|
|
|
|
|
| - | |
| + | |
|
|
| + | |
|
|
|
|
|
|
|
|
|
|
|
|
| - | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
@@ -70,7 +76,7 @@ pub fn init<G: Signer, S: WriteStorage>(
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -388,6 +394,7 @@ mod tests {
|
|
|
|
|
|
| + | |
|
|
|
|
|
@@ -409,6 +416,7 @@ mod tests {
|
|
|
|
|
|
| + | |
|
|
|
|
|
@@ -464,6 +472,7 @@ mod tests {
|
|
|
|
|
|
| + | |
|
|
|
|
|
@@ -500,6 +509,7 @@ mod tests {
|
|
|
|
|
|
| + | |
|
|
|
|
|
modified radicle/src/storage.rs
@@ -14,7 +14,8 @@ use crypto::{PublicKey, Signer, Unverified, Verified};
|
|
|
|
|
|
| - | |
| + | |
| + | |
|
|
|
|
|
@@ -103,6 +104,8 @@ pub enum RepositoryError {
|
|
|
|
|
|
| + | |
| + | |
|
|
|
|
|
@@ -467,7 +470,7 @@ pub trait ReadRepository: Sized + ValidateRepository {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
modified radicle/src/storage/git.rs
@@ -11,6 +11,7 @@ use crypto::{Signer, Verified};
|
|
|
|
|
|
| + | |
|
|
|
|
|
@@ -438,16 +439,21 @@ impl Repository {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
| + | |
|
|
| - | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
|
| - | |
| - | |
| + | |
|
|
|
|
|
@@ -800,7 +806,8 @@ impl ReadRepository for Repository {
|
|
|
|
|
|
| - | |
| + | |
| + | |
|
|
|
|
|
modified radicle/src/test/fixtures.rs
@@ -2,7 +2,6 @@ use std::path::Path;
|
|
|
|
|
|
| - | |
|
|
|
|
|
@@ -10,6 +9,7 @@ use crate::rad;
|
|
|
|
|
|
| + | |
|
|
|
|
|
@@ -38,6 +38,7 @@ pub fn storage<P: AsRef<Path>, G: Signer>(path: P, signer: &G) -> Result<Storage
|
|
|
|
|
|
| + | |
|
|
|
|
|
@@ -61,6 +62,7 @@ pub fn project<P: AsRef<Path>, G: Signer>(
|
|
|
|
|
|
| + | |
|
|
|
|
|