-
Notifications
You must be signed in to change notification settings - Fork 113
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
Move engine and lib components into separate files #438
Move engine and lib components into separate files #438
Conversation
Refactors library and engine structure to be less coupled. Pulls classes and interfaces out into individual files. Additionally, renames package from util to engine. Signed-off-by: John Mazanec <jmazane@amazon.com>
Removes complex versioning related to the engines. Simplifies it to a single string. Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
Codecov Report
@@ Coverage Diff @@
## main #438 +/- ##
============================================
- Coverage 84.02% 83.79% -0.24%
- Complexity 911 934 +23
============================================
Files 130 133 +3
Lines 3880 3831 -49
Branches 359 349 -10
============================================
- Hits 3260 3210 -50
- Misses 458 459 +1
Partials 162 162
Continue to review full report at Codecov.
|
class Nmslib extends NativeLibrary { | ||
|
||
final static String HNSW_LIB_NAME = "hnsw"; | ||
final static String EXTENSION = ".hnsw"; |
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.
final static String EXTENSION = ".hnsw"; | |
final static String HNSW_LIB_EXTENSION = ".hnsw"; |
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.
So this is a little bit confusing. HNSW_LIB_NAME is redundant with METHOD_HNSW, so I will delete that.
EXTENSION is actually the libraries extension. Given that we are in the Nmslib class, I think it can be kept as EXTENSION. Ill add a comment.
Signed-off-by: John Mazanec <jmazane@amazon.com>
Signed-off-by: John Mazanec <jmazane@amazon.com>
*/ | ||
@SuppressWarnings("unchecked") | ||
MethodAsMapBuilder addParameter(String parameterName, String prefix, String suffix) { | ||
indexDescription += prefix; |
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.
nit: maybe we can refactor in one of next PRs to something more efficient like StringBuilder. Seems we're accumulating multiple small strings and concatenate all of them into one final string object.
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.
That makes sense. Will take for future PR.
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, thank you
Refactors library and engine structure to be less coupled. Pulls classes and interfaces out into individual files. Cleans up implementation. Signed-off-by: John Mazanec <jmazane@amazon.com> (cherry picked from commit fe9f293)
Description
Refactors current implementation of the KNNEngine and KNNLIbrary abstractions. It pulls out the different components into their own files so that they are more readable and easier to modify.
Additionally, refactors lib versioning logic. Right now, we have two methods related to versioning: getLatestBuildVersion and getLatestLibVersion. The build version is used to build the filename for the engine. However, the getLatestLibVersion is not used. So, this PR simplifies it to just maintain the current lib version as a string.
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.