Skip to content

Commit

Permalink
debug comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lougeniaC64 authored and Elle Bee committed May 16, 2024
1 parent 76f7565 commit 70894db
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions components/sync15/src/engine/bridged_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ impl<A: BridgedEngineAdaptor> BridgedEngine for A {
}

fn store_incoming(&self, incoming_records: Vec<IncomingBso>) -> Result<()> {
println!("SYNC15");
let engine = self.engine();
let mut telem = telemetry::Engine::new(engine.collection_name());
engine.stage_incoming(incoming_records, &mut telem)
Expand Down
9 changes: 8 additions & 1 deletion components/webext-storage/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ impl WebExtStorageStore {
/// Creates a store backed by a database at `db_path`. The path can be a
/// file path or `file:` URI.
pub fn new(db_path: impl AsRef<Path>) -> Result<Self> {
println!("OPEN DB");
let db = StorageDb::new(db_path)?;
Ok(Self {
db: Arc::new(ThreadSafeStorageDb::new(db)),
Expand All @@ -59,10 +60,12 @@ impl WebExtStorageStore {
/// Sets one or more JSON key-value pairs for an extension ID. Returns a
/// list of changes, with existing and new values for each key in `val`.
pub fn set(&self, ext_id: &str, val: JsonValue) -> Result<StorageChanges> {
println!("A-S SET, {ext_id:?}, {val:?}");
let db = self.db.lock();
let tx = db.unchecked_transaction()?;
let result = api::set(&tx, ext_id, val)?;
tx.commit()?;
println!("AS SET RESULT, {result:?}");
Ok(result)
}

Expand All @@ -89,6 +92,7 @@ impl WebExtStorageStore {
/// This method always returns an object (that is, a
/// `serde_json::Value::Object`).
pub fn get(&self, ext_id: &str, keys: JsonValue) -> Result<JsonValue> {
println!("A-S GET, {ext_id:?}, {keys:?}");
// Don't care about transactions here.
let db = self.db.lock();
api::get(&db, ext_id, keys)
Expand Down Expand Up @@ -132,6 +136,7 @@ impl WebExtStorageStore {
/// Closes the store and its database connection. See the docs for
/// `StorageDb::close` for more details on when this can fail.
pub fn close(&self) -> Result<()> {
println!("CLOSE DB");
// Even though this consumes `self`, the fact we use an Arc<> means
// we can't guarantee we can actually consume the inner DB - so do
// the best we can.
Expand Down Expand Up @@ -168,7 +173,9 @@ impl WebExtStorageStore {
/// The result is a Vec of already JSON stringified changes.
pub fn get_synced_changes(&self) -> Result<Vec<sync::SyncedExtensionChange>> {
let db = self.db.lock();
sync::get_synced_changes(&db)
let result = sync::get_synced_changes(&db);
println!("{result:?}, get_synced_changes result");
result
}

/// Migrates data from a database in the format of the "old" kinto
Expand Down
7 changes: 7 additions & 0 deletions components/webext-storage/src/sync/bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,21 @@ impl Sync15BridgedEngine for BridgedEngine {
}

fn store_incoming(&self, incoming_bsos: Vec<IncomingBso>) -> Result<()> {
println!{"STORE INCOING INTERNAL"};
let shared_db = self.thread_safe_storage_db()?;
let db = shared_db.lock();
println!{"AFTER DB"};
let signal = db.begin_interrupt_scope()?;
let tx = db.unchecked_transaction()?;
let incoming_content: Vec<_> = incoming_bsos
.into_iter()
.map(IncomingBso::into_content::<super::WebextRecord>)
.collect();
println!{"AFTER INCOMING TRANSFORM"};
stage_incoming(&tx, &incoming_content, &signal)?;
println!("AFTER STAGE INCOMING");
tx.commit()?;
println!{"AFTER COMMIT"};
Ok(())
}

Expand Down Expand Up @@ -228,6 +233,7 @@ impl WebExtStorageBridgedEngine {
}

pub fn store_incoming(&self, incoming: Vec<String>) -> Result<()> {
println!("STORE INCOMING");
self.bridge_impl
.store_incoming(self.convert_incoming_bsos(incoming)?)
}
Expand Down Expand Up @@ -263,6 +269,7 @@ impl WebExtStorageBridgedEngine {
for inc in incoming {
bsos.push(serde_json::from_str::<IncomingBso>(&inc)?);
}
println!("CONVERTED INCOMING {bsos:?}");
Ok(bsos)
}

Expand Down

0 comments on commit 70894db

Please sign in to comment.