Skip to content

Commit

Permalink
Rename NDP to Bolt
Browse files Browse the repository at this point in the history
  • Loading branch information
srbaker authored and technige committed Sep 7, 2015
1 parent 4a785ad commit 1824377
Show file tree
Hide file tree
Showing 169 changed files with 720 additions and 654 deletions.
File renamed without changes.
7 changes: 3 additions & 4 deletions community/ndp/README.md → community/bolt/README.md
@@ -1,7 +1,6 @@
# Neo4j Data Protocol
# Bolt: The Neo4j Binary Protocol

This project contains a high-performance network protocol for Neo4j.
Tentatively called "Neo4j Data Protocol", NDP.
This project contains a high-performance network protocol for Neo4j called Bolt.

Architectural overview:

Expand Down Expand Up @@ -63,4 +62,4 @@ backwards compatibility.
This defines the 'stream' data structure that this protocol uses as its main mechanism of data transport. It is
expected that this module will be made obsolete by the new cypher runtime work. It is in a module separate from the
protocol runtime module, because both the runtime and the user extension modules (user extension module not part of
this version of the code yet) depend on it.
this version of the code yet) depend on it.
File renamed without changes.
File renamed without changes.
Expand Up @@ -16,11 +16,11 @@
<licensing.prepend.text>notice-gpl-prefix.txt</licensing.prepend.text>
</properties>

<artifactId>neo4j-ndp-kernelextension</artifactId>
<artifactId>neo4j-bolt-kernelextension</artifactId>

<packaging>jar</packaging>
<name>Neo4j - NDP Kernel Extension</name>
<description>Exposes the Neo4j Data Protocol server as a kernel extension.</description>
<name>Neo4j - Bolt Kernel Extension</name>
<description>Exposes the Neo4j Bolt Protocol server as a kernel extension.</description>

<licenses>
<license>
Expand All @@ -45,12 +45,12 @@
<dependencies>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ndp-transport-socket</artifactId>
<artifactId>neo4j-bolt-transport-socket</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ndp-runtime</artifactId>
<artifactId>neo4j-bolt-runtime</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
Expand All @@ -75,7 +75,7 @@
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ndp-transport-socket</artifactId>
<artifactId>neo4j-bolt-transport-socket</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
Expand Down
Expand Up @@ -39,42 +39,42 @@
import org.neo4j.kernel.lifecycle.LifeSupport;
import org.neo4j.kernel.lifecycle.Lifecycle;
import org.neo4j.logging.Log;
import org.neo4j.ndp.runtime.Sessions;
import org.neo4j.ndp.runtime.internal.StandardSessions;
import org.neo4j.ndp.runtime.internal.concurrent.ThreadedSessions;
import org.neo4j.ndp.transport.socket.NettyServer;
import org.neo4j.ndp.transport.socket.SocketProtocol;
import org.neo4j.ndp.transport.socket.SocketProtocolV1;
import org.neo4j.ndp.transport.socket.SocketTransport;
import org.neo4j.ndp.transport.socket.WebSocketTransport;
import org.neo4j.bolt.runtime.Sessions;
import org.neo4j.bolt.runtime.internal.StandardSessions;
import org.neo4j.bolt.runtime.internal.concurrent.ThreadedSessions;
import org.neo4j.bolt.transport.socket.NettyServer;
import org.neo4j.bolt.transport.socket.SocketProtocol;
import org.neo4j.bolt.transport.socket.SocketProtocolV1;
import org.neo4j.bolt.transport.socket.SocketTransport;
import org.neo4j.bolt.transport.socket.WebSocketTransport;
import org.neo4j.udc.UsageData;

import static java.util.Arrays.asList;
import static org.neo4j.collection.primitive.Primitive.longObjectMap;
import static org.neo4j.helpers.Settings.BOOLEAN;
import static org.neo4j.helpers.Settings.HOSTNAME_PORT;
import static org.neo4j.helpers.Settings.setting;
import static org.neo4j.kernel.impl.util.JobScheduler.Groups.gapNetworkIO;
import static org.neo4j.kernel.impl.util.JobScheduler.Groups.boltNetworkIO;

