-
Notifications
You must be signed in to change notification settings - Fork 91
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
MONGOCRYPT-755 Implement StrEncode #928
base: master
Are you sure you want to change the base?
Conversation
mc_substring_set_t *substring_set; | ||
char *exact; | ||
size_t exact_len; | ||
} mc_str_encode_sets_t; |
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.
add comment on these fields
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
src/mc-text-search-str-encode.c
Outdated
|
||
mc_str_encode_sets_t mc_text_search_str_encode(const mc_FLE2TextSearchInsertSpec_t *spec) { | ||
// TODO MONGOCRYPT-759 Implement and use CFold | ||
uint32_t unfolded_len = spec->len; |
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.
Add BSON_ASSERT_PARAM(spec)
before this
src/mc-text-search-str-encode.c
Outdated
sets.substring_set = NULL; | ||
// Base string is the folded string plus the 0xFF character | ||
sets.base_string = make_base_string_for_str_encode(folded_str, folded_len); | ||
sets.base_len = spec->len + 1; |
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.
sets.base_len = spec->len + 1; | |
sets.base_len = folded_len + 1; |
Prefer using folded/unfolded_len
over spec->len
.
src/mc-text-search-str-encode.c
Outdated
} | ||
// Exact string is always the first len characters of the base string | ||
sets.exact = sets.base_string; | ||
sets.exact_len = spec->len; |
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.
sets.exact_len = spec->len; | |
sets.exact_len = folded_len; |
same here
// TODO MONGOCRYPT-759 This helper only exists to test folded_len != unfolded_len; make the test actually use folding | ||
mc_str_encode_sets_t mc_text_search_str_encode_helper(const mc_FLE2TextSearchInsertSpec_t *spec, | ||
uint32_t unfolded_len) { | ||
const char *folded_str = spec->v; |
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.
add BSON_ASSERT_PARAM(spec)
before this
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
static mc_substring_set_t *generate_substring_tree(const char *base_str, | ||
uint32_t folded_len, | ||
uint32_t unfolded_len, | ||
const mc_FLE2SubstringInsertSpec_t *spec) { |
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 function also needs beta
and gamma
parameters which are the code-point lengths, not the byte length.
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 (folded codepoint len is inside the base string)
No description provided.