[GitHub] [tinkerpop] jorgebay commented on issue #1209: TINKERPOP-2305 GraphBinary: Buffer API
jorgebay commented on issue #1209: TINKERPOP-2305 GraphBinary: Buffer API URL: https://github.com/apache/tinkerpop/pull/1209#issuecomment-541016783 I'll add a couple of utility methods to access the underlying memory of `Buffer` for providers to use if needed. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [tinkerpop] jorgebay opened a new pull request #1209: TINKERPOP-2305 GraphBinary: Buffer API
jorgebay opened a new pull request #1209: TINKERPOP-2305 GraphBinary: Buffer API URL: https://github.com/apache/tinkerpop/pull/1209 https://issues.apache.org/jira/browse/TINKERPOP-2305 Introduce our own `Buffer` interface as a wrapper of Netty's `ByteBuf`, allowing us to move GraphBinary serialization to `gremlin-core`. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[tinkerpop] branch TINKERPOP-2305 created (now 6e10bde)
This is an automated email from the ASF dual-hosted git repository. jorgebg pushed a change to branch TINKERPOP-2305 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git. at 6e10bde TINKERPOP-2035 Move to gremlin-core This branch includes the following new commits: new 344b737 TINKERPOP-2305 Introduce Buffer interface new a76cf5d TINKERPOP-2305 Refactor serialization method signatures new 6e10bde TINKERPOP-2035 Move to gremlin-core The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[tinkerpop] 02/03: TINKERPOP-2305 Refactor serialization method signatures
This is an automated email from the ASF dual-hosted git repository. jorgebg pushed a commit to branch TINKERPOP-2305 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit a76cf5de34737a45c7c71749cfbbf6f3c589e5ac Author: Jorge Bay Gondra AuthorDate: Thu Oct 10 10:13:22 2019 +0200 TINKERPOP-2305 Refactor serialization method signatures --- .../tinkerpop/gremlin/structure/io/Buffer.java | 67 +- .../gremlin/structure/io/BufferFactory.java| 39 + .../tinkerpop/gremlin/driver/NettyBuffer.java | 65 + ...UUIDSerializer.java => NettyBufferFactory.java} | 29 +- .../driver/ser/binary/GraphBinaryReader.java | 10 ++-- .../driver/ser/binary/GraphBinaryWriter.java | 19 +++--- .../ser/binary/RequestMessageSerializer.java | 13 - .../ser/binary/ResponseMessageSerializer.java | 12 +++- .../gremlin/driver/ser/binary/TypeSerializer.java | 11 ++-- .../ser/binary/types/BigDecimalSerializer.java | 6 +- .../ser/binary/types/BigIntegerSerializer.java | 6 +- .../driver/ser/binary/types/BindingSerializer.java | 6 +- .../driver/ser/binary/types/BulkSetSerializer.java | 7 +-- .../ser/binary/types/ByteBufferSerializer.java | 6 +- .../ser/binary/types/ByteCodeSerializer.java | 12 ++-- .../driver/ser/binary/types/CharSerializer.java| 7 +-- .../driver/ser/binary/types/ClassSerializer.java | 6 +- .../ser/binary/types/CollectionSerializer.java | 6 +- .../driver/ser/binary/types/DateSerializer.java| 6 +- .../ser/binary/types/DurationSerializer.java | 6 +- .../driver/ser/binary/types/EdgeSerializer.java| 6 +- .../driver/ser/binary/types/EnumSerializer.java| 6 +- .../driver/ser/binary/types/GraphSerializer.java | 11 ++-- .../ser/binary/types/InetAddressSerializer.java| 6 +- .../driver/ser/binary/types/InstantSerializer.java | 6 +- .../driver/ser/binary/types/LambdaSerializer.java | 6 +- .../driver/ser/binary/types/ListSerializer.java| 6 +- .../ser/binary/types/LocalDateSerializer.java | 6 +- .../ser/binary/types/LocalDateTimeSerializer.java | 6 +- .../ser/binary/types/LocalTimeSerializer.java | 6 +- .../ser/binary/types/MapEntrySerializer.java | 6 +- .../driver/ser/binary/types/MapSerializer.java | 6 +- .../driver/ser/binary/types/MetricsSerializer.java | 6 +- .../ser/binary/types/MonthDaySerializer.java | 6 +- .../ser/binary/types/OffsetDateTimeSerializer.java | 6 +- .../ser/binary/types/OffsetTimeSerializer.java | 6 +- .../driver/ser/binary/types/PSerializer.java | 6 +- .../driver/ser/binary/types/PathSerializer.java| 6 +- .../driver/ser/binary/types/PeriodSerializer.java | 6 +- .../ser/binary/types/PropertySerializer.java | 6 +- .../driver/ser/binary/types/SetSerializer.java | 6 +- .../ser/binary/types/SimpleTypeSerializer.java | 14 ++--- .../ser/binary/types/SingleTypeSerializer.java | 28 - .../driver/ser/binary/types/StringSerializer.java | 6 +- .../types/TraversalExplanationSerializer.java | 6 +- .../binary/types/TraversalMetricsSerializer.java | 6 +- .../binary/types/TraversalStrategySerializer.java | 6 +- .../ser/binary/types/TraverserSerializer.java | 6 +- .../driver/ser/binary/types/TreeSerializer.java| 6 +- .../driver/ser/binary/types/UUIDSerializer.java| 6 +- .../ser/binary/types/VertexPropertySerializer.java | 6 +- .../driver/ser/binary/types/VertexSerializer.java | 6 +- .../ser/binary/types/YearMonthSerializer.java | 6 +- .../ser/binary/types/ZoneOffsetSerializer.java | 6 +- .../ser/binary/types/ZonedDateTimeSerializer.java | 6 +- .../GraphBinaryReaderWriterRoundTripTest.java | 6 +- .../ser/binary/TypeSerializerFailureTests.java | 6 +- .../ser/binary/TypeSerializerRegistryTest.java | 10 ++-- .../ser/binary/types/CharSerializerTest.java | 8 ++- .../types/sample/SamplePersonSerializer.java | 10 ++-- .../types/sample/SamplePersonSerializerTest.java | 5 +- .../driver/GraphBinaryReaderWriterBenchmark.java | 12 ++-- .../graphbinary/GraphBinaryCompatibilityTest.java | 9 +-- 63 files changed, 419 insertions(+), 231 deletions(-) diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Buffer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Buffer.java index 3219a90..4d37bba 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Buffer.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Buffer.java @@ -1,3 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version
[tinkerpop] 01/03: TINKERPOP-2305 Introduce Buffer interface
This is an automated email from the ASF dual-hosted git repository. jorgebg pushed a commit to branch TINKERPOP-2305 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit 344b737881f42eaf0e8f6c8e7fd2df526b0b3329 Author: Jorge Bay Gondra AuthorDate: Mon Oct 7 10:40:53 2019 +0200 TINKERPOP-2305 Introduce Buffer interface --- .../tinkerpop/gremlin/structure/io/Buffer.java | 174 .../tinkerpop/gremlin/driver/NettyBuffer.java | 180 + 2 files changed, 354 insertions(+) diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Buffer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Buffer.java new file mode 100644 index 000..3219a90 --- /dev/null +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Buffer.java @@ -0,0 +1,174 @@ +package org.apache.tinkerpop.gremlin.structure.io; + +import java.io.IOException; +import java.io.OutputStream; +import java.nio.ByteBuffer; + +/** + * Represents an abstract view for one or more primitive byte arrays and NIO buffers. + */ +public interface Buffer { + +/** + * Returns the reader index of this buffer. + */ +int readerIndex(); + +/** + * Sets the reader index of this buffer. + * + * @throws IndexOutOfBoundsException + * if its out of bounds. + */ +Buffer readerIndex(int readerIndex); + +/** + * Returns the writer index of this buffer. + */ +int writerIndex(); + +/** + * Sets the writer index of this buffer. + * + * @throws IndexOutOfBoundsException + * if its out of bounds. + */ +Buffer writerIndex(int writerIndex); + +/** + * Returns the number of bytes (octets) this buffer can contain. + */ +int capacity(); + +/** + * Gets a boolean and advances the reader index. + */ +boolean readBoolean(); + +/** + * Gets a byte and advances the reader index. + */ +byte readByte(); + +/** + * Gets a 16-bit short integer and advances the reader index. + */ +short readShort(); + +/** + * Gets a 32-bit integer at the current index and advances the reader index. + */ +int readInt(); + +/** + * Gets a 64-bit integer and advances the reader index. + */ +long readLong(); + +/** + * Gets a 32-bit floating point number and advances the reader index. + */ +float readFloat(); + +/** + * Gets a 64-bit floating point number and advances the reader index. + */ +double readDouble(); + +/** + * Transfers this buffer's data to the specified destination starting at + * the current reader index and advances the reader index. + */ +Buffer readBytes(byte[] destination); + +/** + * Transfers this buffer's data to the specified destination starting at + * the current reader index and advances the reader index. + * + * @param destination The destination buffer + * @param dstIndex the first index of the destination + * @param length the number of bytes to transfer + */ +Buffer readBytes(byte[] destination, int dstIndex, int length); + +/** + * Transfers this buffer's data to the specified destination starting at + * the current reader index until the destination's position + * reaches its limit, and advances the reader index. + */ +Buffer readBytes(ByteBuffer dst); + +/** + * Transfers this buffer's data to the specified stream starting at the + * current reader index and advances the index. + * + * @param length the number of bytes to transfer + * + * @throws IOException + * if the specified stream threw an exception during I/O + */ +Buffer readBytes(OutputStream out, int length) throws IOException; + +/** + * Sets the specified boolean at the current writer index and advances the index. + */ +Buffer writeBoolean(boolean value); + +/** + * Sets the specified byte at the current writer index and advances the index. + */ +Buffer writeByte(int value); + +/** + * Sets the specified 16-bit short integer at the current writer index and advances the index. + */ +Buffer writeShort(int value); + +/** + * Sets the specified 32-bit integer at the current writer index and advances the index. + */ +Buffer writeInt(int value); + +/** + * Sets the specified 64-bit long integer at the current writer index and advances the index. + */ +Buffer writeLong(long value); + +/** + * Sets the specified 32-bit floating point number at the current writer index and advances the index. + */ +Buffer writeFloat(float value); + +/** + * Sets the specified 64-bit floating point number at the current writer index and advances the index. + */ +Buffer writeDouble(double value); + +/** + * Transfers the