Changing the type of the tags db, to make it identical to remote tags
Dependencies
- [2]
C267PHOHTags: dropping useless Hashes in favour of Merkles - [3]
7ZROQSSNHandling TAG uploads from the `pijul protocol` command - [4]
RIAA2QKFMaking Merkle std::hash::Hash - [5]
RM225IDQExchanging tagged states over SSH - [6]
FXEDPLRIResurrecting tests, and type cleanup (no need for Arc<RwLock<…>> anymore) - [7]
I24UEJQLVarious post-fire fixes - [8]
VO5OQW4WRemoving anyhow in libpijul - [9]
YN63NUZOSanakirja 1.0 - [10]
IIV3EL2XCleanup, formatting, and fixing the Git feature - [11]
AAXP2534Tags: completing the subcommand - [12]
DX2FO4HZTag CLI cleanup - [13]
EUZFFJSOUpdating Pijul with the latest changes in Libpijul - [14]
FDEVV5NGTag check - [15]
WTQCVLAHCorrectly putting states into channels - [16]
A3RM526YIntegrating identity malleability - [17]
CCLLB7OIUpgrading to Sanakirja 0.15 + version bump - [18]
QL6K2ZM3Tags - [19]
BUM5P4VGCorrect error for Merkle::from_base32 - [20]
SXEYMYF7Fixing the bad changes in history (unfortunately, by rebooting). - [21]
GHO6DWPIRefactoring iterators - [*]
IVLLXQ5ZImproved push/pull reporting - [*]
I52XSRUHMassive cleanup, and simplification
Change contents
- replacement in pijul/src/commands/tag.rs at line 114
txn.write().put_tags(&mut *channel.write(), last_t.into())?;txn.write().put_tags(&mut channel.write().tags, last_t.into(), &h)?; - edit in pijul/src/commands/pushpull.rs at line 394
tags, - replacement in pijul/src/commands/protocol.rs at line 182
txn.write().put_tags(&mut *channel.write(), last_t.into())?;txn.write().put_tags(&mut channel.write().tags, last_t.into(), &m)?; - replacement in libpijul/src/tag.rs at line 227
|_, _, k: &L64, v: &()| Ok((*k, *v)),|_, _, k: &L64, v: &Pair<SerializedMerkle, SerializedMerkle>| Ok((*k, *v)), - replacement in libpijul/src/pristine/sanakirja.rs at line 340
let tags: UDb<L64, SerializedHash> = UDb::from_page(tup.tags.into());let tags: UDb<L64, Pair<SerializedMerkle, SerializedMerkle>> =UDb::from_page(tup.tags.into()); - replacement in libpijul/src/pristine/sanakirja.rs at line 727
pub tags: Db<L64, ()>,pub tags: Db<L64, Pair<SerializedMerkle, SerializedMerkle>>, - replacement in libpijul/src/pristine/sanakirja.rs at line 927
type Tags = Db<L64, ()>;type Tags = Db<L64, Pair<SerializedMerkle, SerializedMerkle>>; - replacement in libpijul/src/pristine/sanakirja.rs at line 933
_ => Ok(false)_ => Ok(false), - replacement in libpijul/src/pristine/sanakirja.rs at line 937
type TagsCursor =::sanakirja::btree::cursor::Cursor<L64, (), P<L64, ()>>;type TagsCursor = ::sanakirja::btree::cursor::Cursor<L64,Pair<SerializedMerkle, SerializedMerkle>,P<L64, Pair<SerializedMerkle, SerializedMerkle>>,>; - replacement in libpijul/src/pristine/sanakirja.rs at line 988[6.2167]→[6.2167:2184](∅→∅),[6.2184]→[2.4500:4563](∅→∅),[2.4563]→[6.2259:2301](∅→∅),[6.2259]→[6.2259:2301](∅→∅)
) -> Result<super::Cursor<Self, &Self, Self::TagsCursor, L64, ()>,TxnErr<Self::GraphError>,> {) -> Result<super::Cursor<Self, &Self, Self::TagsCursor, L64, ()>, TxnErr<Self::GraphError>>{ - replacement in libpijul/src/pristine/sanakirja.rs at line 997[6.2455]→[6.2455:2472](∅→∅),[6.2472]→[2.4564:4630](∅→∅),[2.4630]→[6.2550:2592](∅→∅),[6.2550]→[6.2550:2592](∅→∅)
) -> Result<super::RevCursor<Self, &Self, Self::TagsCursor, L64, ()>,TxnErr<Self::GraphError>,> {) -> Result<super::RevCursor<Self, &Self, Self::TagsCursor, L64, ()>, TxnErr<Self::GraphError>>{ - edit in libpijul/src/pristine/sanakirja.rs at line 1382
type Remotetags = UDb<L64, Pair<SerializedMerkle, SerializedMerkle>>; - edit in libpijul/src/pristine/sanakirja.rs at line 1391
sanakirja_cursor!(remotetags, L64, Pair<SerializedMerkle, SerializedMerkle>);sanakirja_rev_cursor!(remotetags, L64, Pair<SerializedMerkle, SerializedMerkle>);type RemotetagsCursor = ::sanakirja::btree::cursor::Cursor<L64,Pair<SerializedMerkle, SerializedMerkle>,UP<L64, Pair<SerializedMerkle, SerializedMerkle>>,>; - edit in libpijul/src/pristine/sanakirja.rs at line 1474
fn last_remote_tag(&self,remote: &Self::Remotetags,) -> Result<Option<(u64, &SerializedMerkle, &SerializedMerkle)>, TxnErr<Self::GraphError>> {if let Some(x) = btree::rev_iter(&self.txn, remote, None)?.next() {let (&k, v) = x?;Ok(Some((k.into(), &v.a, &v.b)))} else {Ok(None)}} - replacement in libpijul/src/pristine/sanakirja.rs at line 1674
(&(x?.1).b).into()let (a, b) = x?;let a: u64 = (*a).into();assert!(a < t);(&b.b).into() - replacement in libpijul/src/pristine/sanakirja.rs at line 1734
m = m.next(&self.get_external(p)?.unwrap().into());m = m.next(self.get_external(p)?.unwrap()); - replacement in libpijul/src/pristine/sanakirja.rs at line 1755
channel: &mut Self::Channel,t: ApplyTimestamp,channel: &mut Self::Tags,n: u64,m: &Merkle, - replacement in libpijul/src/pristine/sanakirja.rs at line 1759
btree::put(&mut self.txn, &mut channel.tags, &t.into(), &())?;Ok(())debug!("put_tags {:?}", m);let mm: SerializedMerkle = m.into();if btree::get(&self.txn, &channel, &n.into(), None)?.is_some() {debug!("already tagged");Ok(())} else {let tl = n.into();let mut repl = vec![(tl, mm)];replay_tags(self, channel, tl, &mut repl)?;Ok(())} - replacement in libpijul/src/pristine/sanakirja.rs at line 1774
channel: &mut Self::Channel,t: ApplyTimestamp,channel: &mut Self::Tags,t: u64, - replacement in libpijul/src/pristine/sanakirja.rs at line 1777
btree::del(&mut self.txn, &mut channel.tags, &t.into(), None)?;replay_tags(self, channel, t.into(), &mut Vec::new())?; - edit in libpijul/src/pristine/sanakirja.rs at line 1782
fn replay_tags(txn: &mut MutTxn<()>,channel: &mut Db<L64, Pair<SerializedMerkle, SerializedMerkle>>,tl: L64,repl: &mut Vec<(L64, SerializedMerkle)>,) -> Result<(), TxnErr<SanakirjaError>> {let del = repl.is_empty();for x in btree::iter(&txn.txn, &channel, Some((&tl, None)))? {let (t_, p) = x?;if *t_ >= tl {repl.push((*t_, p.a))}}let mut m = Merkle::zero();for x in btree::rev_iter(&txn.txn, &channel, Some((&tl, None)))? {let (t_, mm) = x?;if t_ < &tl {m = (&mm.b).into();break;}}for (t_, p) in repl.iter() {debug!("del_changes {:?} {:?}", t_, p);btree::del(&mut txn.txn, channel, t_, None)?;if *t_ > tl || !del {m = m.next(p);btree::put(&mut txn.txn, channel, t_, &Pair { a: *p, b: m.into() })?;}}Ok(())} - replacement in libpijul/src/pristine/sanakirja.rs at line 1853
) -> Result<bool, Self::GraphError> {) -> Result<bool, TxnErr<Self::GraphError>> { - replacement in libpijul/src/pristine/sanakirja.rs at line 1865
btree::put(&mut self.txn, &mut remote.tags, &k.into(), &())?;self.put_tags(&mut remote.tags, k, &v.1)?; - replacement in libpijul/src/pristine/sanakirja.rs at line 1874
) -> Result<bool, Self::GraphError> {) -> Result<bool, TxnErr<Self::GraphError>> { - edit in libpijul/src/pristine/mod.rs at line 677
table!(remotetags); - edit in libpijul/src/pristine/mod.rs at line 682
cursor!(remotetags, L64, Pair<SerializedMerkle, SerializedMerkle>);rev_cursor!(remotetags, L64, Pair<SerializedMerkle, SerializedMerkle>); - edit in libpijul/src/pristine/mod.rs at line 719[24.36994][6.59531]
fn last_remote_tag(&self,remote: &Self::Remotetags,) -> Result<Option<(u64, &SerializedMerkle, &SerializedMerkle)>, TxnErr<Self::GraphError>>; - replacement in libpijul/src/pristine/mod.rs at line 1797
channel: &mut Self::Channel,t: ApplyTimestamp,channel: &mut Self::Tags,n: u64,m: &Merkle, - replacement in libpijul/src/pristine/mod.rs at line 1804
channel: &mut Self::Channel,t: ApplyTimestamp,channel: &mut Self::Tags,n: u64, - replacement in libpijul/src/pristine/mod.rs at line 1882
) -> Result<bool, Self::GraphError>;) -> Result<bool, TxnErr<Self::GraphError>>; - replacement in libpijul/src/pristine/mod.rs at line 1888
) -> Result<bool, Self::GraphError>;) -> Result<bool, TxnErr<Self::GraphError>>; - edit in libpijul/src/pristine/merkle.rs at line 33
}}}impl From<&super::Hash> for curve25519_dalek::scalar::Scalar {fn from(h: &super::Hash) -> Self {match h {super::Hash::Blake3(h) => {curve25519_dalek::scalar::Scalar::from_bytes_mod_order(*h)}_ => unreachable!(), - edit in libpijul/src/pristine/merkle.rs at line 48
impl From<&super::SerializedHash> for curve25519_dalek::scalar::Scalar {fn from(h: &super::SerializedHash) -> Self {let h: super::Hash = h.into();(&h).into()}}impl From<&Merkle> for curve25519_dalek::scalar::Scalar {fn from(h: &Merkle) -> Self {match *h {Merkle::Ed25519(h) => {let h = h.compress();curve25519_dalek::scalar::Scalar::from_bytes_mod_order(*h.as_bytes())}}}}impl From<&super::SerializedMerkle> for curve25519_dalek::scalar::Scalar {fn from(h: &super::SerializedMerkle) -> Self {let h: Merkle = h.into();(&h).into()}} - replacement in libpijul/src/pristine/merkle.rs at line 77
pub fn next(&self, h: &super::Hash) -> Self {pub fn next<S: Into<curve25519_dalek::scalar::Scalar>>(&self, h: S) -> Self { - replacement in libpijul/src/pristine/merkle.rs at line 80
let scalar = match *h {super::Hash::Blake3(h) => {curve25519_dalek::scalar::Scalar::from_bytes_mod_order(h)}_ => unreachable!(),};let scalar = h.into();