-
Notifications
You must be signed in to change notification settings - Fork 207
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
[Miniflare 3] Support durableObjectsPersist
option
#517
Conversation
|
durableObjectsPersist
optiondurableObjectsPersist
option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
Uses cloudflare/workerd#302 to enable Durable Object persistence. - `durableObjectsPersist: undefined | false | "memory:"` stores "in-memory" - `durableObjectsPersist: true` stores under `.mf` on the file-system - `durableObjectsPersist: "(file://)?<path>"` stores under `<path>` on the file-system Note Miniflare 2 persisted in-memory data between options reloads. In Miniflare 3, `workerd` restarts on every reload, so if we used `workerd`'s in-memory storage, we'd lose data every time options changed. To maintain Miniflare 2's behaviour, "in-memory" storage isn't actually in-memory. Instead, we write to a temporary directory and clean this up on `dispose()`/exit. 🙈 Also fixes a bug if multiple services bound to the same Durable Object class. This would result in duplicate entries in `durableObjectClassNames`. This has been changed from a `Map` of `string[]`s to a `Map` of `Set<string>`s to enforce the uniqueness constraint. Closes cloudflare/workers-sdk#2403 Closes cloudflare/workers-sdk#2458 Internal ticket: DEVX-219
e8b0ae0
to
8eda364
Compare
Uses cloudflare/workerd#302 to enable Durable Object persistence.
durableObjectsPersist: undefined | false | "memory:"
stores "in-memory"durableObjectsPersist: true
stores under.mf
on the file-systemdurableObjectsPersist: "(file://)?<path>"
stores under<path>
on the file-systemNote Miniflare 2 persisted in-memory data between options reloads. In Miniflare 3,
workerd
restarts on every reload, so if we usedworkerd
's in-memory storage, we'd lose data every time options changed. To maintain Miniflare 2's behaviour, "in-memory" storage isn't actually in-memory. Instead, we write to a temporary directory and clean this up ondispose()
/exit. 🙈Also fixes a bug if multiple services bound to the same Durable Object class. This would result in duplicate entries in
durableObjectClassNames
. This has been changed from aMap
ofstring[]
s to aMap
ofSet<string>
s to enforce the uniqueness constraint.Closes cloudflare/workers-sdk#2403
Closes cloudflare/workers-sdk#2458
Internal ticket: DEVX-219