Skip to content

Commit

Permalink
Point to the Dogear telemetry branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
linabutler committed May 15, 2019
1 parent 8905f49 commit 7e5e832
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/places/Cargo.toml
Expand Up @@ -29,7 +29,7 @@ memchr = "2.1.3"
prost = "0.5.0"
prost-derive = "0.5.0"
bytes = "0.4.11"
dogear = "0.2.2"
dogear = { git = "https://github.com/mozilla/dogear.git", branch = "problem-counts" }
interrupt = { path = "../support/interrupt" }
error-support = { path = "../support/error" }

Expand Down
20 changes: 18 additions & 2 deletions components/places/src/bookmark_sync/store.rs
Expand Up @@ -15,7 +15,9 @@ use crate::error::*;
use crate::frecency::{calculate_frecency, DEFAULT_FRECENCY_SETTINGS};
use crate::storage::{bookmarks::BookmarkRootGuid, delete_meta, get_meta, put_meta};
use crate::types::{BookmarkType, SyncGuid, SyncStatus, Timestamp};
use dogear::{self, Content, Deletion, Item, MergedDescendant, MergedRoot, Tree, UploadReason};
use dogear::{
self, AbortSignal, Content, Deletion, Item, MergedDescendant, MergedRoot, Tree, UploadReason,
};
use rusqlite::{Row, NO_PARAMS};
use sql_support::{self, ConnExt, SqlInterruptScope};
use std::collections::HashMap;
Expand All @@ -39,6 +41,19 @@ const COLLECTION_SYNCID_META_KEY: &str = "bookmarks_sync_id";
/// blocking writes from other connections.
const MAX_FRECENCIES_TO_RECALCULATE_PER_CHUNK: usize = 400;

/// Adapts an interruptee to a Dogear abort signal.
struct MergeInterruptee<'a, I>(&'a I);

impl<'a, I> AbortSignal for MergeInterruptee<'a, I>
where
I: interrupt::Interruptee,
{
#[inline]
fn aborted(&self) -> bool {
self.0.was_interrupted()
}
}

pub struct BookmarksStore<'a> {
pub db: &'a PlacesDb,
interruptee: &'a SqlInterruptScope,
Expand Down Expand Up @@ -787,7 +802,7 @@ impl<'a> Merger<'a> {
return Ok(dogear::Stats::default());
}
// Merge and stage outgoing items via dogear.
let stats = self.merge_with_driver(&Driver)?;
let stats = self.merge_with_driver(&Driver, &MergeInterruptee(self.store.interruptee))?;
log::debug!("merge completed: {:?}", stats);
Ok(stats)
}
Expand Down Expand Up @@ -961,6 +976,7 @@ impl<'a> dogear::Store<Error> for Merger<'a> {
let mut stmt = self.store.db.prepare(&sql)?;
let mut results = stmt.query(NO_PARAMS)?;
while let Some(row) = results.next()? {
self.store.interruptee.err_if_interrupted()?;
let p = builder.item(self.remote_row_to_item(&row)?)?;
if let Some(parent_guid) = row.get::<_, Option<SyncGuid>>("parentGuid")? {
p.by_parent_guid(parent_guid.into())?;
Expand Down

0 comments on commit 7e5e832

Please sign in to comment.