Breathe life back into this project. #1

Merged
gburd merged 22 commits from gburd/2018edition-fmt-fix-deps into master 2020-01-16 16:27:21 +00:00
3 changed files with 4 additions and 4 deletions
Showing only changes of commit 3547cfcd16 - Show all commits

View file

@ -76,7 +76,7 @@ impl SyncMetadata {
pub fn set_remote_head(tx: &rusqlite::Transaction, uuid: &Uuid) -> Result<()> { pub fn set_remote_head(tx: &rusqlite::Transaction, uuid: &Uuid) -> Result<()> {
let uuid_bytes = uuid.as_bytes().to_vec(); let uuid_bytes = uuid.as_bytes().to_vec();
let updated = tx.execute("UPDATE tolstoy_metadata SET value = ? WHERE key = ?", let updated = tx.execute("UPDATE tolstoy_metadata SET value = ? WHERE key = ?",
&[&uuid_bytes, &schema::REMOTE_HEAD_KEY])?; rusqlite::params![&uuid_bytes, &schema::REMOTE_HEAD_KEY])?;
if updated != 1 { if updated != 1 {
bail!(TolstoyError::DuplicateMetadata(schema::REMOTE_HEAD_KEY.into())); bail!(TolstoyError::DuplicateMetadata(schema::REMOTE_HEAD_KEY.into()));
} }

View file

@ -42,7 +42,7 @@ pub fn ensure_current_version(tx: &mut rusqlite::Transaction) -> Result<()> {
// Initial partition information is what we'd see at bootstrap, and is used during first sync. // Initial partition information is what we'd see at bootstrap, and is used during first sync.
for (name, start, end, index, allow_excision) in BOOTSTRAP_PARTITIONS.iter() { for (name, start, end, index, allow_excision) in BOOTSTRAP_PARTITIONS.iter() {
tx.execute("INSERT OR IGNORE INTO tolstoy_parts VALUES (?, ?, ?, ?, ?)", &[&name.to_string(), start, end, index, allow_excision])?; tx.execute("INSERT OR IGNORE INTO tolstoy_parts VALUES (?, ?, ?, ?, ?)", rusqlite::params![&name.to_string(), start, end, index, allow_excision])?;
} }
tx.execute("INSERT OR IGNORE INTO tolstoy_metadata (key, value) VALUES (?, zeroblob(16))", &[&REMOTE_HEAD_KEY])?; tx.execute("INSERT OR IGNORE INTO tolstoy_metadata (key, value) VALUES (?, zeroblob(16))", &[&REMOTE_HEAD_KEY])?;

View file

@ -37,7 +37,7 @@ impl TxMapper {
)?; )?;
for mapping in mappings.iter() { for mapping in mappings.iter() {
let uuid_bytes = mapping.remote.as_bytes().to_vec(); let uuid_bytes = mapping.remote.as_bytes().to_vec();
stmt.execute(&[&mapping.local, &uuid_bytes])?; stmt.execute(rusqlite::params![&mapping.local, &uuid_bytes])?;
} }
Ok(()) Ok(())
} }
@ -53,7 +53,7 @@ impl TxMapper {
None => { None => {
let uuid = Uuid::new_v4(); let uuid = Uuid::new_v4();
let uuid_bytes = uuid.as_bytes().to_vec(); let uuid_bytes = uuid.as_bytes().to_vec();
db_tx.execute("INSERT INTO tolstoy_tu (tx, uuid) VALUES (?, ?)", &[&tx, &uuid_bytes])?; db_tx.execute("INSERT INTO tolstoy_tu (tx, uuid) VALUES (?, ?)", rusqlite::params![&tx, &uuid_bytes])?;
return Ok(uuid); return Ok(uuid);
} }
} }