Address review comments

This commit is contained in:
A.J. Beamon 2019-01-10 12:28:14 -08:00
parent 11cce3731b
commit bfa97d7ff2
8 changed files with 44 additions and 33 deletions

View File

@ -134,16 +134,6 @@ fdb_error_t fdb_add_network_thread_completion_hook(void (*hook)(void*), void *ho
CATCH_AND_RETURN( API->addNetworkThreadCompletionHook(hook, hook_parameter); );
}
extern "C" DLLEXPORT
FDBFuture* fdb_cluster_configure_database_v12( FDBCluster* c, int config_type,
int config_mode, uint8_t const* db_name,
int db_name_length )
{
// Obsolete, but needed for linker compatibility with api version 12 and below
return (FDBFuture*)ThreadFuture<Void>(client_invalid_operation()).extractPtr();
}
extern "C" DLLEXPORT
void fdb_future_cancel( FDBFuture* f ) {
CATCH_AND_DIE(
@ -693,7 +683,6 @@ fdb_error_t fdb_select_api_version_impl( int runtime_version, int header_version
FDB_API_CHANGED( fdb_transaction_get, 14 );
FDB_API_CHANGED( fdb_setup_network, 14 );
FDB_API_CHANGED( fdb_transaction_set_option, 14 );
FDB_API_REMOVED( fdb_cluster_configure_database, 13 );
/* End versioned API changes */
return error_code_success;

View File

@ -230,7 +230,7 @@ func StartNetwork() error {
return startNetwork()
}
// DefaultClusterFile should be passed to fdb.Open to allow the FoundationDB C
// DefaultClusterFile should be passed to fdb.Open to allow the FoundationDB C
// library to select the platform-appropriate default cluster file on the current machine.
const DefaultClusterFile string = ""
@ -309,10 +309,6 @@ func MustOpen(clusterFile string, dbName []byte) Database {
return db
}
func createCluster(clusterFile string) (Cluster, error) {
return Cluster{clusterFile}, nil
}
func createDatabase(clusterFile string) (Database, error) {
var cf *C.char
@ -347,7 +343,7 @@ func CreateCluster(clusterFile string) (Cluster, error) {
return Cluster{}, errNetworkNotSetup
}
return createCluster(clusterFile)
return Cluster{clusterFile}, nil
}
func byteSliceToPtr(b []byte) *C.uint8_t {

View File

@ -38,14 +38,14 @@
#error Missing thread local storage
#endif
static JavaVM* g_jvm = 0;
static thread_local JNIEnv* g_thread_jenv = 0; // Defined for the network thread once it is running, and for any thread that has called registerCallback
static JavaVM* g_jvm = nullptr;
static thread_local JNIEnv* g_thread_jenv = nullptr; // Defined for the network thread once it is running, and for any thread that has called registerCallback
static thread_local jmethodID g_IFutureCallback_call_methodID = 0;
static thread_local bool is_external = false;
void detachIfExternalThread(void *ignore) {
if(is_external && g_thread_jenv != 0) {
g_thread_jenv = 0;
g_thread_jenv = nullptr;
g_IFutureCallback_call_methodID = 0;
g_jvm->DetachCurrentThread();
}
@ -533,7 +533,7 @@ JNIEXPORT jboolean JNICALL Java_com_apple_foundationdb_FDB_Error_1predicate(JNIE
}
JNIEXPORT jlong JNICALL Java_com_apple_foundationdb_FDB_Database_1create(JNIEnv *jenv, jobject, jstring clusterFileName) {
const char* fileName = 0;
const char* fileName = nullptr;
if(clusterFileName != 0) {
fileName = jenv->GetStringUTFChars(clusterFileName, 0);
if(jenv->ExceptionOccurred()) {

View File

@ -1,5 +1,33 @@
package com.apple.foundationdb; /**
/*
* ClusterOptions.java
*
* This source file is part of the FoundationDB open source project
*
* Copyright 2013-2019 Apple Inc. and the FoundationDB project authors
*
* 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 com.apple.foundationdb;
/**
* A set of options that can be set on a {@link Cluster}.
*
* There are currently no options available.
*/ public class ClusterOptions extends OptionsSet { public ClusterOptions( OptionConsumer consumer ) { super(consumer); } }
* @deprecated There are no cluster options.
*/
@Deprecated
public class ClusterOptions extends OptionsSet {
public ClusterOptions( OptionConsumer consumer ) {
super(consumer);
}
}

View File

@ -26,7 +26,7 @@ import java.util.function.Function;
/**
* A mutable, lexicographically ordered mapping from binary keys to binary values.
* {@link Transaction}s are used to manipulate data within a single
* {@link Transaction}s are used to manipulate data within a single
* {@code Database} -- multiple, concurrent
* {@code Transaction}s on a {@code Database} enforce <b>ACID</b> properties.<br>
* <br>

View File

@ -114,7 +114,7 @@ public class FDB {
* Returns a set of options that can be set on a the FoundationDB API. Generally,
* these options to the top level of the API affect the networking engine and
* therefore must be set before the network engine is started. The network is started
* by calls to {@link #startNetwork()} and implicitly by a call to {@link #open()} and
* by calls to {@link #startNetwork()} or implicitly by a call to {@link #open()} and
* and its variants.
*
* @return a set of options affecting this instance of the FoundationDB API
@ -218,7 +218,7 @@ public class FDB {
* If the FoundationDB network has not been started, it will be started in the course of this call
* as if {@link FDB#startNetwork()} had been called.
*
* This function is deprecated. Use {@link #open()} instead.
* @deprecated Use {@link #open()} instead.
*
* @return a {@code CompletableFuture} that will be set to a FoundationDB {@code Cluster}.
*
@ -235,7 +235,7 @@ public class FDB {
* has not been started, it will be started in the course of this call as if
* {@link #startNetwork()} had been called.
*
* This function is deprecated. Use {@link #open(String)} instead.
* @deprecated Use {@link #open(String)} instead.
*
* @param clusterFilePath the
* <a href="/foundationdb/administration.html#foundationdb-cluster-file" target="_blank">cluster file</a>
@ -259,7 +259,7 @@ public class FDB {
* {@link Executor} will be used as the default for the execution of all callbacks that
* are produced from using the resulting {@link Cluster}.
*
* This function is deprecated. Use {@link #open(String, Executor)} instead.
* @deprecated Use {@link #open(String, Executor)} instead.
*
* @param clusterFilePath the
* <a href="/foundationdb/administration.html#foundationdb-cluster-file" target="_blank">cluster file</a>

View File

@ -1090,6 +1090,7 @@ fill_operations()
class Cluster(_FDBBase):
def __init__(self, cluster_file):
self.cluster_file = cluster_file
self.options = None
def open_database(self, name):
if name != b'DB':
@ -1097,9 +1098,6 @@ class Cluster(_FDBBase):
return create_database(self.cluster_file)
def _set_option(self, option, param, length):
pass
def create_database(cluster_file=None):
pointer = ctypes.c_void_p()

View File

@ -25,7 +25,7 @@ Bindings
* C: Added `fdb_create_database` that creates a new `FDBDatabase` object synchronously and removed `fdb_future_get_database`.
* Python: Removed `fdb.init`, `fdb.create_cluster`, and `fdb.Cluster`. `fdb.open` no longer accepts a `database_name` parameter.
* Java: Deprecated `FDB.createCluster` and `Cluster`. The preferred way to get a `Database` is by using `FDB.open`, which should work in both new and old API versions.
* Java: Removed `Cluster(long cPtr, Executor executor)` constructor. This is API breaking for any code that has subclassed the `Cluster` class, and is not protected by API versioning.
* Java: Removed `Cluster(long cPtr, Executor executor)` constructor. This is API breaking for any code that has subclassed the `Cluster` class and is not protected by API versioning.
* Ruby: Removed `FDB.init`, `FDB.create_cluster`, and `FDB.Cluster`. `FDB.open` no longer accepts a `database_name` parameter.
* Golang: Deprecated `fdb.StartNetwork`, `fdb.Open`, `fdb.MustOpen`, and `fdb.CreateCluster` and added `fdb.OpenDatabase` and `fdb.MustOpenDatabase`. The preferred way to start the network and get a `Database` is by using `FDB.OpenDatabase` or `FDB.OpenDefault`.
* Flow: Deprecated `API::createCluster` and `Cluster` and added `API::createDatabase`. The preferred way to get a `Database` is by using `API::createDatabase`.