GitHub user tellison opened a pull request:
https://github.com/apache/incubator-pirk/pull/14
[PIRK-12] Refactor EncryptQuery#encrypt(int)
Here are a few refactorings, as described in each commit message, primarily
just pulling out logical steps into private helper methods.
Some points of note:
- reduced the double while-loop/breaks structures to simpler single
for-loops;
- combined the includes key checks with the insertion to avoid double
hashing in data structures;
- simplify the runner.
NB: the original code would change a hash collision to hash0, hash01,
hash012, ... but the new code goes to hash0, hash1, hash2, ... This can be
changed back if the original algorithm was intended, though it is unclear how
growing the string helps.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/tellison/incubator-pirk EncryptQuery
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-pirk/pull/14.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #14
----
commit d8d6c38f6bc11090beb49791957c77230c87ea95
Author: Tim Ellison <[email protected]>
Date: 2016-07-20T12:56:51Z
Pull out computation of selector query vector map.
- Collapse nested loops logic.
- Ensure existing hashes check is only done once (at add() and not also
at contains())
Modified hash ammendment to hash0, hash1, hash2, ... from hash0,
hash01, hash012, ...
commit 141f75362254071ee68a7e56c7f3e37ceeb8d8b4
Author: Tim Ellison <[email protected]>
Date: 2016-07-20T13:31:30Z
Simplify logic in EncryptQueryRunnable.
- Don't check containsKey() explicitly, that will be done as part of
get().
- No need for special casing the Zero branch entirely.
- Drop unused parameter.
commit c22dfa9c56a2d6132611532596d3e16e2105e240
Author: Tim Ellison <[email protected]>
Date: 2016-07-20T15:44:35Z
Extract the parallel encryption code to a private method.
commit 27398b90a65b5b10a5cc09e3a1dd075101576d8e
Author: Tim Ellison <[email protected]>
Date: 2016-07-20T15:59:04Z
Move population of the embedded selector map to it's own method.
commit aa92be56cfc65ae27a8b8be91dbfe3c38768813b
Author: Tim Ellison <[email protected]>
Date: 2016-07-20T16:31:59Z
Simplify (int) 2^n implementation.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---