-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting bucket expiration #79
Comments
I would much prefer It seems the current API already makes the mistake I pointed out in w3ctag/design-principles#425 that it doesn't validate the input is actually in the future. |
This does end up creating a slightly odd situation where the baseline time changes based on which part of the API you're looking at.
Absolute time means that all three ways of expressing this parameter will be consistent/symmetrical (e.g. Relative time creates potential for confusion in that one could assume that the baseline time is "last use". After all, the un-spec'd storage-pressure eviction priority for buckets is set by LRU, not bucket age (in Chromium). Using expressive verbiage for the symbol names should help with this, but I can't see how that mistake could possibly be made with absolute timestamps. I may be missing some context here which would change my assessment, but for the above reasons I would lean towards absolute times. I acknowledge the reasons enumerated on w3ctag/design-principles#425 but I don't think they're all relevant here (e.g. the argument about parsing a string representing a date) and many of the precedents don't have the same considerations listed above.
Yes, this is a bug in the spec, although Chromium's implementation does enforce it correctly. |
I'm not sure I fully follow. How about:
|
In the case of having + @asutherland curious if you have any thoughts as well! |
It'd have to be a relative number as well. Why do you consider a timestamp to be more useful? I think you make a compelling point that you want write/read consistency, but I'd imagine that if we exposed an API for when |
The expiration use case as currently specified is tailored to the use case of "I have a contractual or legal obligation around this data" (see points 2 and 3 of the expiration explainer). From my perspective this seems like an argument in favor of taking an explicit date/timestamp because that would be closest to the motivating use-case for expiration. For semantics like "please keep this around for at least 1 week if possible, but it would be nice if it stays around longer", a relative number seems more useful, especially if the expected use-case is doing something like |
@annevk thanks for the response!
Ah I see, my thought here was that if developers wanted to pass this value around at all, like for doing their own version of LRU or showing it in the UI, it would be more reliable to have this return as a point in time so the values don't get skewed by the time between calls. I think Jeffery explained this well as his first point in favor of points in time here. @asutherland - Thanks for your comment, that's a great distinction. I think "contractual obligation" matches how I see the expiration policy. |
Should expiration be set by timestamp or duration?
setExpires(Date.now() + duration_ms)
or
setMaxAge(duration_ms)
orsetExpiresByDuration()
While it is my personal preference to keep timestamp, there are reasons to consider duration as well. This change would also imply that with duration, the method name will be changed as well. This change could add clarity to reader's and wouldn't have to wonder if the input is by duration or timestamp.
On the other hand, there are precedents with expires as a timestamp as well. For example Cookie Store API will set expiration by timestamp. This would simply follow this familiar pattern.
Origin: https://github.com/WICG/storage-buckets/pull/62/files#r1133114171
@jyasskin @wanderview @noamr
The text was updated successfully, but these errors were encountered: