Re: [whatwg/storage] Replacement design (#88)

Modest progress:

---

To replace a storage shelf, given a storage shed _shed_, storage key _key_, and a storage shelf _newShelf_, run these steps:

1. Let _oldShelf_ be _shed_[_key_].
1. For each _identifier_ → _bottle_ of _oldShelf_'s bucket map["default"]:
   1. For each _proxyMapReference_ of _bottle_'s proxy map reference set:
      1. Let _newBottle_ be _newShelf_'s bucket map["default"][_identifier_].
         1. Set the value of _proxyMapReference_'s underlying map to _newBottle_'s map.
         1. Append _proxyMapReference_ to _newBottle_'s proxy map reference set.
      1. Run the replace a bottle algorithm of the registered storage endpoint whose identifier is _identifier with TODO.
1. Set _shed_[_key_] to _newShelf_.
1. Discard _oldShelf_.

---

This would mean that we'd run an algorithm for each impacted bottle once, in the "storage process". That algorithm would be up to the storage endpoints to define and would have to queue tasks and such as needed. For `localStorage` and `sessionStorage` the algorithm would no-op.

I think this would work for service workers looking at https://github.com/w3c/ServiceWorker/pull/1506.


I was thinking that we'd not pass this algorithm a storage key, but perhaps the old and new storage bottle is not enough for some reason?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/storage/issues/88#issuecomment-655593072

Received on Wednesday, 8 July 2020 15:32:45 UTC