Package org.voltdb
Class InProcessVoltDBServer
java.lang.Object
org.voltdb.InProcessVoltDBServer
Class used to run a single VoltDB server in-process for debug and test
purposes.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconfigPartitionCount(int partitionCount) Set the number of partitions the single VoltDB server will use.configPathToLicense(String path) When using enterprise or pro edition, specify a path to the license needed.org.voltdb.client.ClientCreate and connect a client to the in-process VoltDB server.voidHelper method for loading a row into a table.runDDLFromPath(String path) Run DDL from a file on disk.runDDLFromString(String ddl) Run DDL from a given string.voidshutdown()Stop the in-process server and block until it has completely stopped.start()Starts the in-process server and blocks until it is ready to accept connections.
-
Constructor Details
-
InProcessVoltDBServer
public InProcessVoltDBServer()Create an instance ready to start.
-
-
Method Details
-
configPartitionCount
Set the number of partitions the single VoltDB server will use. The default is 8. Must be called beforestart().- Parameters:
partitionCount- The number of partitions desired.- Returns:
- InProcessVoltDBServer instance for chaining.
-
configPathToLicense
When using enterprise or pro edition, specify a path to the license needed.- Parameters:
path- Path to license. Must be called beforestart().- Returns:
- InProcessVoltDBServer instance for chaining.
-
start
Starts the in-process server and blocks until it is ready to accept connections.- Returns:
- InProcessVoltDBServer instance for chaining.
-
runDDLFromPath
Run DDL from a file on disk. Must be called afterstart().- Parameters:
path- Path to DDL file.- Returns:
- InProcessVoltDBServer instance for chaining.
-
runDDLFromString
Run DDL from a given string. Must be called afterstart().- Parameters:
ddl- String containing DDL to run.- Returns:
- InProcessVoltDBServer instance for chaining.
-
shutdown
public void shutdown()Stop the in-process server and block until it has completely stopped. Obviously must be called afterstart(). -
getClient
Create and connect a client to the in-process VoltDB server. Note, client will be automatically closed when the in-process server is shut down. Must be called afterstart().- Returns:
- Connected client.
- Throws:
Exception- on failure to connect properly.
-
loadRow
Helper method for loading a row into a table. Must be called afterstart()and afterrunDDLFromPath(String)orrunDDLFromString(String).- Parameters:
tableName- The case-insensitive name of the target table.row- An array of schema-compatible values comprising the row to load.- Throws:
Exception- if the server is unable to complete a transaction of if the input doesn't match table schema.
-