-
Notifications
You must be signed in to change notification settings - Fork 47
feat(accountsdb): add allocator param to get methods #958
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
base: main
Are you sure you want to change the base?
Conversation
50f0eec
to
322364a
Compare
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 is great. i just have one small request and a question
322364a
to
1c81af9
Compare
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.
Just one comment, otherwise love this
return .{ | ||
.lamports = account.lamports, | ||
.data = .{ .owned_allocation = data }, | ||
.data = .{ .unowned_allocation = account.data }, |
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.
Why not also just duplicate this data? This seems like it would be unsound in the event that we implement "cleaning logic" on this impl which runs while a caller is still holding onto their reference to it.
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.
We clone accounts on put, meaning that the ThreadSafeAccountMap itself owns all the account datas by this point already. If the caller calls .deinit() on the accounts they get from .get(), that's a no-op.
in the event that we implement "cleaning logic" on this impl which runs while a caller is still holding onto their reference to it.
I think we'd need to refcount the accounts in this case (or something equivalent), so that's out of scope
1c81af9
to
2750563
Compare
83dbabd
to
87c0c63
Compare
Main objective: add an allocator parameter to account gets - call sites currently rely on using the accountsdb allocator, which is pointless