-
Notifications
You must be signed in to change notification settings - Fork 212
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
Implement durable kind API #4824
Conversation
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.
New functions must be arrow functions.
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.
All new functions must be arrow functions.
Aside from that, looks good to me!
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, thanks!
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.
This can probably land with just the recommended harden
calls.
Please think about the kindIDID
-on-DB issue, it may be that we can't address it properly until #4730 has a solution, in which case we could fix both at the same time. I guess at least add a note to the let kindIDID
line to remind us that in-RAM counters are going to be trouble.
Consider the "use 'defineDurableKindto define the
KindHandle` kind" thing, but I wouldn't consider it mandatory.
packages/SwingSet/test/virtualObjects/test-virtualObjectManager.js
Outdated
Show resolved
Hide resolved
return defineKindInternal(tag, init, actualize, finish, true); | ||
const makeKindHandle = tag => { | ||
if (!kindIDID) { | ||
kindIDID = `${allocateExportID()}`; |
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.
I'm a bit bothered by the idea that this will differ from one vat to another, depending upon when that vat happens to make it's first handle.. I think that's going to make debugging harder. It overlaps with a similar concern about the IDs used for the standard virtual collections.
Is there any good way to make these values be the same for all vats?
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.
I don't think there's a good way, though it's certainly quite doable. The reason I did it the way it works now is that many vats don't need these things at all and so they only get created/allocated the first time somebody asks for one. We could pre-allocate these for every vat, which would yield uniformity, but then we'd be carrying the overhead (mostly in the form of junk database entries, which I've found to be its own source of confusion when debugging) in all the places it's not used. In practice I haven't found the variance of the IDs from one vat to another to be a debugging issue, since if you are looking at things at that low a level you see the record of the ID allocations along with their use. And of course you typically debug in the context of a single vat and in that context the IDs stay the same from one debug run to another.
cd6ca3a
to
e090593
Compare
3892136
to
f14dee7
Compare
a644780
to
0696866
Compare
6c02b89
to
56bad98
Compare
This implements the durable kind API (though not the rest of the baggage machinery) per #4495
In particular, we provide the new
VatData
functionmakeKindHandle
to produce durable (and storable) handles that may be used to associate durable kinds with their implementations. At least, that is what it is called until we change the name again.Closes #4495