Open saschanaz opened 1 year ago
Maybe implicit, but: alternately, work with the editors of those specs (hey, that's me and @saschanaz) to find a better approach, which may involve changes on both sides.
I talked about this briefly with @annevk at TPAC earlier this year at a high level; it really just needs some proposals made and discussed. I hope to have more time for this in 2023 than I've had for the last year.
Oh, and I'm not saying to wait for me to do it. Please anyone, suggestions welcome!!!
Right, I think the model as-is doesn't work for certain use cases and this wasn't flagged when the model was designed. As such we need to make changes to better account for what SW, IDB, and WL need.
I suspect it's not as simple as exporting the terms unfortunately.
Initial stream-of-consciousness thoughts:
My impression is that the current design of bottles and the proxy map is that they match the needs of Local Storage, where:
While the first should be true for all storage endpoints, for some endpoints describing their operation in terms of the second and third requires significant contortions that would make the specs difficult to understand.
var manager = proxy_map.get("name"); manager.requestLock(...);
And if it was, the operations of the manager object could not be described through the proxy map concept.At least for Web Locks and Indexed DB, one idea is that it would be easier to specify if the "thing in the bucket" for a storage endpoint doesn't need to be a bottle, but could be defined by the endpoint. And we still need a way to obtain a proxy, but that would be more abstract rather than a map. But we should require that all operations between the proxy and the endpoint need to be "in parallel".
At the risk of over-specifying, I could imagine describing IndexedDB's "thing in the bucket" as a connection factory and the IDBFactory as holding a proxy; then the IDBDatabase (a database connection) and IDBTransaction (a transaction) route everything through that proxy - e.g. store.put(value, key) turns into proxy.request(dbname, transactionid, storename, PutOp, key, value). The spec could abstract some of that away with proxy wrappers for the connection and transaction. This ends up looking a lot like the implementation in Chrome, at least.
Again, just initial thoughts to get the conversation going.
cc @whatwg/storage
It seems multiple specs are using the storage model terms without actual export.
Now that https://github.com/w3c/web-locks/pull/75 is also adding references, we should
really export them(maybe find a better way to expose the model as suggested in comments) and remove those hacks. (Also filed https://github.com/tabatkins/bikeshed/issues/2410 to prevent this.)