-
Notifications
You must be signed in to change notification settings - Fork 825
TINKERPOP-1274: GraphSON 2.0 [revised] #386
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
Conversation
First off. Thank you for doing this. Here are some notes.
Thanks again for the extensive work. |
Hey @okram ,
Ok, it's some places here and there in the code, I'll correct it.
So, taking a step back and I'm going to use the exampleof ByteCode. As you can see in the
Let's admit for whatever reason the ByteCode serializer in the future needs to change and instead of writing a Map, it needs to start by an Array where the first element of the array is 'something', the rest is the Map described before, and close the array. Doing this is currently possible with the current format
Totally fine with |
NB: the conflicts for merge are caused by the CHANGELOG |
225f3e6
to
7e5ff1a
Compare
A remark: @okram requested |
I think I agree with @newkek to push that off until we can get his massive PR reviewed/merged. Let's see if we can solve that separately. |
I'm liking how this has turned out. |
is that an official +1 from you @PommeVerte or are you still reviewing ? |
Still reviewing I would like to finish going through the code :) will try and do this later in the day. But looking good so far |
7e5ff1a
to
115eb3c
Compare
I just pushed corrected docs, and renamed everything "domain" to "namespace". Waiting for more consensus to change the default gremlin namespace. |
All tests pass with |
VOTE +1 |
I'm waiting to hear back from marko on the points he brought up to cast my vote :) |
@newkek I understand. I like the VOTE +1. |
Ok cool if we're all ok with the new features then I'm satisfied. Code looked good as well VOTE: +1 |
@@ -54,6 +54,14 @@ | |||
public DefaultTraversalMetrics() { | |||
} | |||
|
|||
// This is only a convenient constructor needed for GraphSON deserialization. | |||
// TODO: see if that's ok to add that. | |||
public DefaultTraversalMetrics(long totalStepDurationNs, List<MutableMetrics> metricsMap) { |
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.
Not sure who I should ask about that, I decided to add a public constructor here for convenience during the deserialization, it takes the total duration, and a list of all the Metrics its composed of.
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.
I noticed that - I'll be making some tweaks once we get it over to master. I'll take a look at those odds and ends.
For context, a precise description is provided in the PR for the first version of the fix: #351. Please see this #351 PR first for initial context.
This PR provides the initial set of features defined in #351, plus the following:
As a reminder the format for types is the following:
value
{"@type":"typeName", "@value":value}
New type IDs format
A type ID is now composed of 2 parts, the "domain" and the type name. A "domain" can be used by any implementor to implement their own data type, avoiding collisions with the existing TinkerPop type IDs. The default domain for Graph object is "gremlin".
Types for all numeric values
A type is now present for every numeric value, the types have been renamed to be more understandable with regards to their memory sizes or kinds. As a reference, here is a description of all currently existing types and their corresponding Java implementation:
Integer
: "gremlin:int32"Long
: "gremlin:int64"Short
: "gremlin:int16"Float
: "gremlin:float"Double
: "gremlin:double"Types for all Graph objects.
New typeIDs introduced in #351 (time types, UUIDs, etc..) now follow the type format defined here: "domain:typename".
Types have now been included for Graph-specific objects, here is an exhaustive list of the existing types handled so far and their corresponding IDs:
Vertex
-> "gremlin:vertex"Edge
-> "gremlin:edge"VertexPropery
-> "gremlin:vertexproperty"Property
-> "gremlin:property"Path
-> "gremlin:path"Tree
-> "gremlin:tree"Graph
-> "gremlin:graph"Metrics
-> "gremlin:metrics"TraversalMetrics
-> `gremlin:traversalmetrics"This improvement defines a requirement to the serialization format which is that every type must have a Jackson serializer and deserializer defined on the source
ObjectMapper
. Previous not defined serializers and deserializers have been added in this PR.Code-wise, it's pretty much the same than for #351, the big intake in code here is the addition of the deserializers for all Graph objects, a big simplification to the serializers (
GraphSONSerializersV2d0
), the addition of the "domain" to the type system, and making that new typeID format configurable to users through theTinkerPopJacksonModule
.mvn clean install
test suite passes, and it's rebased on top of currentmaster
.