Closed Bug 496485 Opened 15 years ago Closed 14 years ago

make Service.wipeServer work properly

Categories

(Firefox :: Sync, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: Mardak, Assigned: mconnor)

Details

Attachments

(1 file, 2 obsolete files)

Each sync engine knows how to wipe itself from the server by deleting the engine directory and the crypto meta url.

WeaveSvc_wipeServer manually deletes the engine directory by name instead of calling the engine's wipe server, and it doesn't delete the crypto/meta.

So switch to SyngEngine's?
We should use the SyncEngine's wipe method, I agree.
Target Milestone: -- → 1.0
Component: Weave → General
Product: Mozilla Labs → Weave
Version: Trunk → unspecified
QA Contact: weave → general
Component: General → Sync
QA Contact: general → sync
Target Milestone: 1.0 → 1.2
Flags: blocking-weave1.3+
Target Milestone: 1.2 → 1.3
Attached patch use wipeServer if possible (obsolete) — Splinter Review
wipeServer works for engines, but doesn't work for other collections, including those that aren't implemented in the current client.  So we should use engine.wipeServer if possible, and otherwise issue the deletes directly (and add the crypto URL to the manual deletes)
Assignee: nobody → mconnor
Status: NEW → ASSIGNED
Attachment #437718 - Flags: review?(edilee)
Comment on attachment 437718 [details] [diff] [review]
use wipeServer if possible

>+++ b/source/modules/service.js
>           // If we have a list of engines, make sure it's one we want
>           if (engines && engines.indexOf(name) == -1)
>             continue;
>+          
>+          let engine;
>+          if (engine = Engines.get(name))
>+            engine.wipeServer();
Nothing special that requires the assignment to be done this way. Just assign when declaring engine and check for engine != null.

It might be saner to just special case check for engines without getting infoURL and just looping over the array to grab the engine and wipeServer(). This means we might issue deletes for stuff that isn't there, but that's not too bad and makes sure the crypto record goes away.

>+          else {
>+            new Resource(this.storageURL + name).delete();
>+            new Resource(this.storageURL + "crypto/" + name).delete();
These things that aren't engines aren't engines, so they don't have an accompanying crypto record.
Attachment #437718 - Flags: review?(edilee) → review-
(In reply to comment #3)
> (From update of attachment 437718 [details] [diff] [review])
> >+++ b/source/modules/service.js
> >           // If we have a list of engines, make sure it's one we want
> >           if (engines && engines.indexOf(name) == -1)
> >             continue;
> >+          
> >+          let engine;
> >+          if (engine = Engines.get(name))
> >+            engine.wipeServer();
> Nothing special that requires the assignment to be done this way. Just assign
> when declaring engine and check for engine != null.

Fixed.

> It might be saner to just special case check for engines without getting
> infoURL and just looping over the array to grab the engine and wipeServer().
> This means we might issue deletes for stuff that isn't there, but that's not
> too bad and makes sure the crypto record goes away.

Fixed, sort of.  We'll only hit infoURL if we don't call this with an arg.

> >+          else {
> >+            new Resource(this.storageURL + name).delete();
> >+            new Resource(this.storageURL + "crypto/" + name).delete();
> These things that aren't engines aren't engines, so they don't have an
> accompanying crypto record.

There may be engines that aren't part of the current client, we should still clear their crypto records if they exist.
Attached patch v2 (obsolete) — Splinter Review
Attachment #437718 - Attachment is obsolete: true
Attachment #437745 - Flags: review?(edilee)
Whiteboard: [has patch][needs review Mardak]
Comment on attachment 437745 [details] [diff] [review]
v2

>+          let engine = Engines.get(name);
>+          if (engine)
>+            engine.wipeServer();
>+          else { // delete manually
>+            new Resource(this.storageURL + name).delete();
>+            new Resource(this.storageURL + "crypto/" + name).delete();
Still not sure what's the benefit of special casing engines here vs blindly deleting crypto/<collection>. Might as well just get rid of SyncEngine_wipeServer code.

Could perhaps be slightly smarter to detect that the whole crypto collection is going to be deleted.
It was basically future-proofing against some engine doing something tricksy so they do extra stuff on wipe server.  That said, I'm _entirely_ happy to nuke SyncEngine_wipeServer and just make people call this with the engine name as an arg, and removing it from the engine object!
Whiteboard: [has patch][needs review Mardak] → [needs new patch]
Attachment #437745 - Attachment is obsolete: true
Attachment #437745 - Flags: review?(edilee)
Attached patch v3Splinter Review
* just nuke storage and crypto for each collection.
* remove engine_wipeServer, as it's unused
Attachment #437938 - Flags: review?(edilee)
Attachment #437938 - Flags: review?(edilee) → review+
Whiteboard: [needs new patch] → [has patch][has review]
Summary: Unused SyncEngine_wipeServer → make Service.wipeServer work properly
http://hg.mozilla.org/labs/weave/rev/56aa3c5e3724
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Whiteboard: [has patch][has review]
Target Milestone: 1.3 → 1.3b1
Component: Firefox Sync: Backend → Sync
Product: Cloud Services → Firefox
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: