-
Notifications
You must be signed in to change notification settings - Fork 504
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
Support uuid id type #618
Support uuid id type #618
Conversation
Codecov Report
@@ Coverage Diff @@
## master #618 +/- ##
============================================
- Coverage 71.89% 70.98% -0.91%
+ Complexity 3615 3574 -41
============================================
Files 218 219 +1
Lines 16802 16882 +80
Branches 2389 2399 +10
============================================
- Hits 12079 11983 -96
- Misses 3467 3630 +163
- Partials 1256 1269 +13
Continue to review full report at Codecov.
|
d5ce26d
to
59c4fae
Compare
@@ -143,6 +143,7 @@ public static void loadSchema(final HugeGraph graph) { | |||
schema.vertexLabel("reviewer").properties("name", "timestamp") | |||
.primaryKeys("name").create(); | |||
|
|||
|
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.
delete empty line
@@ -744,6 +743,75 @@ public void testAddVertexWithCustomizeNumberIdStrategyWithoutValidId() { | |||
}); | |||
} | |||
|
|||
@Test | |||
public void testAddVertexWithCustomizeUuidStrategy() { |
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.
testAddVertexWithCustomizeUuidIdStrategy()
} | ||
|
||
@Test | ||
public void testAddVertexWithCustomizeUuidStrategyWithoutValidId() { |
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.
ditto
@@ -318,6 +326,7 @@ public BytesBuffer writeId(Id id, boolean big) { | |||
len -= 1; | |||
int high = len >> 8; | |||
int low = len & 0xff; | |||
assert high != 0x7f; // The tail 7 bits 1 reserved for UUID |
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.
'len <= BIG_ID_MAX_LEN' can't ensure 'high != 0x7f',
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.
id len must be in range [0, 126]
public static final int ID_MAX_LEN = UINT8_MAX & 0x7f + 1; // 128 | ||
public static final int BIG_ID_MAX_LEN = UINT16_MAX & 0x7fff + 1; // 32768 | ||
public static final int ID_MAX_LEN = UINT8_MAX & 0x7f; // 127 | ||
public static final int BIG_ID_MAX_LEN = UINT16_MAX & 0x7fff; // 32767 |
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.
max length is 32767-256
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.
yes, 1byte id len must be in range [0, fe], 2byte id len must be in range [0, feff]
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.
sorry, 1byte id len must be in range [0, 7e], 2byte id len must be in range [0, 7eff]
implement #617 Change-Id: Ie05d7a3609dd1695728f0a2f4a322448ac8aabeb
Change-Id: Ia8046307813f21104c35e74afcb36cff2e3694dc
Change-Id: I0174d1ace1f193124cc37f4f1689ca087b91f525
Change-Id: I6f45a5a709fad866642073ddeb231b7500acf902
} | ||
|
||
public enum IdType { | ||
UNKONW, |
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.
spell error UNKONW -> UNKNOWN
return of(LongEncoding.decode(id)); | ||
case UUID: | ||
byte[] bytes = Base64.getDecoder().decode(id); | ||
return of(bytes, type); |
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.
just return of(bytes, UUID);
implement #617
Change-Id: Ie05d7a3609dd1695728f0a2f4a322448ac8aabeb