Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion neo4j-bolt-connection-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.neo4j.bolt</groupId>
<artifactId>neo4j-bolt-connection-parent</artifactId>
<version>11.1-SNAPSHOT</version>
<version>11.2-SNAPSHOT</version>
</parent>

<artifactId>neo4j-bolt-connection-bom</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion neo4j-bolt-connection-netty/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.neo4j.bolt</groupId>
<artifactId>neo4j-bolt-connection-parent</artifactId>
<version>11.1-SNAPSHOT</version>
<version>11.2-SNAPSHOT</version>
</parent>

<artifactId>neo4j-bolt-connection-netty</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.neo4j.bolt.connection.netty.impl.messaging.v57.BoltProtocolV57;
import org.neo4j.bolt.connection.netty.impl.messaging.v58.BoltProtocolV58;
import org.neo4j.bolt.connection.netty.impl.messaging.v6.BoltProtocolV6;
import org.neo4j.bolt.connection.netty.impl.messaging.v61.BoltProtocolV61;

public final class BoltProtocolUtil {
public static final int BOLT_MAGIC_PREAMBLE = 0x6060B017;
Expand All @@ -66,6 +67,7 @@ public final class BoltProtocolUtil {
static {
var map = new TreeMap<BoltProtocolVersion, BoltProtocol>(Comparator.reverseOrder());
map.putAll(Map.ofEntries(
Map.entry(BoltProtocolV61.VERSION, BoltProtocolV61.INSTANCE),
Map.entry(BoltProtocolV6.VERSION, BoltProtocolV6.INSTANCE),
Map.entry(BoltProtocolV58.VERSION, BoltProtocolV58.INSTANCE),
Map.entry(BoltProtocolV57.VERSION, BoltProtocolV57.INSTANCE),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.util.Map;
import java.util.UUID;
import org.neo4j.bolt.connection.exception.BoltClientException;
import org.neo4j.bolt.connection.exception.BoltUnsupportedFeatureException;
import org.neo4j.bolt.connection.netty.impl.messaging.ValuePacker;
Expand Down Expand Up @@ -144,6 +145,7 @@ protected void packInternalValue(Value value) throws IOException {
}
case VECTOR -> packVector(value.asBoltVector());
case UNSUPPORTED -> throw new BoltClientException("Unsupported type must not be sent to the server");
case UUID -> packUUID(value.asUUID());
default ->
throw new IOException("Unknown type: " + value.boltValueType().name());
}
Expand All @@ -153,6 +155,10 @@ protected void packVector(Vector vector) throws IOException {
throw new BoltUnsupportedFeatureException("Vector type is not supported by this Bolt protocol version");
}

protected void packUUID(UUID uuid) throws IOException {
throw new BoltUnsupportedFeatureException("UUID type is not supported by this Bolt protocol version");
}

private void packDate(LocalDate localDate) throws IOException {
packer.packStructHeader(DATE_STRUCT_SIZE, DATE);
packer.pack(localDate.toEpochDay());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ protected Value unpack() throws IOException {
case STRING -> {
return valueFactory.value(unpacker.unpackString());
}
case UUID -> {
return unpackUUID();
}
case MAP -> {
return valueFactory.value(unpackMap());
}
Expand Down Expand Up @@ -449,6 +452,10 @@ protected Value unpackUnsupported(long size) throws IOException {
throw new UnsupportedOperationException();
}

protected Value unpackUUID() throws IOException {
throw new BoltProtocolException("Unknown PackStream type: UUID");
}

private static ZonedDateTime newZonedDateTime(long epochSecondLocal, long nano, ZoneId zoneId) {
var instant = Instant.ofEpochSecond(epochSecondLocal, nano);
var localDateTime = LocalDateTime.ofInstant(instant, UTC);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,21 @@

import java.util.Map;
import org.neo4j.bolt.connection.GqlError;
import org.neo4j.bolt.connection.netty.impl.messaging.ValueUnpacker;
import org.neo4j.bolt.connection.netty.impl.messaging.v57.MessageReaderV57;
import org.neo4j.bolt.connection.netty.impl.packstream.PackInput;
import org.neo4j.bolt.connection.values.Value;
import org.neo4j.bolt.connection.values.ValueFactory;

final class MessageReaderV6 extends MessageReaderV57 {
public class MessageReaderV6 extends MessageReaderV57 {
public MessageReaderV6(PackInput input, ValueFactory valueFactory) {
super(new ValueUnpackerV6(input, valueFactory), valueFactory);
}

public MessageReaderV6(ValueUnpacker unpacker, ValueFactory valueFactory) {
super(unpacker, valueFactory);
}

@Override
protected GqlError unpackGqlError(Map<String, Value> params) {
return super.unpackGqlError(params);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.neo4j.bolt.connection.netty.impl.packstream.PackStream;
import org.neo4j.bolt.connection.values.Vector;

final class ValuePackerV6 extends CommonValuePacker {
public class ValuePackerV6 extends CommonValuePacker {
public ValuePackerV6(PackOutput output) {
super(output, true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.neo4j.bolt.connection.values.Value;
import org.neo4j.bolt.connection.values.ValueFactory;

final class ValueUnpackerV6 extends ValueUnpackerV5 {
public class ValueUnpackerV6 extends ValueUnpackerV5 {
public ValueUnpackerV6(PackInput input, ValueFactory valueFactory) {
super(input, valueFactory);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [https://neo4j.com]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.neo4j.bolt.connection.netty.impl.messaging.v61;

import org.neo4j.bolt.connection.BoltProtocolVersion;
import org.neo4j.bolt.connection.netty.impl.messaging.BoltProtocol;
import org.neo4j.bolt.connection.netty.impl.messaging.MessageFormat;
import org.neo4j.bolt.connection.netty.impl.messaging.v58.BoltProtocolV58;

public class BoltProtocolV61 extends BoltProtocolV58 {
public static final BoltProtocolVersion VERSION = new BoltProtocolVersion(6, 1);
public static final BoltProtocol INSTANCE = new BoltProtocolV61();

@Override
public MessageFormat createMessageFormat() {
return new MessageFormatV61();
}

@Override
public BoltProtocolVersion version() {
return VERSION;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [https://neo4j.com]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.neo4j.bolt.connection.netty.impl.messaging.v61;

import org.neo4j.bolt.connection.netty.impl.messaging.MessageFormat;
import org.neo4j.bolt.connection.netty.impl.packstream.PackInput;
import org.neo4j.bolt.connection.netty.impl.packstream.PackOutput;
import org.neo4j.bolt.connection.values.ValueFactory;

final class MessageFormatV61 implements MessageFormat {
@Override
public Writer newWriter(PackOutput output, ValueFactory valueFactory) {
return new MessageWriterV61(output, valueFactory);
}

@Override
public Reader newReader(PackInput input, ValueFactory valueFactory) {
return new MessageReaderV61(input, valueFactory);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [https://neo4j.com]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.neo4j.bolt.connection.netty.impl.messaging.v61;

import org.neo4j.bolt.connection.netty.impl.messaging.v6.MessageReaderV6;
import org.neo4j.bolt.connection.netty.impl.packstream.PackInput;
import org.neo4j.bolt.connection.values.ValueFactory;

final class MessageReaderV61 extends MessageReaderV6 {
public MessageReaderV61(PackInput input, ValueFactory valueFactory) {
super(new ValueUnpackerV61(input, valueFactory), valueFactory);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [https://neo4j.com]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.neo4j.bolt.connection.netty.impl.messaging.v61;

import java.util.Map;
import org.neo4j.bolt.connection.netty.impl.messaging.AbstractMessageWriter;
import org.neo4j.bolt.connection.netty.impl.messaging.MessageEncoder;
import org.neo4j.bolt.connection.netty.impl.messaging.encode.BeginMessageEncoder;
import org.neo4j.bolt.connection.netty.impl.messaging.encode.CommitMessageEncoder;
import org.neo4j.bolt.connection.netty.impl.messaging.encode.DiscardMessageEncoder;
import org.neo4j.bolt.connection.netty.impl.messaging.encode.GoodbyeMessageEncoder;
import org.neo4j.bolt.connection.netty.impl.messaging.encode.HelloMessageEncoder;
import org.neo4j.bolt.connection.netty.impl.messaging.encode.LogoffMessageEncoder;
import org.neo4j.bolt.connection.netty.impl.messaging.encode.LogonMessageEncoder;
import org.neo4j.bolt.connection.netty.impl.messaging.encode.PullMessageEncoder;
import org.neo4j.bolt.connection.netty.impl.messaging.encode.ResetMessageEncoder;
import org.neo4j.bolt.connection.netty.impl.messaging.encode.RollbackMessageEncoder;
import org.neo4j.bolt.connection.netty.impl.messaging.encode.RouteV44MessageEncoder;
import org.neo4j.bolt.connection.netty.impl.messaging.encode.RunWithMetadataMessageEncoder;
import org.neo4j.bolt.connection.netty.impl.messaging.encode.TelemetryMessageEncoder;
import org.neo4j.bolt.connection.netty.impl.messaging.request.BeginMessage;
import org.neo4j.bolt.connection.netty.impl.messaging.request.CommitMessage;
import org.neo4j.bolt.connection.netty.impl.messaging.request.DiscardMessage;
import org.neo4j.bolt.connection.netty.impl.messaging.request.GoodbyeMessage;
import org.neo4j.bolt.connection.netty.impl.messaging.request.HelloMessage;
import org.neo4j.bolt.connection.netty.impl.messaging.request.LogoffMessage;
import org.neo4j.bolt.connection.netty.impl.messaging.request.LogonMessage;
import org.neo4j.bolt.connection.netty.impl.messaging.request.PullMessage;
import org.neo4j.bolt.connection.netty.impl.messaging.request.ResetMessage;
import org.neo4j.bolt.connection.netty.impl.messaging.request.RollbackMessage;
import org.neo4j.bolt.connection.netty.impl.messaging.request.RouteMessage;
import org.neo4j.bolt.connection.netty.impl.messaging.request.RunWithMetadataMessage;
import org.neo4j.bolt.connection.netty.impl.messaging.request.TelemetryMessage;
import org.neo4j.bolt.connection.netty.impl.packstream.PackOutput;
import org.neo4j.bolt.connection.values.ValueFactory;

final class MessageWriterV61 extends AbstractMessageWriter {
public MessageWriterV61(PackOutput output, ValueFactory valueFactory) {
super(new ValuePackerV61(output), buildEncoders(), valueFactory);
}

private static Map<Byte, MessageEncoder> buildEncoders() {
return Map.ofEntries(
Map.entry(HelloMessage.SIGNATURE, new HelloMessageEncoder()),
Map.entry(LogonMessage.SIGNATURE, new LogonMessageEncoder()),
Map.entry(LogoffMessage.SIGNATURE, new LogoffMessageEncoder()),
Map.entry(GoodbyeMessage.SIGNATURE, new GoodbyeMessageEncoder()),
Map.entry(RunWithMetadataMessage.SIGNATURE, new RunWithMetadataMessageEncoder()),
Map.entry(RouteMessage.SIGNATURE, new RouteV44MessageEncoder()),
Map.entry(DiscardMessage.SIGNATURE, new DiscardMessageEncoder()),
Map.entry(PullMessage.SIGNATURE, new PullMessageEncoder()),
Map.entry(BeginMessage.SIGNATURE, new BeginMessageEncoder()),
Map.entry(CommitMessage.SIGNATURE, new CommitMessageEncoder()),
Map.entry(RollbackMessage.SIGNATURE, new RollbackMessageEncoder()),
Map.entry(ResetMessage.SIGNATURE, new ResetMessageEncoder()),
Map.entry(TelemetryMessage.SIGNATURE, new TelemetryMessageEncoder()));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [https://neo4j.com]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.neo4j.bolt.connection.netty.impl.messaging.v61;

import java.io.IOException;
import java.util.UUID;
import org.neo4j.bolt.connection.netty.impl.messaging.v6.ValuePackerV6;
import org.neo4j.bolt.connection.netty.impl.packstream.PackOutput;

final class ValuePackerV61 extends ValuePackerV6 {
public ValuePackerV61(PackOutput output) {
super(output);
}

@Override
protected void packUUID(UUID uuid) throws IOException {
packer.pack(uuid);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [https://neo4j.com]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.neo4j.bolt.connection.netty.impl.messaging.v61;

import java.io.IOException;
import org.neo4j.bolt.connection.netty.impl.messaging.v6.ValueUnpackerV6;
import org.neo4j.bolt.connection.netty.impl.packstream.PackInput;
import org.neo4j.bolt.connection.values.Value;
import org.neo4j.bolt.connection.values.ValueFactory;

final class ValueUnpackerV61 extends ValueUnpackerV6 {
public ValueUnpackerV61(PackInput input, ValueFactory valueFactory) {
super(input, valueFactory);
}

@Override
protected Value unpackUUID() throws IOException {
return valueFactory.value(unpacker.unpackUUID());
}
}
Loading