-
Notifications
You must be signed in to change notification settings - Fork 110
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
Actually use indexes #73
Conversation
This could be rewritten a few different ways, but mostly wanted to get eyes on it and know if there should be some other abstraction around the indexes, Tyler. |
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.
Looks good! Some non-functional things I think could aid readability.
// We have to index_seek in both the committed state and the current tx state. | ||
// First, we will check modifications in the current tx. It may be that the table | ||
// has not been modified yet in the current tx, in which case we will only search | ||
// the committed state. Finally, the table may not be indexed at all, in which case | ||
// we fall back to iterating the entire table. | ||
|
||
// We need to check the tx_state first. In particular, it may be that the index | ||
// was only added in the current transaction. | ||
// TODO(george): It's unclear that we truly support dynamically creating an index | ||
// yet. In particular, I don't know if creating an index in a transaction and | ||
// rolling it back will leave the index in place. |
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.
❤️
// Either the current transaction has not modified this table, or the table is not | ||
// indexed. |
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.
// Either the current transaction has not modified this table, or the table is not | |
// indexed. | |
// Either the current transaction has modified this table, or the table is indexed. |
Not sure if this is better.
pub enum IterByColEq<'a> { | ||
Scan(ScanIterByColEq<'a>), | ||
Index(IndexIterByColEq<'a>), | ||
CommittedIndex(CommittedIndexIterByColEq<'a>), | ||
} |
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.
Docs on these would probably aid quicker understanding.
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.
Done
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.
Actually good question for you:
In this common pattern of
enum Foo {
X(X),
Y(Y),
}
struct X {}
struct Y {}
would you prefer the more substantial doc comments on the structs X and Y, or on the enum arms X and Y?
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.
Hmm that's a tough one. I think it depends on how often one has the Foo
version vs. the X/Y
versions. I think I tend to prefer more of the docs on the enum variants as they tend to be used like so Foo::X(X { the fields })
and it provides more context in relation to the other variants. That said, you can always back-link and such, so it's not a big deal either way.
!self | ||
.tx_state | ||
.delete_tables | ||
.get(&self.table_id) | ||
.map_or(false, |table| table.contains(row_id)) |
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 here two I think could help readability if it was made into a function with docs explaining the why.
2445b7b
to
f2cdd7f
Compare
f2cdd7f
to
6e9bf4b
Compare
6e9bf4b
to
f039536
Compare
* Actually use indexes * Get rid of unneeded references
* Actually use indexes * Get rid of unneeded references
Description of Changes
API
If the API is breaking, please state below what will break