/**
* Wraps NDP and exposes it as a Kernel Extension.
* Wraps Bolt and exposes it as a Kernel Extension.
*/
@Service.Implementation(KernelExtensionFactory.class)
public class NDPKernelExtension extends KernelExtensionFactory<NDPKernelExtension.Dependencies>
public class BoltKernelExtension extends KernelExtensionFactory<BoltKernelExtension.Dependencies>
{
public static class Settings
{
@Description("Enable Neo4j Data Protocol")
public static final Setting<Boolean> ndp_enabled = setting( "experimental.ndp.enabled", BOOLEAN,
@Description("Enable Neo4j Bolt")
public static final Setting<Boolean> bolt_enabled = setting( "experimental.bolt.enabled", BOOLEAN,
"false" );

@Description("Host and port for the Neo4j Data Protocol")
public static final Setting<HostnamePort> ndp_socket_address =
setting( "dbms.ndp.address", HOSTNAME_PORT, "localhost:7687" );
@Description("Host and port for the Neo4j Bolt Protocol")
public static final Setting<HostnamePort> bolt_socket_address =
setting( "dbms.bolt.address", HOSTNAME_PORT, "localhost:7687" );

@Description("Host and port for the Neo4j Data Protocol Websocket")
public static final Setting<HostnamePort> ndp_ws_address =
setting( "dbms.ndp.ws.address", HOSTNAME_PORT, "localhost:7688" );
@Description("Host and port for the Neo4j Bolt Protocol Websocket")
public static final Setting<HostnamePort> bolt_ws_address =
setting( "dbms.bolt.ws.address", HOSTNAME_PORT, "localhost:7688" );
}

public interface Dependencies
Expand All @@ -90,9 +90,9 @@ public interface Dependencies
UsageData usageData();
}

public NDPKernelExtension()
public BoltKernelExtension()
{
super( "neo4j-data-protocol-server" );
super( "bolt-server" );
}

@Override
Expand All @@ -104,12 +104,12 @@ public Lifecycle newKernelExtension( final Dependencies dependencies ) throws Th
final LogService logging = dependencies.logService();
final Log log = logging.getInternalLog( Sessions.class );

final HostnamePort socketAddress = config.get( Settings.ndp_socket_address );
final HostnamePort webSocketAddress = config.get( Settings.ndp_ws_address );
final HostnamePort socketAddress = config.get( Settings.bolt_socket_address );
final HostnamePort webSocketAddress = config.get( Settings.bolt_ws_address );

final LifeSupport life = new LifeSupport();

if ( config.get( Settings.ndp_enabled ) )
if ( config.get( Settings.bolt_enabled ) )
{
final JobScheduler scheduler = dependencies.scheduler();

Expand All @@ -131,10 +131,10 @@ public SocketProtocol apply( Channel channel )
} );

