-
Notifications
You must be signed in to change notification settings - Fork 166
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
Future API changes to consider #677
Comments
I'm eager to see a lot of the lifetimes being removed from public structs, as I believe the lifetimes are making downstream use of vincent-herlemont/native_db kludgier than it could be. See vincent-herlemont/native_db#69 and vincent-herlemont/native_db#71. The main struct causing the troubles there is redb::TableDefinition. |
The lifetime relationships of |
@Ralith can you give |
That avoids the double-guard for reads, but it looks like the problem still exists for writes. Not sure how solvable that is without making things more dynamic, though. |
I plan to remove those too. Just haven't gotten to it yet
…Sent from my phone
On Sat, Jan 27, 2024, 11:12 PM Benjamin Saunders ***@***.***> wrote:
That avoids the double-guard for reads, but it looks like the problem
still exists for writes. Not sure how solvable that is without making
things more dynamic, though.
—
Reply to this email directly, view it on GitHub
<#677 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGNXQFNVHC4UQLEV5O5LB3YQX25ZAVCNFSM6AAAAAA4KWIGKCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJTGQ4DEMBQGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Recently I was trying to do something like
because of lifetime issues I couldn't find a way to return |
|
For future changes i’d like to also suggest this one:
This would obviously be a breaking change, hence »future change«. I’m suggesting this, because currently there are a bunch of completely useless |
Unfortunately, I don't think that would work. The call site can have a non Line 1212 in 222a37f
|
Well, yes. I’m suggesting to borrow the name when it’s |
Do you have an example of the code for that? I'm not sure how to make it conditional on whether the lifetime is 'static or not |
Oh right. I’ve been surfing on too much nightly Rust and forgot you can’t specialise over lifetimes. |
It looks like a double-guard is still needed for write transactions: |
Yes, that's correct. If you need it to be lifetime-less, I would recommend opening the tables on-demand rather than retaining them. |
That would work, but I hesitated since the cost of |
It's log N in the number of tables in the database, and for repeat opens of the same table should end up being about as expensive as a few HashMap lookups |
Those are good numbers to document in APIs. |
drain
anddrain_filter
withextract_if
to matchBtreeMap
. Waiting on the std API to stabilize, so we can match it. Tracking Issue for {BTreeMap,BTreeSet}::extract_if rust-lang/rust#70530MultimapValue
Table::len()
by storing the number of entries in a counter. Seelen
is slow #710stats()
andlen()
methodslen()
for untyped tablesRedbKey
toKey
andRedbValue
toValue
The text was updated successfully, but these errors were encountered: