You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by dk...@apache.org on 2015/04/20 16:17:50 UTC
[13/23] incubator-tinkerpop git commit: Modified the Gryo header.
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/19f83de1/data/tinkerpop-classic-typed.json
----------------------------------------------------------------------
diff --git a/data/tinkerpop-classic-typed.json b/data/tinkerpop-classic-typed.json
index a4a08d7..e33304a 100644
--- a/data/tinkerpop-classic-typed.json
+++ b/data/tinkerpop-classic-typed.json
@@ -1 +1 @@
-{"variables":{"@class":"java.util.HashMap"},"vertices":[{"@class":"java.util.HashMap","id":1,"label":"vertex","type":"vertex","properties":{"@class":"java.util.HashMap","name":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":["java.lang.Long",0],"value":"marko","properties":{"@class":"java.util.HashMap"}}]],"age":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":["java.lang.Long",1],"value":29,"properties":{"@class":"java.util.HashMap"}}]]}},{"@class":"java.util.HashMap","id":2,"label":"vertex","type":"vertex","properties":{"@class":"java.util.HashMap","name":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":["java.lang.Long",2],"value":"vadas","properties":{"@class":"java.util.HashMap"}}]],"age":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":["java.lang.Long",3],"value":27,"properties":{"@class":"java.util.HashMap"}}]]}},{"@class":"java.util.HashMap","id":3,"label":"vertex","type":"vertex","properties":{"@class":"java.util.HashMap","name":["j
ava.util.ArrayList",[{"@class":"java.util.HashMap","id":["java.lang.Long",4],"value":"lop","properties":{"@class":"java.util.HashMap"}}]],"lang":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":["java.lang.Long",5],"value":"java","properties":{"@class":"java.util.HashMap"}}]]}},{"@class":"java.util.HashMap","id":4,"label":"vertex","type":"vertex","properties":{"@class":"java.util.HashMap","name":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":["java.lang.Long",6],"value":"josh","properties":{"@class":"java.util.HashMap"}}]],"age":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":["java.lang.Long",7],"value":32,"properties":{"@class":"java.util.HashMap"}}]]}},{"@class":"java.util.HashMap","id":5,"label":"vertex","type":"vertex","properties":{"@class":"java.util.HashMap","name":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":["java.lang.Long",8],"value":"ripple","properties":{"@class":"java.util.HashMap"}}]],"lang":["java.util.ArrayList",[{"@cl
ass":"java.util.HashMap","id":["java.lang.Long",9],"value":"java","properties":{"@class":"java.util.HashMap"}}]]}},{"@class":"java.util.HashMap","id":6,"label":"vertex","type":"vertex","properties":{"@class":"java.util.HashMap","name":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":["java.lang.Long",10],"value":"peter","properties":{"@class":"java.util.HashMap"}}]],"age":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":["java.lang.Long",11],"value":35,"properties":{"@class":"java.util.HashMap"}}]]}}],"edges":[{"@class":"java.util.HashMap","inV":2,"inVLabel":"vertex","outVLabel":"vertex","id":7,"label":"knows","type":"edge","outV":1,"properties":{"@class":"java.util.HashMap","weight":["java.lang.Float",0.5]}},{"@class":"java.util.HashMap","inV":4,"inVLabel":"vertex","outVLabel":"vertex","id":8,"label":"knows","type":"edge","outV":1,"properties":{"@class":"java.util.HashMap","weight":["java.lang.Float",1.0]}},{"@class":"java.util.HashMap","inV":3,"inVLabel":"verte
x","outVLabel":"vertex","id":9,"label":"created","type":"edge","outV":1,"properties":{"@class":"java.util.HashMap","weight":["java.lang.Float",0.4]}},{"@class":"java.util.HashMap","inV":5,"inVLabel":"vertex","outVLabel":"vertex","id":10,"label":"created","type":"edge","outV":4,"properties":{"@class":"java.util.HashMap","weight":["java.lang.Float",1.0]}},{"@class":"java.util.HashMap","inV":3,"inVLabel":"vertex","outVLabel":"vertex","id":11,"label":"created","type":"edge","outV":4,"properties":{"@class":"java.util.HashMap","weight":["java.lang.Float",0.4]}},{"@class":"java.util.HashMap","inV":3,"inVLabel":"vertex","outVLabel":"vertex","id":12,"label":"created","type":"edge","outV":6,"properties":{"@class":"java.util.HashMap","weight":["java.lang.Float",0.2]}}]}
\ No newline at end of file
+{"variables":{"@class":"java.util.HashMap"},"vertices":[{"@class":"java.util.HashMap","id":1,"label":"vertex","type":"vertex","properties":{"@class":"java.util.HashMap","name":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":0,"value":"marko","properties":{"@class":"java.util.HashMap"}}]],"age":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":2,"value":29,"properties":{"@class":"java.util.HashMap"}}]]}},{"@class":"java.util.HashMap","id":2,"label":"vertex","type":"vertex","properties":{"@class":"java.util.HashMap","name":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":3,"value":"vadas","properties":{"@class":"java.util.HashMap"}}]],"age":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":4,"value":27,"properties":{"@class":"java.util.HashMap"}}]]}},{"@class":"java.util.HashMap","id":3,"label":"vertex","type":"vertex","properties":{"@class":"java.util.HashMap","name":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":5,"value":"lop","pro
perties":{"@class":"java.util.HashMap"}}]],"lang":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":6,"value":"java","properties":{"@class":"java.util.HashMap"}}]]}},{"@class":"java.util.HashMap","id":4,"label":"vertex","type":"vertex","properties":{"@class":"java.util.HashMap","name":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":7,"value":"josh","properties":{"@class":"java.util.HashMap"}}]],"age":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":8,"value":32,"properties":{"@class":"java.util.HashMap"}}]]}},{"@class":"java.util.HashMap","id":5,"label":"vertex","type":"vertex","properties":{"@class":"java.util.HashMap","name":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":9,"value":"ripple","properties":{"@class":"java.util.HashMap"}}]],"lang":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":10,"value":"java","properties":{"@class":"java.util.HashMap"}}]]}},{"@class":"java.util.HashMap","id":6,"label":"vertex","type":"vertex","pro
perties":{"@class":"java.util.HashMap","name":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":11,"value":"peter","properties":{"@class":"java.util.HashMap"}}]],"age":["java.util.ArrayList",[{"@class":"java.util.HashMap","id":12,"value":35,"properties":{"@class":"java.util.HashMap"}}]]}}],"edges":[{"@class":"java.util.HashMap","inV":2,"inVLabel":"vertex","outVLabel":"vertex","id":7,"label":"knows","type":"edge","outV":1,"properties":{"@class":"java.util.HashMap","weight":["java.lang.Float",0.5]}},{"@class":"java.util.HashMap","inV":4,"inVLabel":"vertex","outVLabel":"vertex","id":8,"label":"knows","type":"edge","outV":1,"properties":{"@class":"java.util.HashMap","weight":["java.lang.Float",1.0]}},{"@class":"java.util.HashMap","inV":3,"inVLabel":"vertex","outVLabel":"vertex","id":9,"label":"created","type":"edge","outV":1,"properties":{"@class":"java.util.HashMap","weight":["java.lang.Float",0.4]}},{"@class":"java.util.HashMap","inV":5,"inVLabel":"vertex","outVLabel":"vertex
","id":10,"label":"created","type":"edge","outV":4,"properties":{"@class":"java.util.HashMap","weight":["java.lang.Float",1.0]}},{"@class":"java.util.HashMap","inV":3,"inVLabel":"vertex","outVLabel":"vertex","id":11,"label":"created","type":"edge","outV":4,"properties":{"@class":"java.util.HashMap","weight":["java.lang.Float",0.4]}},{"@class":"java.util.HashMap","inV":3,"inVLabel":"vertex","outVLabel":"vertex","id":12,"label":"created","type":"edge","outV":6,"properties":{"@class":"java.util.HashMap","weight":["java.lang.Float",0.2]}}]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/19f83de1/data/tinkerpop-classic-vertices.kryo
----------------------------------------------------------------------
diff --git a/data/tinkerpop-classic-vertices.kryo b/data/tinkerpop-classic-vertices.kryo
index 33f8766..e01dc10 100644
Binary files a/data/tinkerpop-classic-vertices.kryo and b/data/tinkerpop-classic-vertices.kryo differ
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/19f83de1/data/tinkerpop-classic-vertices.ldjson
----------------------------------------------------------------------
diff --git a/data/tinkerpop-classic-vertices.ldjson b/data/tinkerpop-classic-vertices.ldjson
index f9669f3..c8dbe4a 100644
--- a/data/tinkerpop-classic-vertices.ldjson
+++ b/data/tinkerpop-classic-vertices.ldjson
@@ -1,6 +1,6 @@
-{"inE":[],"outE":[{"inV":3,"inVLabel":"vertex","outVLabel":"vertex","id":9,"label":"created","type":"edge","outV":1,"properties":{"weight":0.4}},{"inV":2,"inVLabel":"vertex","outVLabel":"vertex","id":7,"label":"knows","type":"edge","outV":1,"properties":{"weight":0.5}},{"inV":4,"inVLabel":"vertex","outVLabel":"vertex","id":8,"label":"knows","type":"edge","outV":1,"properties":{"weight":1.0}}],"id":1,"label":"vertex","type":"vertex","properties":{"name":[{"id":0,"label":"name","value":"marko","properties":{}}],"age":[{"id":1,"label":"age","value":29,"properties":{}}]}}
-{"inE":[{"inV":2,"inVLabel":"vertex","outVLabel":"vertex","id":7,"label":"knows","type":"edge","outV":1,"properties":{"weight":0.5}}],"outE":[],"id":2,"label":"vertex","type":"vertex","properties":{"name":[{"id":2,"label":"name","value":"vadas","properties":{}}],"age":[{"id":3,"label":"age","value":27,"properties":{}}]}}
-{"inE":[{"inV":3,"inVLabel":"vertex","outVLabel":"vertex","id":9,"label":"created","type":"edge","outV":1,"properties":{"weight":0.4}},{"inV":3,"inVLabel":"vertex","outVLabel":"vertex","id":11,"label":"created","type":"edge","outV":4,"properties":{"weight":0.4}},{"inV":3,"inVLabel":"vertex","outVLabel":"vertex","id":12,"label":"created","type":"edge","outV":6,"properties":{"weight":0.2}}],"outE":[],"id":3,"label":"vertex","type":"vertex","properties":{"name":[{"id":4,"label":"name","value":"lop","properties":{}}],"lang":[{"id":5,"label":"lang","value":"java","properties":{}}]}}
-{"inE":[{"inV":4,"inVLabel":"vertex","outVLabel":"vertex","id":8,"label":"knows","type":"edge","outV":1,"properties":{"weight":1.0}}],"outE":[{"inV":5,"inVLabel":"vertex","outVLabel":"vertex","id":10,"label":"created","type":"edge","outV":4,"properties":{"weight":1.0}},{"inV":3,"inVLabel":"vertex","outVLabel":"vertex","id":11,"label":"created","type":"edge","outV":4,"properties":{"weight":0.4}}],"id":4,"label":"vertex","type":"vertex","properties":{"name":[{"id":6,"label":"name","value":"josh","properties":{}}],"age":[{"id":7,"label":"age","value":32,"properties":{}}]}}
-{"inE":[{"inV":5,"inVLabel":"vertex","outVLabel":"vertex","id":10,"label":"created","type":"edge","outV":4,"properties":{"weight":1.0}}],"outE":[],"id":5,"label":"vertex","type":"vertex","properties":{"name":[{"id":8,"label":"name","value":"ripple","properties":{}}],"lang":[{"id":9,"label":"lang","value":"java","properties":{}}]}}
-{"inE":[],"outE":[{"inV":3,"inVLabel":"vertex","outVLabel":"vertex","id":12,"label":"created","type":"edge","outV":6,"properties":{"weight":0.2}}],"id":6,"label":"vertex","type":"vertex","properties":{"name":[{"id":10,"label":"name","value":"peter","properties":{}}],"age":[{"id":11,"label":"age","value":35,"properties":{}}]}}
+{"inE":[],"outE":[{"inV":3,"inVLabel":"vertex","outVLabel":"vertex","id":9,"label":"created","type":"edge","outV":1,"properties":{"weight":0.4}},{"inV":2,"inVLabel":"vertex","outVLabel":"vertex","id":7,"label":"knows","type":"edge","outV":1,"properties":{"weight":0.5}},{"inV":4,"inVLabel":"vertex","outVLabel":"vertex","id":8,"label":"knows","type":"edge","outV":1,"properties":{"weight":1.0}}],"id":1,"label":"vertex","type":"vertex","properties":{"name":[{"id":0,"label":"name","value":"marko","properties":{}}],"age":[{"id":2,"label":"age","value":29,"properties":{}}]}}
+{"inE":[{"inV":2,"inVLabel":"vertex","outVLabel":"vertex","id":7,"label":"knows","type":"edge","outV":1,"properties":{"weight":0.5}}],"outE":[],"id":2,"label":"vertex","type":"vertex","properties":{"name":[{"id":3,"label":"name","value":"vadas","properties":{}}],"age":[{"id":4,"label":"age","value":27,"properties":{}}]}}
+{"inE":[{"inV":3,"inVLabel":"vertex","outVLabel":"vertex","id":9,"label":"created","type":"edge","outV":1,"properties":{"weight":0.4}},{"inV":3,"inVLabel":"vertex","outVLabel":"vertex","id":11,"label":"created","type":"edge","outV":4,"properties":{"weight":0.4}},{"inV":3,"inVLabel":"vertex","outVLabel":"vertex","id":12,"label":"created","type":"edge","outV":6,"properties":{"weight":0.2}}],"outE":[],"id":3,"label":"vertex","type":"vertex","properties":{"name":[{"id":5,"label":"name","value":"lop","properties":{}}],"lang":[{"id":6,"label":"lang","value":"java","properties":{}}]}}
+{"inE":[{"inV":4,"inVLabel":"vertex","outVLabel":"vertex","id":8,"label":"knows","type":"edge","outV":1,"properties":{"weight":1.0}}],"outE":[{"inV":5,"inVLabel":"vertex","outVLabel":"vertex","id":10,"label":"created","type":"edge","outV":4,"properties":{"weight":1.0}},{"inV":3,"inVLabel":"vertex","outVLabel":"vertex","id":11,"label":"created","type":"edge","outV":4,"properties":{"weight":0.4}}],"id":4,"label":"vertex","type":"vertex","properties":{"name":[{"id":7,"label":"name","value":"josh","properties":{}}],"age":[{"id":8,"label":"age","value":32,"properties":{}}]}}
+{"inE":[{"inV":5,"inVLabel":"vertex","outVLabel":"vertex","id":10,"label":"created","type":"edge","outV":4,"properties":{"weight":1.0}}],"outE":[],"id":5,"label":"vertex","type":"vertex","properties":{"name":[{"id":9,"label":"name","value":"ripple","properties":{}}],"lang":[{"id":10,"label":"lang","value":"java","properties":{}}]}}
+{"inE":[],"outE":[{"inV":3,"inVLabel":"vertex","outVLabel":"vertex","id":12,"label":"created","type":"edge","outV":6,"properties":{"weight":0.2}}],"id":6,"label":"vertex","type":"vertex","properties":{"name":[{"id":11,"label":"name","value":"peter","properties":{}}],"age":[{"id":12,"label":"age","value":35,"properties":{}}]}}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/19f83de1/data/tinkerpop-classic.json
----------------------------------------------------------------------
diff --git a/data/tinkerpop-classic.json b/data/tinkerpop-classic.json
index 27b9cce..003028f 100644
--- a/data/tinkerpop-classic.json
+++ b/data/tinkerpop-classic.json
@@ -1 +1 @@
-{"variables":{},"vertices":[{"id":1,"label":"vertex","type":"vertex","properties":{"name":[{"id":0,"value":"marko","properties":{}}],"age":[{"id":1,"value":29,"properties":{}}]}},{"id":2,"label":"vertex","type":"vertex","properties":{"name":[{"id":2,"value":"vadas","properties":{}}],"age":[{"id":3,"value":27,"properties":{}}]}},{"id":3,"label":"vertex","type":"vertex","properties":{"name":[{"id":4,"value":"lop","properties":{}}],"lang":[{"id":5,"value":"java","properties":{}}]}},{"id":4,"label":"vertex","type":"vertex","properties":{"name":[{"id":6,"value":"josh","properties":{}}],"age":[{"id":7,"value":32,"properties":{}}]}},{"id":5,"label":"vertex","type":"vertex","properties":{"name":[{"id":8,"value":"ripple","properties":{}}],"lang":[{"id":9,"value":"java","properties":{}}]}},{"id":6,"label":"vertex","type":"vertex","properties":{"name":[{"id":10,"value":"peter","properties":{}}],"age":[{"id":11,"value":35,"properties":{}}]}}],"edges":[{"inV":2,"inVLabel":"vertex","outVLabel":"v
ertex","id":7,"label":"knows","type":"edge","outV":1,"properties":{"weight":0.5}},{"inV":4,"inVLabel":"vertex","outVLabel":"vertex","id":8,"label":"knows","type":"edge","outV":1,"properties":{"weight":1.0}},{"inV":3,"inVLabel":"vertex","outVLabel":"vertex","id":9,"label":"created","type":"edge","outV":1,"properties":{"weight":0.4}},{"inV":5,"inVLabel":"vertex","outVLabel":"vertex","id":10,"label":"created","type":"edge","outV":4,"properties":{"weight":1.0}},{"inV":3,"inVLabel":"vertex","outVLabel":"vertex","id":11,"label":"created","type":"edge","outV":4,"properties":{"weight":0.4}},{"inV":3,"inVLabel":"vertex","outVLabel":"vertex","id":12,"label":"created","type":"edge","outV":6,"properties":{"weight":0.2}}]}
\ No newline at end of file
+{"variables":{},"vertices":[{"id":1,"label":"vertex","type":"vertex","properties":{"name":[{"id":0,"value":"marko","properties":{}}],"age":[{"id":2,"value":29,"properties":{}}]}},{"id":2,"label":"vertex","type":"vertex","properties":{"name":[{"id":3,"value":"vadas","properties":{}}],"age":[{"id":4,"value":27,"properties":{}}]}},{"id":3,"label":"vertex","type":"vertex","properties":{"name":[{"id":5,"value":"lop","properties":{}}],"lang":[{"id":6,"value":"java","properties":{}}]}},{"id":4,"label":"vertex","type":"vertex","properties":{"name":[{"id":7,"value":"josh","properties":{}}],"age":[{"id":8,"value":32,"properties":{}}]}},{"id":5,"label":"vertex","type":"vertex","properties":{"name":[{"id":9,"value":"ripple","properties":{}}],"lang":[{"id":10,"value":"java","properties":{}}]}},{"id":6,"label":"vertex","type":"vertex","properties":{"name":[{"id":11,"value":"peter","properties":{}}],"age":[{"id":12,"value":35,"properties":{}}]}}],"edges":[{"inV":2,"inVLabel":"vertex","outVLabel":"
vertex","id":7,"label":"knows","type":"edge","outV":1,"properties":{"weight":0.5}},{"inV":4,"inVLabel":"vertex","outVLabel":"vertex","id":8,"label":"knows","type":"edge","outV":1,"properties":{"weight":1.0}},{"inV":3,"inVLabel":"vertex","outVLabel":"vertex","id":9,"label":"created","type":"edge","outV":1,"properties":{"weight":0.4}},{"inV":5,"inVLabel":"vertex","outVLabel":"vertex","id":10,"label":"created","type":"edge","outV":4,"properties":{"weight":1.0}},{"inV":3,"inVLabel":"vertex","outVLabel":"vertex","id":11,"label":"created","type":"edge","outV":4,"properties":{"weight":0.4}},{"inV":3,"inVLabel":"vertex","outVLabel":"vertex","id":12,"label":"created","type":"edge","outV":6,"properties":{"weight":0.2}}]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/19f83de1/data/tinkerpop-classic.kryo
----------------------------------------------------------------------
diff --git a/data/tinkerpop-classic.kryo b/data/tinkerpop-classic.kryo
index e2f72c6..10e10cc 100644
Binary files a/data/tinkerpop-classic.kryo and b/data/tinkerpop-classic.kryo differ
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/19f83de1/data/tinkerpop-crew-vertices.kryo
----------------------------------------------------------------------
diff --git a/data/tinkerpop-crew-vertices.kryo b/data/tinkerpop-crew-vertices.kryo
index 8289cd8..8bf40c7 100644
Binary files a/data/tinkerpop-crew-vertices.kryo and b/data/tinkerpop-crew-vertices.kryo differ
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/19f83de1/data/tinkerpop-crew.kryo
----------------------------------------------------------------------
diff --git a/data/tinkerpop-crew.kryo b/data/tinkerpop-crew.kryo
index 3e8ac2d..9ac8b4c 100644
Binary files a/data/tinkerpop-crew.kryo and b/data/tinkerpop-crew.kryo differ
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/19f83de1/data/tinkerpop-modern-vertices.kryo
----------------------------------------------------------------------
diff --git a/data/tinkerpop-modern-vertices.kryo b/data/tinkerpop-modern-vertices.kryo
index 760e4d4..2ff096d 100644
Binary files a/data/tinkerpop-modern-vertices.kryo and b/data/tinkerpop-modern-vertices.kryo differ
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/19f83de1/data/tinkerpop-modern.kryo
----------------------------------------------------------------------
diff --git a/data/tinkerpop-modern.kryo b/data/tinkerpop-modern.kryo
index 05e6101..3feda2e 100644
Binary files a/data/tinkerpop-modern.kryo and b/data/tinkerpop-modern.kryo differ
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/19f83de1/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
index 045d40d..9bdf9d4 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
@@ -52,13 +52,10 @@ import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceVertexProp
import org.apache.tinkerpop.shaded.kryo.Kryo;
import org.apache.tinkerpop.shaded.kryo.KryoSerializable;
import org.apache.tinkerpop.shaded.kryo.Serializer;
-import org.apache.tinkerpop.shaded.kryo.io.Input;
-import org.apache.tinkerpop.shaded.kryo.io.Output;
import org.apache.tinkerpop.shaded.kryo.util.DefaultStreamFactory;
import org.apache.tinkerpop.shaded.kryo.util.MapReferenceResolver;
import org.javatuples.Triplet;
-import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.URI;
@@ -83,9 +80,7 @@ import java.util.TreeSet;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
-import java.util.function.BiPredicate;
import java.util.function.Function;
-import java.util.function.Predicate;
import java.util.stream.Collectors;
/**
@@ -94,28 +89,12 @@ import java.util.stream.Collectors;
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
public final class GryoMapper implements Mapper<Kryo> {
- static final byte[] GIO = "gio".getBytes();
+ public static final byte[] GIO = "gio".getBytes();
+ public static final byte[] HEADER = Arrays.copyOf(GIO, 16);
private final List<Triplet<Class, Function<Kryo, Serializer>, Integer>> serializationList;
- private final HeaderWriter headerWriter;
- private final HeaderReader headerReader;
- private final byte[] versionedHeader;
- public static final byte DEFAULT_EXTENDED_VERSION = Byte.MIN_VALUE;
-
- private GryoMapper(final List<Triplet<Class, Function<Kryo, Serializer>, Integer>> serializationList,
- final HeaderWriter headerWriter,
- final HeaderReader headerReader) {
+ private GryoMapper(final List<Triplet<Class, Function<Kryo, Serializer>, Integer>> serializationList) {
this.serializationList = serializationList;
- this.headerWriter = headerWriter;
- this.headerReader = headerReader;
-
- final Output out = new Output(32);
- try {
- this.headerWriter.write(out);
- } catch (IOException ioe) {
- throw new RuntimeException(ioe);
- }
- this.versionedHeader = out.toBytes();
}
@Override
@@ -133,107 +112,18 @@ public final class GryoMapper implements Mapper<Kryo> {
return kryo;
}
- public HeaderWriter getHeaderWriter() {
- return headerWriter;
- }
-
- public HeaderReader getHeaderReader() {
- return headerReader;
- }
-
public List<Class> getRegisteredClasses() {
return this.serializationList.stream().map(Triplet::getValue0).collect(Collectors.toList());
}
- /**
- * Gets the header for a Gremlin Kryo file, which is based on the version of Gremlin Kryo that is constructed
- * via the builder classes.
- */
- public byte[] getVersionedHeader() {
- return versionedHeader;
- }
-
- @FunctionalInterface
- public interface HeaderReader {
- public void read(final Input input) throws IOException;
- }
-
- @FunctionalInterface
- public interface HeaderWriter {
- public void write(final Output output) throws IOException;
- }
-
- /**
- * Use a specific version of Gryo.
- */
- public static Builder build(final Version version) {
- return version.getBuilder();
+ public static Builder build() {
+ return new Builder();
}
/**
- * Use the most current version of Gryo.
+ * A builder to construct a {@link GryoMapper} instance.
*/
- public static Builder build() {
- return Version.V_1_0_0.getBuilder();
- }
-
- public static interface Builder {
- /**
- * Add mapper classes to serializes with gryo using standard serialization.
- */
- public Builder addCustom(final Class... custom);
-
- /**
- * Add mapper class to serializes with mapper serialization.
- */
- public Builder addCustom(final Class clazz, final Serializer serializer);
-
- /**
- * Add mapper class to serializes with mapper serialization as returned from a {@link Function}.
- */
- public Builder addCustom(final Class clazz, final Function<Kryo, Serializer> serializer);
-
- /**
- * If using mapper classes it might be useful to tag the version stamped to the serialization with a mapper
- * value, such that Gryo serialization at 1.0.0 would have a fourth byte for an extended version. The user
- * supplied fourth byte can then be used to ensure the right deserializer is used to read the data. If this
- * value is not supplied then it is written as {@link Byte#MIN_VALUE}. The value supplied here should be greater
- * than or equal to zero.
- */
- public Builder extendedVersion(final byte extendedVersion);
-
- /**
- * By default the {@link #extendedVersion(byte)} is checked against what is read from an input source and if
- * those values are equal the version being read is considered "compliant". To alter this behavior, supply a
- * mapper compliance {@link Predicate} to evaluate the value read from the input source (i.e. first argument)
- * and the value marked in the {@code GryoMapper} instance {i.e. second argument}. Supplying this function is
- * useful when versions require backward compatibility or other more complex checks. This function is only used
- * if the {@link #extendedVersion(byte)} is set to something other than its default.
- */
- public Builder compliant(final BiPredicate<Byte, Byte> compliant);
-
- public GryoMapper create();
- }
-
- public enum Version {
- V_1_0_0(BuilderV1d0.class);
-
- private final Class<? extends Builder> builder;
-
- private Version(final Class<? extends Builder> builder) {
- this.builder = builder;
- }
-
- Builder getBuilder() {
- try {
- return builder.newInstance();
- } catch (Exception x) {
- throw new RuntimeException("Gryo Builder implementation cannot be instantiated", x);
- }
- }
- }
-
- public static class BuilderV1d0 implements Builder {
+ public static class Builder {
/**
* Map with one entry that is used so that it is possible to get the class of LinkedHashMap.Entry.
@@ -328,22 +218,16 @@ public final class GryoMapper implements Mapper<Kryo> {
add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(DependantMutableMetrics.class, null, 80));
}};
- private static final byte major = 1;
- private static final byte minor = 0;
- private static final byte patchLevel = 0;
-
- private byte extendedVersion = DEFAULT_EXTENDED_VERSION;
- private BiPredicate<Byte, Byte> compliant = (readExt, serExt) -> readExt.equals(serExt);
-
/**
* Starts numbering classes for Gryo serialization at 65536 to leave room for future usage by TinkerPop.
*/
private final AtomicInteger currentSerializationId = new AtomicInteger(65536);
+ private Builder() {}
+
/**
- * {@inheritDoc}
+ * Register custom classes to serializes with gryo using default serialization.
*/
- @Override
public Builder addCustom(final Class... custom) {
if (custom != null && custom.length > 0)
serializationList.addAll(Arrays.asList(custom).stream()
@@ -353,87 +237,23 @@ public final class GryoMapper implements Mapper<Kryo> {
}
/**
- * {@inheritDoc}
+ * Register custom class to serialize with a custom serialization class.
*/
- @Override
public Builder addCustom(final Class clazz, final Serializer serializer) {
serializationList.add(Triplet.with(clazz, kryo -> serializer, currentSerializationId.getAndIncrement()));
return this;
}
/**
- * {@inheritDoc}
+ * Register a custom class to serialize with a custom serializer as returned from a {@link Function}.
*/
- @Override
public Builder addCustom(final Class clazz, final Function<Kryo, Serializer> serializer) {
serializationList.add(Triplet.with(clazz, serializer, currentSerializationId.getAndIncrement()));
return this;
}
- /**
- * {@inheritDoc}
- */
- @Override
- public Builder extendedVersion(final byte extendedVersion) {
- if (extendedVersion > DEFAULT_EXTENDED_VERSION && extendedVersion < 0)
- throw new IllegalArgumentException("The extendedVersion must be greater than zero");
-
- this.extendedVersion = extendedVersion;
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Builder compliant(final BiPredicate<Byte, Byte> compliant) {
- if (null == compliant)
- throw new IllegalArgumentException("compliant");
-
- this.compliant = compliant;
- return this;
- }
-
- @Override
public GryoMapper create() {
- return new GryoMapper(serializationList, this::writeHeader, this::readHeader);
- }
-
- private void writeHeader(final Output output) throws IOException {
- // 32 byte header total
- output.writeBytes(GIO);
-
- // some space for later
- output.writeBytes(new byte[25]);
-
- // version x.y.z
- output.writeByte(major);
- output.writeByte(minor);
- output.writeByte(patchLevel);
- output.writeByte(extendedVersion);
- }
-
- private void readHeader(final Input input) throws IOException {
- if (!Arrays.equals(GIO, input.readBytes(3)))
- throw new IOException("Invalid format - first three bytes of header do not match expected value");
-
- // skip the next 25 bytes in v1
- input.readBytes(25);
-
- // final three bytes of header are the version which should be 1.0.0
- final byte[] version = input.readBytes(3);
- final byte extension = input.readByte();
-
- // direct match on version for now
- if (version[0] != major || version[1] != minor || version[2] != patchLevel)
- throw new IOException(String.format(
- "The version [%s.%s.%s] in the stream cannot be understood by this reader",
- version[0], version[1], version[2]));
-
- if (extendedVersion >= 0 && !compliant.test(extension, extendedVersion))
- throw new IOException(String.format(
- "The extension [%s] in the input source is not compliant with this configuration of Gryo - [%s]",
- extension, extendedVersion));
+ return new GryoMapper(serializationList);
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/19f83de1/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java
index 5299d2f..a715b7f 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java
@@ -58,7 +58,6 @@ import java.util.function.Function;
*/
public class GryoReader implements GraphReader {
private final Kryo kryo;
- private final GryoMapper.HeaderReader headerReader;
private final long batchSize;
private final String vertexIdKey;
@@ -70,7 +69,6 @@ public class GryoReader implements GraphReader {
final String vertexIdKey, final String edgeIdKey,
final GryoMapper gryoMapper) {
this.kryo = gryoMapper.createMapper();
- this.headerReader = gryoMapper.getHeaderReader();
this.vertexIdKey = vertexIdKey;
this.edgeIdKey = edgeIdKey;
this.tempFile = tempFile;
@@ -107,7 +105,7 @@ public class GryoReader implements GraphReader {
@Override
public Edge readEdge(final InputStream inputStream, final Function<DetachedEdge, Edge> edgeMaker) throws IOException {
final Input input = new Input(inputStream);
- this.headerReader.read(input);
+ readHeader(input);
final Object o = kryo.readClassAndObject(input);
return edgeMaker.apply((DetachedEdge) o);
}
@@ -126,7 +124,7 @@ public class GryoReader implements GraphReader {
@Override
public void readGraph(final InputStream inputStream, final Graph graphToWriteTo) throws IOException {
final Input input = new Input(inputStream);
- this.headerReader.read(input);
+ readHeader(input);
final BatchGraph graph;
try {
@@ -217,7 +215,7 @@ public class GryoReader implements GraphReader {
if (null != directionRequested && null == edgeMaker)
throw new IllegalArgumentException("If a directionRequested is specified then an edgeAdder function should also be specified");
- this.headerReader.read(input);
+ readHeader(input);
final Vertex vertex = vertexMaker.apply((DetachedVertex) kryo.readClassAndObject(input));
@@ -276,6 +274,14 @@ public class GryoReader implements GraphReader {
}
}
+ private void readHeader(final Input input) throws IOException {
+ if (!Arrays.equals(GryoMapper.GIO, input.readBytes(3)))
+ throw new IOException("Invalid format - first three bytes of header do not match expected value");
+
+ // skip the next 13 bytes - for future use
+ input.readBytes(13);
+ }
+
/**
* Reads through the all the edges for a vertex and writes the edges to a temp file which will be read later.
*/
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/19f83de1/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
index cf82579..3b011ef 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
@@ -44,17 +44,15 @@ import java.util.Iterator;
*/
public class GryoWriter implements GraphWriter {
private Kryo kryo;
- private final GryoMapper.HeaderWriter headerWriter;
private GryoWriter(final GryoMapper gryoMapper) {
this.kryo = gryoMapper.createMapper();
- this.headerWriter = gryoMapper.getHeaderWriter();
}
@Override
public void writeGraph(final OutputStream outputStream, final Graph g) throws IOException {
final Output output = new Output(outputStream);
- this.headerWriter.write(output);
+ writeHeader(output);
final boolean supportsGraphVariables = g.features().graph().variables().supportsVariables();
output.writeBoolean(supportsGraphVariables);
@@ -75,7 +73,7 @@ public class GryoWriter implements GraphWriter {
@Override
public void writeVertex(final OutputStream outputStream, final Vertex v, final Direction direction) throws IOException {
final Output output = new Output(outputStream);
- this.headerWriter.write(output);
+ writeHeader(output);
writeVertexToOutput(output, v, direction);
output.flush();
}
@@ -83,7 +81,7 @@ public class GryoWriter implements GraphWriter {
@Override
public void writeVertex(final OutputStream outputStream, final Vertex v) throws IOException {
final Output output = new Output(outputStream);
- this.headerWriter.write(output);
+ writeHeader(output);
writeVertexWithNoEdgesToOutput(output, v);
output.flush();
}
@@ -91,11 +89,15 @@ public class GryoWriter implements GraphWriter {
@Override
public void writeEdge(final OutputStream outputStream, final Edge e) throws IOException {
final Output output = new Output(outputStream);
- this.headerWriter.write(output);
+ writeHeader(output);
kryo.writeClassAndObject(output, DetachedFactory.detach(e, true));
output.flush();
}
+ void writeHeader(final Output output) throws IOException {
+ output.writeBytes(GryoMapper.HEADER);
+ }
+
private void writeEdgeToOutput(final Output output, final Edge e) {
this.writeElement(output, e, null);
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/19f83de1/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java
index 7fba9a1..9d44eae 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java
@@ -75,7 +75,7 @@ public class GryoMessageSerializerV1d0 implements MessageSerializer {
* will be overriden by {@link #configure} is called.
*/
public GryoMessageSerializerV1d0() {
- gryoMapper = GryoMapper.build(GryoMapper.Version.V_1_0_0).create();
+ gryoMapper = GryoMapper.build().create();
}
/**
@@ -88,15 +88,7 @@ public class GryoMessageSerializerV1d0 implements MessageSerializer {
@Override
public void configure(final Map<String, Object> config, final Map<String, Graph> graphs) {
- final byte extendedVersion;
- try {
- extendedVersion = Byte.parseByte(config.getOrDefault(TOKEN_EXTENDED_VERSION, GryoMapper.DEFAULT_EXTENDED_VERSION).toString());
- } catch (Exception ex) {
- throw new IllegalStateException(String.format("Invalid configuration value of [%s] for [%s] setting on %s serialization configuration",
- config.getOrDefault(TOKEN_EXTENDED_VERSION, ""), TOKEN_EXTENDED_VERSION, this.getClass().getName()), ex);
- }
-
- final GryoMapper.Builder initialBuilder;
+ final GryoMapper.Builder builder;
final Object graphToUseForMapper = config.get(TOKEN_USE_MAPPER_FROM_GRAPH);
if (graphToUseForMapper != null) {
if (null == graphs) throw new IllegalStateException(String.format(
@@ -109,16 +101,14 @@ public class GryoMessageSerializerV1d0 implements MessageSerializer {
// a graph was found so use the mapper it constructs. this allows gryo to be auto-configured with any
// custom classes that the implementation allows for
- initialBuilder = g.io().gryoMapper();
+ builder = g.io().gryoMapper();
} else {
// no graph was supplied so just use the default - this will likely be the case when using a graph
// with no custom classes or a situation where the user needs complete control like when using two
// distinct implementations each with their own custom classes.
- initialBuilder = GryoMapper.build(GryoMapper.Version.V_1_0_0);
+ builder = GryoMapper.build();
}
- final GryoMapper.Builder builder = initialBuilder.extendedVersion(extendedVersion);
-
final List<String> classNameList;
try {
classNameList = (List<String>) config.getOrDefault(TOKEN_CUSTOM, new ArrayList<String>());
@@ -224,7 +214,6 @@ public class GryoMessageSerializerV1d0 implements MessageSerializer {
throw new SerializationException(String.format("Message size of %s exceeds allocatable space", size));
encodedMessage = allocator.buffer((int) output.total());
- System.out.println(size);
encodedMessage.writeBytes(output.toBytes());
}