// Start services
life.add( new NettyServer( scheduler.threadFactory( gapNetworkIO ), asList(
life.add( new NettyServer( scheduler.threadFactory( boltNetworkIO ), asList(
new SocketTransport( socketAddress, sslCtx, logging.getInternalLogProvider(), availableVersions ),
new WebSocketTransport( webSocketAddress, sslCtx, logging.getInternalLogProvider(), availableVersions ) ) ) );
log.info( "NDP Server extension loaded." );
log.info( "Bolt Server extension loaded." );
}

return life;
Expand Down
@@ -0,0 +1 @@
org.neo4j.ext.BoltKernelExtension
Expand Up @@ -29,22 +29,22 @@

import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.helpers.HostnamePort;
import org.neo4j.ndp.transport.socket.client.SecureSocketConnection;
import org.neo4j.bolt.transport.socket.client.SecureSocketConnection;
import org.neo4j.test.TestGraphDatabaseFactory;

public class NDPExtensionIT
public class BoltExtensionIT
{
@Rule
public TemporaryFolder tmpDir = new TemporaryFolder();
private GraphDatabaseService db;

@Test
public void shouldLaunchNDP() throws Throwable
public void shouldLaunchBolt() throws Throwable
{
// When I run Neo4j with the ndp extension on the class path, and experimental ndp config on
// When I run Neo4j with the bolt extension on the class path, and experimental bolt config on
db = new TestGraphDatabaseFactory()
.newEmbeddedDatabaseBuilder( tmpDir.getRoot().getAbsolutePath() )
.setConfig( NDPKernelExtension.Settings.ndp_enabled, "true" )
.setConfig( BoltKernelExtension.Settings.bolt_enabled, "true" )
.newGraphDatabase();

// Then
Expand All @@ -54,11 +54,11 @@ public void shouldLaunchNDP() throws Throwable
@Test
public void shouldBeAbleToSpecifyHostAndPort() throws Throwable
{
// When I run Neo4j with the ndp extension on the class path
// When I run Neo4j with the bolt extension on the class path
db = new TestGraphDatabaseFactory()
.newEmbeddedDatabaseBuilder( tmpDir.getRoot().getAbsolutePath() )
.setConfig( NDPKernelExtension.Settings.ndp_enabled, "true" )
.setConfig( NDPKernelExtension.Settings.ndp_socket_address, "localhost:8776" )
.setConfig( BoltKernelExtension.Settings.bolt_enabled, "true" )
.setConfig( BoltKernelExtension.Settings.bolt_socket_address, "localhost:8776" )
.newGraphDatabase();

// Then
Expand Down
File renamed without changes.
File renamed without changes.
Expand Up @@ -16,22 +16,22 @@
<licensing.prepend.text>notice-gpl-prefix.txt</licensing.prepend.text>
</properties>

<artifactId>neo4j-ndp-messaging-v1</artifactId>
<artifactId>neo4j-bolt-messaging-v1</artifactId>

<packaging>jar</packaging>
<name>Neo4j - NDP Messaging Library V1</name>
<description>Serialization code and definition of messages for NDP V1</description>
<name>Neo4j - Bolt Messaging Library V1</name>
<description>Serialization code and definition of messages for Bolt V1</description>

<dependencies>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ndp-packstream-v1</artifactId>
<artifactId>neo4j-bolt-packstream-v1</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ndp-runtime</artifactId>
<artifactId>neo4j-bolt-runtime</artifactId>
<version>${project.version}</version>
</dependency>

Expand Down
Expand Up @@ -17,23 +17,23 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.ndp.messaging;
package org.neo4j.bolt.messaging;

import java.io.IOException;

import org.neo4j.kernel.api.exceptions.Status;

public class NDPIOException extends IOException implements Status.HasStatus
public class BoltIOException extends IOException implements Status.HasStatus
{
private final Status status;

public NDPIOException( Status status, String message, Throwable cause )
public BoltIOException( Status status, String message, Throwable cause )
{
super(message, cause);
this.status = status;
}

public NDPIOException( Status status, String message )
public BoltIOException( Status status, String message )
{
this(status, message, null);
}
Expand Down
Expand Up @@ -17,7 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.ndp.messaging.v1;
package org.neo4j.bolt.messaging.v1;

import java.io.IOException;

Expand Down
Expand Up @@ -17,7 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.ndp.messaging.v1;
package org.neo4j.bolt.messaging.v1;

import java.io.IOException;

Expand Down
Expand Up @@ -17,10 +17,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.ndp.messaging.v1;
package org.neo4j.bolt.messaging.v1;

import java.io.IOException;
import org.neo4j.ndp.messaging.v1.message.Message;
import org.neo4j.bolt.messaging.v1.message.Message;

public interface MessageFormat
{
Expand Down
Expand Up @@ -17,12 +17,12 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.ndp.messaging.v1;
package org.neo4j.bolt.messaging.v1;

import java.util.Map;

import org.neo4j.kernel.api.exceptions.Status;
import org.neo4j.ndp.runtime.spi.Record;
import org.neo4j.bolt.runtime.spi.Record;

public interface MessageHandler<E extends Exception>
{
Expand Down
Expand Up @@ -17,7 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.ndp.messaging.v1;
package org.neo4j.bolt.messaging.v1;

import java.io.IOException;
import java.util.ArrayList;
Expand All @@ -32,10 +32,10 @@
import org.neo4j.graphdb.PropertyContainer;
import org.neo4j.graphdb.Relationship;
import org.neo4j.kernel.api.exceptions.Status;
import org.neo4j.ndp.messaging.NDPIOException;
import org.neo4j.ndp.messaging.v1.infrastructure.ValueNode;
import org.neo4j.ndp.messaging.v1.infrastructure.ValueRelationship;
import org.neo4j.ndp.messaging.v1.infrastructure.ValueUnboundRelationship;
import org.neo4j.bolt.messaging.BoltIOException;
import org.neo4j.bolt.messaging.v1.infrastructure.ValueNode;
import org.neo4j.bolt.messaging.v1.infrastructure.ValueRelationship;
import org.neo4j.bolt.messaging.v1.infrastructure.ValueUnboundRelationship;
import org.neo4j.packstream.PackInput;
import org.neo4j.packstream.PackOutput;
import org.neo4j.packstream.PackStream;
Expand Down Expand Up @@ -194,7 +194,7 @@ else if ( obj instanceof Path )
}
else
{
throw new NDPIOException( Status.General.UnknownFailure,
throw new BoltIOException( Status.General.UnknownFailure,
"Unpackable value " + obj + " of type " + obj.getClass().getName() );
}
}
Expand Down Expand Up @@ -315,12 +315,12 @@ public Object unpack() throws IOException
return pathUnpacker.unpackFields( this );
}
default:
throw new NDPIOException( Status.Request.InvalidFormat,
throw new BoltIOException( Status.Request.InvalidFormat,
"Unknown struct type: " + signature );
}
}
default:
throw new NDPIOException( Status.Request.InvalidFormat,
throw new BoltIOException( Status.Request.InvalidFormat,
"Unknown value type: " + valType );
}
}
Expand Down

0 comments on commit 1824377

Please sign in to comment.