Merge branch 'master' into log-group-for-unsupported-clients
# Conflicts: # flow/Net2.actor.cpp # tests/fast/SidebandWithStatus.txt # tests/rare/LargeApiCorrectnessStatus.txt # tests/slow/DDBalanceAndRemoveStatus.txt
This commit is contained in:
commit
7cf17df821
2
Makefile
2
Makefile
|
@ -20,7 +20,7 @@ ifeq ($(MCS),)
|
|||
MCS := /usr/bin/dmcs
|
||||
endif
|
||||
|
||||
CFLAGS := -Werror -Wno-error=format -fPIC -DNO_INTELLISENSE -fvisibility=hidden -DNDEBUG=1 -Wreturn-type
|
||||
CFLAGS := -Werror -Wno-error=format -fPIC -DNO_INTELLISENSE -fvisibility=hidden -DNDEBUG=1 -Wreturn-type -fno-omit-frame-pointer
|
||||
ifeq ($(RELEASE),true)
|
||||
CFLAGS += -DFDB_CLEAN_BUILD
|
||||
endif
|
||||
|
|
|
@ -25,7 +25,7 @@ sys.path[:0]=[os.path.join(os.path.dirname(__file__), '..', '..', 'bindings', 'p
|
|||
|
||||
import util
|
||||
|
||||
FDB_API_VERSION = 500
|
||||
FDB_API_VERSION = 510
|
||||
|
||||
LOGGING = {
|
||||
'version' : 1,
|
||||
|
|
|
@ -133,7 +133,7 @@ def choose_api_version(selected_api_version, tester_min_version, tester_max_vers
|
|||
elif random.random() < 0.7:
|
||||
api_version = min_version
|
||||
elif random.random() < 0.9:
|
||||
api_version = random.choice([v for v in [13, 14, 16, 21, 22, 23, 100, 200, 300, 400, 410, 420, 430, 440, 450, 460, 500] if v >= min_version and v <= max_version])
|
||||
api_version = random.choice([v for v in [13, 14, 16, 21, 22, 23, 100, 200, 300, 400, 410, 420, 430, 440, 450, 460, 500, 510] if v >= min_version and v <= max_version])
|
||||
else:
|
||||
api_version = random.randint(min_version, max_version)
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
import os
|
||||
|
||||
MAX_API_VERSION = 500
|
||||
MAX_API_VERSION = 510
|
||||
|
||||
class Tester:
|
||||
def __init__(self, name, cmd, max_int_bits=64, min_api_version=0, max_api_version=MAX_API_VERSION, threads_enabled=True):
|
||||
|
@ -44,11 +44,11 @@ class Tester:
|
|||
def _absolute_path(path):
|
||||
return os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', path)
|
||||
|
||||
_java_cmd = 'java -ea -cp %s:%s com.apple.cie.foundationdb.test.' % (
|
||||
_java_cmd = 'java -ea -cp %s:%s com.apple.foundationdb.test.' % (
|
||||
_absolute_path('java/foundationdb-client.jar'),
|
||||
_absolute_path('java/foundationdb-tests.jar'))
|
||||
|
||||
_java_completable_cmd = 'java -ea -cp %s:%s com.apple.cie.foundationdb.test.' % (
|
||||
_java_completable_cmd = 'java -ea -cp %s:%s com.apple.foundationdb.test.' % (
|
||||
_absolute_path('java/foundationdb-client-completable.jar'),
|
||||
_absolute_path('java/foundationdb-tests-completable.jar'))
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ class ApiTest(Test):
|
|||
op_choices += write_conflicts
|
||||
op_choices += resets
|
||||
|
||||
idempotent_atomic_ops = [u'BIT_AND', u'BIT_OR', u'MAX', u'MIN']
|
||||
idempotent_atomic_ops = [u'BIT_AND', u'BIT_OR', u'MAX', u'MIN', u'BYTE_MIN', u'BYTE_MAX']
|
||||
atomic_ops = idempotent_atomic_ops + [u'ADD', u'BIT_XOR']
|
||||
|
||||
if args.concurrency > 1:
|
||||
|
|
|
@ -32,7 +32,7 @@ fdb.api_version(FDB_API_VERSION)
|
|||
|
||||
# SOMEDAY: This should probably be broken up into smaller tests
|
||||
class ScriptedTest(Test):
|
||||
TEST_API_VERSION = 500
|
||||
TEST_API_VERSION = 510
|
||||
|
||||
def __init__(self, subspace):
|
||||
super(ScriptedTest, self).__init__(subspace, ScriptedTest.TEST_API_VERSION, ScriptedTest.TEST_API_VERSION)
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define FDB_API_VERSION 500
|
||||
#define FDB_API_VERSION 510
|
||||
|
||||
#include "fdbclient/MultiVersionTransaction.h"
|
||||
#include "foundationdb/fdb_c.h"
|
||||
|
@ -70,7 +70,7 @@ fdb_bool_t fdb_error_predicate( int predicate_test, fdb_error_t code ) {
|
|||
}
|
||||
if(predicate_test == FDBErrorPredicates::RETRYABLE_NOT_COMMITTED) {
|
||||
return code == error_code_not_committed ||
|
||||
code == error_code_past_version ||
|
||||
code == error_code_transaction_too_old ||
|
||||
code == error_code_future_version ||
|
||||
code == error_code_database_locked;
|
||||
}
|
||||
|
@ -124,6 +124,12 @@ fdb_error_t fdb_stop_network() {
|
|||
CATCH_AND_RETURN( API->stopNetwork(); );
|
||||
}
|
||||
|
||||
extern "C" DLLEXPORT
|
||||
fdb_error_t fdb_add_network_thread_completion_hook(void (*hook)(void*), void *hook_parameter) {
|
||||
CATCH_AND_RETURN( API->addNetworkThreadCompletionHook(hook, hook_parameter); );
|
||||
}
|
||||
|
||||
|
||||
extern "C" DLLEXPORT
|
||||
FDBFuture* fdb_cluster_configure_database( FDBCluster* c, int config_type,
|
||||
int config_mode, uint8_t const* db_name,
|
||||
|
|
|
@ -28,10 +28,10 @@
|
|||
#endif
|
||||
|
||||
#if !defined(FDB_API_VERSION)
|
||||
#error You must #define FDB_API_VERSION prior to including fdb_c.h (current version is 500)
|
||||
#error You must #define FDB_API_VERSION prior to including fdb_c.h (current version is 510)
|
||||
#elif FDB_API_VERSION < 13
|
||||
#error API version no longer supported (upgrade to 13)
|
||||
#elif FDB_API_VERSION > 500
|
||||
#elif FDB_API_VERSION > 510
|
||||
#error Requested API version requires a newer version of this header
|
||||
#endif
|
||||
|
||||
|
@ -89,6 +89,8 @@ extern "C" {
|
|||
|
||||
DLLEXPORT WARN_UNUSED_RESULT fdb_error_t fdb_stop_network();
|
||||
|
||||
DLLEXPORT WARN_UNUSED_RESULT fdb_error_t fdb_add_network_thread_completion_hook(void (*hook)(void*), void *hook_parameter);
|
||||
|
||||
#pragma pack(push, 4)
|
||||
typedef struct keyvalue {
|
||||
const void* key;
|
||||
|
|
|
@ -602,7 +602,7 @@ void runTests(struct ResultSet *rs) {
|
|||
int main(int argc, char **argv) {
|
||||
srand(time(NULL));
|
||||
struct ResultSet *rs = newResultSet();
|
||||
checkError(fdb_select_api_version(500), "select API version", rs);
|
||||
checkError(fdb_select_api_version(510), "select API version", rs);
|
||||
printf("Running performance test at client version: %s\n", fdb_get_client_version());
|
||||
|
||||
valueStr = (uint8_t*)malloc((sizeof(uint8_t))*valueSize);
|
||||
|
|
|
@ -243,7 +243,7 @@ void runTests(struct ResultSet *rs) {
|
|||
int main(int argc, char **argv) {
|
||||
srand(time(NULL));
|
||||
struct ResultSet *rs = newResultSet();
|
||||
checkError(fdb_select_api_version(500), "select API version", rs);
|
||||
checkError(fdb_select_api_version(510), "select API version", rs);
|
||||
printf("Running RYW Benchmark test at client version: %s\n", fdb_get_client_version());
|
||||
|
||||
keys = generateKeys(numKeys, keySize);
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <pthread.h>
|
||||
|
||||
#ifndef FDB_API_VERSION
|
||||
#define FDB_API_VERSION 500
|
||||
#define FDB_API_VERSION 510
|
||||
#endif
|
||||
|
||||
#include <foundationdb/fdb_c.h>
|
||||
|
|
|
@ -131,7 +131,7 @@ namespace FDB {
|
|||
}
|
||||
else {
|
||||
if(versionBytes.get().size() != 12) {
|
||||
throw invalid_database_value();
|
||||
throw invalid_directory_layer_metadata();
|
||||
}
|
||||
if(((uint32_t*)versionBytes.get().begin())[0] > DirectoryLayer::VERSION[0]) {
|
||||
throw incompatible_directory_version();
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace FDB {
|
|||
int64_t count = 0;
|
||||
if(countValue.present()) {
|
||||
if(countValue.get().size() != 8) {
|
||||
throw invalid_database_value();
|
||||
throw invalid_directory_layer_metadata();
|
||||
}
|
||||
count = *(int64_t*)countValue.get().begin();
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ THREAD_FUNC networkThread(void* fdb) {
|
|||
}
|
||||
|
||||
ACTOR Future<Void> _test() {
|
||||
API *fdb = FDB::API::selectAPIVersion(500);
|
||||
API *fdb = FDB::API::selectAPIVersion(510);
|
||||
auto c = fdb->createCluster( std::string() );
|
||||
auto db = c->createDatabase();
|
||||
state Reference<Transaction> tr( new Transaction(db) );
|
||||
|
@ -77,7 +77,7 @@ ACTOR Future<Void> _test() {
|
|||
}
|
||||
|
||||
void fdb_flow_test() {
|
||||
API *fdb = FDB::API::selectAPIVersion(500);
|
||||
API *fdb = FDB::API::selectAPIVersion(510);
|
||||
fdb->setupNetwork();
|
||||
startThread(networkThread, fdb);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include <flow/flow.h>
|
||||
|
||||
#define FDB_API_VERSION 500
|
||||
#define FDB_API_VERSION 510
|
||||
#include <bindings/c/foundationdb/fdb_c.h>
|
||||
#undef DLLEXPORT
|
||||
|
||||
|
|
|
@ -1506,10 +1506,37 @@ REGISTER_INSTRUCTION_FUNC(AtomicOPFunc);
|
|||
struct UnitTestsFunc : InstructionFunc {
|
||||
static const char* name;
|
||||
|
||||
static Future<Void> call(Reference<FlowTesterData> const& data, Reference<InstructionData> const& instruction) {
|
||||
ACTOR static Future<Void> call(Reference<FlowTesterData> data, Reference<InstructionData> instruction) {
|
||||
ASSERT(data->api->evaluatePredicate(FDBErrorPredicate::FDB_ERROR_PREDICATE_RETRYABLE, Error(1020)));
|
||||
ASSERT(!data->api->evaluatePredicate(FDBErrorPredicate::FDB_ERROR_PREDICATE_RETRYABLE, Error(10)));
|
||||
|
||||
state Reference<Transaction> tr(new Transaction(data->db));
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_PRIORITY_SYSTEM_IMMEDIATE);
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_PRIORITY_SYSTEM_IMMEDIATE);
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_PRIORITY_BATCH);
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_CAUSAL_READ_RISKY);
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_CAUSAL_WRITE_RISKY);
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_READ_YOUR_WRITES_DISABLE);
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_READ_AHEAD_DISABLE);
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_READ_SYSTEM_KEYS);
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_ACCESS_SYSTEM_KEYS);
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_DURABILITY_DEV_NULL_IS_WEB_SCALE);
|
||||
const uint64_t timeout = 60*1000;
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_TIMEOUT, Optional<StringRef>(StringRef((const uint8_t*)&timeout, 8)));
|
||||
const uint64_t retryLimit = 50;
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_RETRY_LIMIT, Optional<StringRef>(StringRef((const uint8_t*)&retryLimit, 8)));
|
||||
const uint64_t maxRetryDelay = 100;
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_MAX_RETRY_DELAY, Optional<StringRef>(StringRef((const uint8_t*)&maxRetryDelay, 8)));
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_USED_DURING_COMMIT_PROTECTION_DISABLE);
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_TRANSACTION_LOGGING_ENABLE, Optional<StringRef>(LiteralStringRef("my_transaction")));
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_READ_LOCK_AWARE);
|
||||
tr->setOption(FDBTransactionOption::FDB_TR_OPTION_LOCK_AWARE);
|
||||
|
||||
Optional<FDBStandalone<ValueRef> > _ = wait(tr->get(LiteralStringRef("\xff")));
|
||||
tr->cancel();
|
||||
|
||||
return Void();
|
||||
|
||||
}
|
||||
};
|
||||
const char* UnitTestsFunc::name = "UNIT_TESTS";
|
||||
|
@ -1585,7 +1612,7 @@ ACTOR static Future<Void> doInstructions(Reference<FlowTesterData> data) {
|
|||
}
|
||||
catch (Error& e) {
|
||||
if(LOG_ERRORS) {
|
||||
printf("Error: %s (%d)\n", e.what(), e.code());
|
||||
printf("Error: %s (%d)\n", e.name(), e.code());
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
|
@ -1631,6 +1658,8 @@ void populateAtomicOpMap() {
|
|||
optionInfo["MIN"] = FDBMutationType::FDB_MUTATION_TYPE_MIN;
|
||||
optionInfo["SET_VERSIONSTAMPED_KEY"] = FDBMutationType::FDB_MUTATION_TYPE_SET_VERSIONSTAMPED_KEY;
|
||||
optionInfo["SET_VERSIONSTAMPED_VALUE"] = FDBMutationType::FDB_MUTATION_TYPE_SET_VERSIONSTAMPED_VALUE;
|
||||
optionInfo["BYTE_MIN"] = FDBMutationType::FDB_MUTATION_TYPE_BYTE_MIN;
|
||||
optionInfo["BYTE_MAX"] = FDBMutationType::FDB_MUTATION_TYPE_BYTE_MAX;
|
||||
}
|
||||
|
||||
void populateOpsThatCreateDirectories() {
|
||||
|
@ -1673,7 +1702,7 @@ ACTOR void startTest(std::string clusterFilename, StringRef prefix, int apiVersi
|
|||
catch(Error &e) {
|
||||
TraceEvent("ErrorRunningTest").error(e);
|
||||
if(LOG_ERRORS) {
|
||||
printf("Flow tester encountered error: %s\n", e.what());
|
||||
printf("Flow tester encountered error: %s\n", e.name());
|
||||
fflush(stdout);
|
||||
}
|
||||
flushAndExit(1);
|
||||
|
@ -1685,7 +1714,7 @@ ACTOR void _test_versionstamp() {
|
|||
try {
|
||||
g_network = newNet2(NetworkAddress(), false);
|
||||
|
||||
API *fdb = FDB::API::selectAPIVersion(500);
|
||||
API *fdb = FDB::API::selectAPIVersion(510);
|
||||
|
||||
fdb->setupNetwork();
|
||||
startThread(networkThread, fdb);
|
||||
|
@ -1715,7 +1744,7 @@ ACTOR void _test_versionstamp() {
|
|||
catch (Error &e) {
|
||||
TraceEvent("ErrorRunningTest").error(e);
|
||||
if (LOG_ERRORS) {
|
||||
printf("Flow tester encountered error: %s\n", e.what());
|
||||
printf("Flow tester encountered error: %s\n", e.name());
|
||||
fflush(stdout);
|
||||
}
|
||||
flushAndExit(1);
|
||||
|
@ -1756,7 +1785,7 @@ int main( int argc, char** argv ) {
|
|||
flushAndExit(FDB_EXIT_SUCCESS);
|
||||
}
|
||||
catch (Error& e) {
|
||||
fprintf(stderr, "Error: %s\n", e.what());
|
||||
fprintf(stderr, "Error: %s\n", e.name());
|
||||
TraceEvent(SevError, "MainError").error(e);
|
||||
flushAndExit(FDB_EXIT_MAIN_ERROR);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ This package requires:
|
|||
- Go 1.1+ with CGO enabled
|
||||
- FoundationDB C API 2.0.x, 3.0.x, or 4.x.y (part of the [FoundationDB clients package](https://files.foundationdb.org/fdb-c/))
|
||||
|
||||
Use of this package requires the selection of a FoundationDB API version at runtime. This package currently supports FoundationDB API versions 200-500.
|
||||
Use of this package requires the selection of a FoundationDB API version at runtime. This package currently supports FoundationDB API versions 200-510.
|
||||
|
||||
To build this package, in the top level of this repository run:
|
||||
|
||||
|
|
|
@ -745,6 +745,8 @@ func (sm *StackMachine) processInst(idx int, inst tuple.Tuple) {
|
|||
tr.Options().SetMaxRetryDelay(100)
|
||||
tr.Options().SetUsedDuringCommitProtectionDisable()
|
||||
tr.Options().SetTransactionLoggingEnable("my_transaction")
|
||||
tr.Options().SetReadLockAware()
|
||||
tr.Options().SetLockAware()
|
||||
|
||||
return tr.Get(fdb.Key("\xff")).MustGet(), nil
|
||||
})
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
package fdb
|
||||
|
||||
/*
|
||||
#define FDB_API_VERSION 500
|
||||
#define FDB_API_VERSION 510
|
||||
#include <foundationdb/fdb_c.h>
|
||||
*/
|
||||
import "C"
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
package fdb
|
||||
|
||||
/*
|
||||
#define FDB_API_VERSION 500
|
||||
#define FDB_API_VERSION 510
|
||||
#include <foundationdb/fdb_c.h>
|
||||
*/
|
||||
import "C"
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
package fdb
|
||||
|
||||
/*
|
||||
#define FDB_API_VERSION 500
|
||||
#define FDB_API_VERSION 510
|
||||
#include <foundationdb/fdb_c.h>
|
||||
*/
|
||||
import "C"
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
package fdb
|
||||
|
||||
/*
|
||||
#define FDB_API_VERSION 500
|
||||
#define FDB_API_VERSION 510
|
||||
#include <foundationdb/fdb_c.h>
|
||||
#include <stdlib.h>
|
||||
*/
|
||||
|
@ -109,7 +109,7 @@ func (opt NetworkOptions) setOpt(code int, param []byte) error {
|
|||
// library, an error will be returned. APIVersion must be called prior to any
|
||||
// other functions in the fdb package.
|
||||
//
|
||||
// Currently, this package supports API versions 200 through 500.
|
||||
// Currently, this package supports API versions 200 through 510.
|
||||
//
|
||||
// Warning: When using the multi-version client API, setting an API version that
|
||||
// is not supported by a particular client library will prevent that client from
|
||||
|
@ -117,7 +117,7 @@ func (opt NetworkOptions) setOpt(code int, param []byte) error {
|
|||
// the API version of your application after upgrading your client until the
|
||||
// cluster has also been upgraded.
|
||||
func APIVersion(version int) error {
|
||||
headerVersion := 500
|
||||
headerVersion := 510
|
||||
|
||||
networkMutex.Lock()
|
||||
defer networkMutex.Unlock()
|
||||
|
@ -129,7 +129,7 @@ func APIVersion(version int) error {
|
|||
return errAPIVersionAlreadySet
|
||||
}
|
||||
|
||||
if version < 200 || version > 500 {
|
||||
if version < 200 || version > 510 {
|
||||
return errAPIVersionNotSupported
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ package fdb
|
|||
|
||||
/*
|
||||
#cgo LDFLAGS: -lfdb_c -lm
|
||||
#define FDB_API_VERSION 500
|
||||
#define FDB_API_VERSION 510
|
||||
#include <foundationdb/fdb_c.h>
|
||||
#include <string.h>
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
package fdb
|
||||
|
||||
/*
|
||||
#define FDB_API_VERSION 500
|
||||
#define FDB_API_VERSION 510
|
||||
#include <foundationdb/fdb_c.h>
|
||||
*/
|
||||
import "C"
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
package fdb
|
||||
|
||||
/*
|
||||
#define FDB_API_VERSION 500
|
||||
#define FDB_API_VERSION 510
|
||||
#include <foundationdb/fdb_c.h>
|
||||
*/
|
||||
import "C"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <jni.h>
|
||||
#include <string.h>
|
||||
|
||||
#define FDB_API_VERSION 500
|
||||
#define FDB_API_VERSION 510
|
||||
|
||||
#include <foundationdb/fdb_c.h>
|
||||
|
||||
|
@ -38,8 +38,18 @@
|
|||
#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 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_IFutureCallback_call_methodID = 0;
|
||||
g_jvm->DetachCurrentThread();
|
||||
}
|
||||
}
|
||||
|
||||
void throwOutOfMem(JNIEnv *jenv) {
|
||||
const char *className = "java/lang/OutOfMemoryError";
|
||||
|
@ -59,7 +69,7 @@ void throwOutOfMem(JNIEnv *jenv) {
|
|||
}
|
||||
|
||||
static jthrowable getThrowable(JNIEnv *jenv, fdb_error_t e, const char* msg = NULL) {
|
||||
jclass excepClass = jenv->FindClass("com/apple/cie/foundationdb/FDBException");
|
||||
jclass excepClass = jenv->FindClass("com/apple/foundationdb/FDBException");
|
||||
if(jenv->ExceptionOccurred())
|
||||
return JNI_NULL;
|
||||
|
||||
|
@ -103,12 +113,6 @@ void throwParamNotNull(JNIEnv *jenv) {
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
static void callCallback( FDBFuture* f, void* data ) {
|
||||
jobject callback = (jobject)data;
|
||||
g_thread_jenv->CallVoidMethod( callback, g_IFutureCallback_call_methodID );
|
||||
g_thread_jenv->DeleteGlobalRef(callback);
|
||||
}
|
||||
|
||||
// If the methods are not found, exceptions are thrown and this will return false.
|
||||
// Returns TRUE on success, false otherwise.
|
||||
static bool findCallbackMethods(JNIEnv *jenv) {
|
||||
|
@ -123,6 +127,27 @@ static bool findCallbackMethods(JNIEnv *jenv) {
|
|||
return true;
|
||||
}
|
||||
|
||||
static void callCallback( FDBFuture* f, void* data ) {
|
||||
if (g_thread_jenv == 0) {
|
||||
// We are on an external thread and must attach to the JVM.
|
||||
// The shutdown hook will later detach this thread.
|
||||
is_external = true;
|
||||
if( g_jvm != 0 && g_jvm->AttachCurrentThreadAsDaemon((void **) &g_thread_jenv, JNI_NULL) == JNI_OK ) {
|
||||
if( !findCallbackMethods( g_thread_jenv ) ) {
|
||||
g_thread_jenv->FatalError("FDB: Could not find callback method.\n");
|
||||
}
|
||||
} else {
|
||||
// Can't call FatalError, because we don't have a pointer to the jenv...
|
||||
// There will be a segmentation fault from the attempt to call the callback method.
|
||||
fprintf(stderr, "FDB: Could not attach external client thread to the JVM as daemon.\n");
|
||||
}
|
||||
}
|
||||
|
||||
jobject callback = (jobject)data;
|
||||
g_thread_jenv->CallVoidMethod( callback, g_IFutureCallback_call_methodID );
|
||||
g_thread_jenv->DeleteGlobalRef(callback);
|
||||
}
|
||||
|
||||
// Attempts to throw 't', attempts to shut down the JVM if this fails.
|
||||
void safeThrow( JNIEnv *jenv, jthrowable t ) {
|
||||
if( jenv->Throw( t ) != 0 ) {
|
||||
|
@ -130,7 +155,7 @@ void safeThrow( JNIEnv *jenv, jthrowable t ) {
|
|||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_NativeFuture_Future_1registerCallback(JNIEnv *jenv, jobject cls, jlong future, jobject callback) {
|
||||
JNIEXPORT void JNICALL Java_com_apple_foundationdb_NativeFuture_Future_1registerCallback(JNIEnv *jenv, jobject cls, jlong future, jobject callback) {
|
||||
// SOMEDAY: Do this on module load instead. Can we cache method ids across threads?
|
||||
if( !g_IFutureCallback_call_methodID ) {
|
||||
if( !findCallbackMethods( jenv ) ) {
|
||||
|
@ -163,7 +188,7 @@ JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_NativeFuture_Future_1regi
|
|||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_NativeFuture_Future_1blockUntilReady(JNIEnv *jenv, jobject, jlong future) {
|
||||
JNIEXPORT void JNICALL Java_com_apple_foundationdb_NativeFuture_Future_1blockUntilReady(JNIEnv *jenv, jobject, jlong future) {
|
||||
if( !future ) {
|
||||
throwParamNotNull(jenv);
|
||||
return;
|
||||
|
@ -175,7 +200,7 @@ JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_NativeFuture_Future_1bloc
|
|||
safeThrow( jenv, getThrowable( jenv, err ) );
|
||||
}
|
||||
|
||||
JNIEXPORT jthrowable JNICALL Java_com_apple_cie_foundationdb_NativeFuture_Future_1getError(JNIEnv *jenv, jobject, jlong future) {
|
||||
JNIEXPORT jthrowable JNICALL Java_com_apple_foundationdb_NativeFuture_Future_1getError(JNIEnv *jenv, jobject, jlong future) {
|
||||
if( !future ) {
|
||||
throwParamNotNull(jenv);
|
||||
return JNI_NULL;
|
||||
|
@ -184,7 +209,7 @@ JNIEXPORT jthrowable JNICALL Java_com_apple_cie_foundationdb_NativeFuture_Future
|
|||
return getThrowable( jenv, fdb_future_get_error( sav ) );
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_com_apple_cie_foundationdb_NativeFuture_Future_1isReady(JNIEnv *jenv, jobject, jlong future) {
|
||||
JNIEXPORT jboolean JNICALL Java_com_apple_foundationdb_NativeFuture_Future_1isReady(JNIEnv *jenv, jobject, jlong future) {
|
||||
if( !future ) {
|
||||
throwParamNotNull(jenv);
|
||||
return JNI_FALSE;
|
||||
|
@ -193,7 +218,7 @@ JNIEXPORT jboolean JNICALL Java_com_apple_cie_foundationdb_NativeFuture_Future_1
|
|||
return (jboolean)fdb_future_is_ready(var);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_NativeFuture_Future_1dispose(JNIEnv *jenv, jobject, jlong future) {
|
||||
JNIEXPORT void JNICALL Java_com_apple_foundationdb_NativeFuture_Future_1dispose(JNIEnv *jenv, jobject, jlong future) {
|
||||
if( !future ) {
|
||||
throwParamNotNull(jenv);
|
||||
return;
|
||||
|
@ -202,7 +227,7 @@ JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_NativeFuture_Future_1disp
|
|||
fdb_future_destroy(var);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_NativeFuture_Future_1cancel(JNIEnv *jenv, jobject, jlong future) {
|
||||
JNIEXPORT void JNICALL Java_com_apple_foundationdb_NativeFuture_Future_1cancel(JNIEnv *jenv, jobject, jlong future) {
|
||||
if( !future ) {
|
||||
throwParamNotNull(jenv);
|
||||
return;
|
||||
|
@ -211,7 +236,7 @@ JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_NativeFuture_Future_1canc
|
|||
fdb_future_cancel(var);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_NativeFuture_Future_1releaseMemory(JNIEnv *jenv, jobject, jlong future) {
|
||||
JNIEXPORT void JNICALL Java_com_apple_foundationdb_NativeFuture_Future_1releaseMemory(JNIEnv *jenv, jobject, jlong future) {
|
||||
if( !future ) {
|
||||
throwParamNotNull(jenv);
|
||||
return;
|
||||
|
@ -220,7 +245,7 @@ JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_NativeFuture_Future_1rele
|
|||
fdb_future_release_memory(var);
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FutureVersion_FutureVersion_1get(JNIEnv *jenv, jobject, jlong future) {
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_foundationdb_FutureVersion_FutureVersion_1get(JNIEnv *jenv, jobject, jlong future) {
|
||||
if( !future ) {
|
||||
throwParamNotNull(jenv);
|
||||
return 0;
|
||||
|
@ -237,7 +262,7 @@ JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FutureVersion_FutureVers
|
|||
return (jlong)version;
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL Java_com_apple_cie_foundationdb_FutureStrings_FutureStrings_1get(JNIEnv *jenv, jobject, jlong future) {
|
||||
JNIEXPORT jobject JNICALL Java_com_apple_foundationdb_FutureStrings_FutureStrings_1get(JNIEnv *jenv, jobject, jlong future) {
|
||||
if( !future ) {
|
||||
throwParamNotNull(jenv);
|
||||
return JNI_NULL;
|
||||
|
@ -278,13 +303,13 @@ JNIEXPORT jobject JNICALL Java_com_apple_cie_foundationdb_FutureStrings_FutureSt
|
|||
return arr;
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL Java_com_apple_cie_foundationdb_FutureResults_FutureResults_1getSummary(JNIEnv *jenv, jobject, jlong future) {
|
||||
JNIEXPORT jobject JNICALL Java_com_apple_foundationdb_FutureResults_FutureResults_1getSummary(JNIEnv *jenv, jobject, jlong future) {
|
||||
if( !future ) {
|
||||
throwParamNotNull(jenv);
|
||||
return JNI_NULL;
|
||||
}
|
||||
|
||||
jclass resultCls = jenv->FindClass("com/apple/cie/foundationdb/RangeResultSummary");
|
||||
jclass resultCls = jenv->FindClass("com/apple/foundationdb/RangeResultSummary");
|
||||
if( jenv->ExceptionOccurred() )
|
||||
return JNI_NULL;
|
||||
jmethodID resultCtorId = jenv->GetMethodID(resultCls, "<init>", "([BIZ)V");
|
||||
|
@ -322,13 +347,13 @@ JNIEXPORT jobject JNICALL Java_com_apple_cie_foundationdb_FutureResults_FutureRe
|
|||
}
|
||||
|
||||
// SOMEDAY: explore doing this more efficiently with Direct ByteBuffers
|
||||
JNIEXPORT jobject JNICALL Java_com_apple_cie_foundationdb_FutureResults_FutureResults_1get(JNIEnv *jenv, jobject, jlong future) {
|
||||
JNIEXPORT jobject JNICALL Java_com_apple_foundationdb_FutureResults_FutureResults_1get(JNIEnv *jenv, jobject, jlong future) {
|
||||
if( !future ) {
|
||||
throwParamNotNull(jenv);
|
||||
return JNI_NULL;
|
||||
}
|
||||
|
||||
jclass resultCls = jenv->FindClass("com/apple/cie/foundationdb/RangeResult");
|
||||
jclass resultCls = jenv->FindClass("com/apple/foundationdb/RangeResult");
|
||||
jmethodID resultCtorId = jenv->GetMethodID(resultCls, "<init>", "([B[IZ)V");
|
||||
|
||||
FDBFuture *f = (FDBFuture *)future;
|
||||
|
@ -353,10 +378,18 @@ JNIEXPORT jobject JNICALL Java_com_apple_cie_foundationdb_FutureResults_FutureRe
|
|||
throwOutOfMem(jenv);
|
||||
return JNI_NULL;
|
||||
}
|
||||
uint8_t *keyvalues_barr = (uint8_t *)jenv->GetByteArrayElements(keyValueArray, NULL);
|
||||
if (!keyvalues_barr) {
|
||||
throwRuntimeEx( jenv, "Error getting handle to native resources" );
|
||||
return JNI_NULL;
|
||||
}
|
||||
|
||||
jintArray lengthArray = jenv->NewIntArray(count * 2);
|
||||
if( !lengthArray ) {
|
||||
if( !jenv->ExceptionOccurred() )
|
||||
throwOutOfMem(jenv);
|
||||
|
||||
jenv->ReleaseByteArrayElements(keyValueArray, (jbyte *)keyvalues_barr, 0);
|
||||
return JNI_NULL;
|
||||
}
|
||||
|
||||
|
@ -364,20 +397,23 @@ JNIEXPORT jobject JNICALL Java_com_apple_cie_foundationdb_FutureResults_FutureRe
|
|||
if( !length_barr ) {
|
||||
if( !jenv->ExceptionOccurred() )
|
||||
throwOutOfMem(jenv);
|
||||
|
||||
jenv->ReleaseByteArrayElements(keyValueArray, (jbyte *)keyvalues_barr, 0);
|
||||
return JNI_NULL;
|
||||
}
|
||||
|
||||
int offset = 0;
|
||||
for(int i = 0; i < count; i++) {
|
||||
jenv->SetByteArrayRegion(keyValueArray, offset, kvs[i].key_length, (jbyte *)kvs[i].key);
|
||||
memcpy(keyvalues_barr + offset, kvs[i].key, kvs[i].key_length);
|
||||
length_barr[ i * 2 ] = kvs[i].key_length;
|
||||
offset += kvs[i].key_length;
|
||||
|
||||
jenv->SetByteArrayRegion(keyValueArray, offset, kvs[i].value_length, (jbyte *)kvs[i].value);
|
||||
memcpy(keyvalues_barr + offset, kvs[i].value, kvs[i].value_length);
|
||||
length_barr[ (i * 2) + 1 ] = kvs[i].value_length;
|
||||
offset += kvs[i].value_length;
|
||||
}
|
||||
|
||||
jenv->ReleaseByteArrayElements(keyValueArray, (jbyte *)keyvalues_barr, 0);
|
||||
jenv->ReleaseIntArrayElements(lengthArray, length_barr, 0);
|
||||
|
||||
jobject result = jenv->NewObject(resultCls, resultCtorId, keyValueArray, lengthArray, (jboolean)more);
|
||||
|
@ -388,7 +424,7 @@ JNIEXPORT jobject JNICALL Java_com_apple_cie_foundationdb_FutureResults_FutureRe
|
|||
}
|
||||
|
||||
// SOMEDAY: explore doing this more efficiently with Direct ByteBuffers
|
||||
JNIEXPORT jbyteArray JNICALL Java_com_apple_cie_foundationdb_FutureResult_FutureResult_1get(JNIEnv *jenv, jobject, jlong future) {
|
||||
JNIEXPORT jbyteArray JNICALL Java_com_apple_foundationdb_FutureResult_FutureResult_1get(JNIEnv *jenv, jobject, jlong future) {
|
||||
if( !future ) {
|
||||
throwParamNotNull(jenv);
|
||||
return JNI_NULL;
|
||||
|
@ -418,7 +454,7 @@ JNIEXPORT jbyteArray JNICALL Java_com_apple_cie_foundationdb_FutureResult_Future
|
|||
return result;
|
||||
}
|
||||
|
||||
JNIEXPORT jbyteArray JNICALL Java_com_apple_cie_foundationdb_FutureKey_FutureKey_1get(JNIEnv * jenv, jclass, jlong future) {
|
||||
JNIEXPORT jbyteArray JNICALL Java_com_apple_foundationdb_FutureKey_FutureKey_1get(JNIEnv * jenv, jclass, jlong future) {
|
||||
if( !future ) {
|
||||
throwParamNotNull(jenv);
|
||||
return JNI_NULL;
|
||||
|
@ -444,7 +480,7 @@ JNIEXPORT jbyteArray JNICALL Java_com_apple_cie_foundationdb_FutureKey_FutureKey
|
|||
return result;
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FutureCluster_FutureCluster_1get(JNIEnv *jenv, jobject, jlong future) {
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_foundationdb_FutureCluster_FutureCluster_1get(JNIEnv *jenv, jobject, jlong future) {
|
||||
if( !future ) {
|
||||
throwParamNotNull(jenv);
|
||||
return 0;
|
||||
|
@ -460,7 +496,7 @@ JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FutureCluster_FutureClus
|
|||
return (jlong)cluster;
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FutureDatabase_FutureDatabase_1get(JNIEnv *jenv, jobject, jlong future) {
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_foundationdb_FutureDatabase_FutureDatabase_1get(JNIEnv *jenv, jobject, jlong future) {
|
||||
if( !future ) {
|
||||
throwParamNotNull(jenv);
|
||||
return 0;
|
||||
|
@ -476,7 +512,7 @@ JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FutureDatabase_FutureDat
|
|||
return (jlong)database;
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FDBDatabase_Database_1createTransaction(JNIEnv *jenv, jobject, jlong dbPtr) {
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_foundationdb_FDBDatabase_Database_1createTransaction(JNIEnv *jenv, jobject, jlong dbPtr) {
|
||||
if( !dbPtr ) {
|
||||
throwParamNotNull(jenv);
|
||||
return 0;
|
||||
|
@ -491,7 +527,7 @@ JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FDBDatabase_Database_1cr
|
|||
return (jlong)tr;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDBDatabase_Database_1dispose(JNIEnv *jenv, jobject, jlong dPtr) {
|
||||
JNIEXPORT void JNICALL Java_com_apple_foundationdb_FDBDatabase_Database_1dispose(JNIEnv *jenv, jobject, jlong dPtr) {
|
||||
if( !dPtr ) {
|
||||
throwParamNotNull(jenv);
|
||||
return;
|
||||
|
@ -499,7 +535,7 @@ JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDBDatabase_Database_1dis
|
|||
fdb_database_destroy( (FDBDatabase *)dPtr );
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDBDatabase_Database_1setOption(JNIEnv *jenv, jobject, jlong dPtr, jint code, jbyteArray value) {
|
||||
JNIEXPORT void JNICALL Java_com_apple_foundationdb_FDBDatabase_Database_1setOption(JNIEnv *jenv, jobject, jlong dPtr, jint code, jbyteArray value) {
|
||||
if( !dPtr ) {
|
||||
throwParamNotNull(jenv);
|
||||
return;
|
||||
|
@ -524,11 +560,11 @@ JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDBDatabase_Database_1set
|
|||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_com_apple_cie_foundationdb_FDB_Error_1predicate(JNIEnv *jenv, jobject, jint predicate, jint code) {
|
||||
JNIEXPORT jboolean JNICALL Java_com_apple_foundationdb_FDB_Error_1predicate(JNIEnv *jenv, jobject, jint predicate, jint code) {
|
||||
return (jboolean)fdb_error_predicate(predicate, code);
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FDB_Cluster_1create(JNIEnv *jenv, jobject, jstring clusterFileName) {
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_foundationdb_FDB_Cluster_1create(JNIEnv *jenv, jobject, jstring clusterFileName) {
|
||||
const char* fileName = 0;
|
||||
if(clusterFileName != 0) {
|
||||
fileName = jenv->GetStringUTFChars(clusterFileName, 0);
|
||||
|
@ -541,7 +577,7 @@ JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FDB_Cluster_1create(JNIE
|
|||
return (jlong)cluster;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_Cluster_Cluster_1setOption(JNIEnv *jenv, jobject, jlong cPtr, jint code, jbyteArray value) {
|
||||
JNIEXPORT void JNICALL Java_com_apple_foundationdb_Cluster_Cluster_1setOption(JNIEnv *jenv, jobject, jlong cPtr, jint code, jbyteArray value) {
|
||||
if( !cPtr ) {
|
||||
throwParamNotNull(jenv);
|
||||
return;
|
||||
|
@ -566,7 +602,7 @@ JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_Cluster_Cluster_1setOptio
|
|||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_Cluster_Cluster_1dispose(JNIEnv *jenv, jobject, jlong cPtr) {
|
||||
JNIEXPORT void JNICALL Java_com_apple_foundationdb_Cluster_Cluster_1dispose(JNIEnv *jenv, jobject, jlong cPtr) {
|
||||
if( !cPtr ) {
|
||||
throwParamNotNull(jenv);
|
||||
return;
|
||||
|
@ -574,7 +610,7 @@ JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_Cluster_Cluster_1dispose(
|
|||
fdb_cluster_destroy( (FDBCluster *)cPtr );
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_Cluster_Cluster_1createDatabase(JNIEnv *jenv, jobject, jlong cPtr, jbyteArray dbNameBytes) {
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_foundationdb_Cluster_Cluster_1createDatabase(JNIEnv *jenv, jobject, jlong cPtr, jbyteArray dbNameBytes) {
|
||||
if( !cPtr || !dbNameBytes ) {
|
||||
throwParamNotNull(jenv);
|
||||
return 0;
|
||||
|
@ -593,7 +629,7 @@ JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_Cluster_Cluster_1createD
|
|||
return (jlong)f;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transaction_1setVersion(JNIEnv *jenv, jobject, jlong tPtr, jlong version) {
|
||||
JNIEXPORT void JNICALL Java_com_apple_foundationdb_FDBTransaction_Transaction_1setVersion(JNIEnv *jenv, jobject, jlong tPtr, jlong version) {
|
||||
if( !tPtr ) {
|
||||
throwParamNotNull(jenv);
|
||||
return;
|
||||
|
@ -602,7 +638,7 @@ JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transactio
|
|||
fdb_transaction_set_read_version( tr, version );
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transaction_1getReadVersion(JNIEnv *jenv, jobject, jlong tPtr) {
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_foundationdb_FDBTransaction_Transaction_1getReadVersion(JNIEnv *jenv, jobject, jlong tPtr) {
|
||||
if( !tPtr ) {
|
||||
throwParamNotNull(jenv);
|
||||
return 0;
|
||||
|
@ -612,7 +648,7 @@ JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transacti
|
|||
return (jlong)f;
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transaction_1get(JNIEnv *jenv, jobject, jlong tPtr, jbyteArray keyBytes, jboolean snapshot) {
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_foundationdb_FDBTransaction_Transaction_1get(JNIEnv *jenv, jobject, jlong tPtr, jbyteArray keyBytes, jboolean snapshot) {
|
||||
if( !tPtr || !keyBytes ) {
|
||||
throwParamNotNull(jenv);
|
||||
return 0;
|
||||
|
@ -631,7 +667,7 @@ JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transacti
|
|||
return (jlong)f;
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transaction_1getKey(JNIEnv *jenv, jobject, jlong tPtr,
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_foundationdb_FDBTransaction_Transaction_1getKey(JNIEnv *jenv, jobject, jlong tPtr,
|
||||
jbyteArray keyBytes, jboolean orEqual, jint offset, jboolean snapshot) {
|
||||
if( !tPtr || !keyBytes ) {
|
||||
throwParamNotNull(jenv);
|
||||
|
@ -651,7 +687,7 @@ JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transacti
|
|||
return (jlong)f;
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transaction_1getRange
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_foundationdb_FDBTransaction_Transaction_1getRange
|
||||
(JNIEnv *jenv, jobject, jlong tPtr, jbyteArray keyBeginBytes, jboolean orEqualBegin, jint offsetBegin,
|
||||
jbyteArray keyEndBytes, jboolean orEqualEnd, jint offsetEnd, jint rowLimit, jint targetBytes,
|
||||
jint streamingMode, jint iteration, jboolean snapshot, jboolean reverse) {
|
||||
|
@ -685,7 +721,7 @@ JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transacti
|
|||
return (jlong)f;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transaction_1set(JNIEnv *jenv, jobject, jlong tPtr, jbyteArray keyBytes, jbyteArray valueBytes) {
|
||||
JNIEXPORT void JNICALL Java_com_apple_foundationdb_FDBTransaction_Transaction_1set(JNIEnv *jenv, jobject, jlong tPtr, jbyteArray keyBytes, jbyteArray valueBytes) {
|
||||
if( !tPtr || !keyBytes || !valueBytes ) {
|
||||
throwParamNotNull(jenv);
|
||||
return;
|
||||
|
@ -714,7 +750,7 @@ JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transactio
|
|||
jenv->ReleaseByteArrayElements( valueBytes, (jbyte *)barrValue, JNI_ABORT );
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transaction_1clear__J_3B(JNIEnv *jenv, jobject, jlong tPtr, jbyteArray keyBytes) {
|
||||
JNIEXPORT void JNICALL Java_com_apple_foundationdb_FDBTransaction_Transaction_1clear__J_3B(JNIEnv *jenv, jobject, jlong tPtr, jbyteArray keyBytes) {
|
||||
if( !tPtr || !keyBytes ) {
|
||||
throwParamNotNull(jenv);
|
||||
return;
|
||||
|
@ -732,7 +768,7 @@ JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transactio
|
|||
jenv->ReleaseByteArrayElements( keyBytes, (jbyte *)barr, JNI_ABORT );
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transaction_1clear__J_3B_3B(JNIEnv *jenv, jobject, jlong tPtr, jbyteArray keyBeginBytes, jbyteArray keyEndBytes) {
|
||||
JNIEXPORT void JNICALL Java_com_apple_foundationdb_FDBTransaction_Transaction_1clear__J_3B_3B(JNIEnv *jenv, jobject, jlong tPtr, jbyteArray keyBeginBytes, jbyteArray keyEndBytes) {
|
||||
if( !tPtr || !keyBeginBytes || !keyEndBytes ) {
|
||||
throwParamNotNull(jenv);
|
||||
return;
|
||||
|
@ -761,7 +797,7 @@ JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transactio
|
|||
jenv->ReleaseByteArrayElements( keyEndBytes, (jbyte *)barrKeyEnd, JNI_ABORT );
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transaction_1mutate(JNIEnv *jenv, jobject, jlong tPtr, jint code,
|
||||
JNIEXPORT void JNICALL Java_com_apple_foundationdb_FDBTransaction_Transaction_1mutate(JNIEnv *jenv, jobject, jlong tPtr, jint code,
|
||||
jbyteArray key, jbyteArray value ) {
|
||||
if( !tPtr || !key || !value ) {
|
||||
throwParamNotNull(jenv);
|
||||
|
@ -793,7 +829,7 @@ JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transactio
|
|||
jenv->ReleaseByteArrayElements( value, (jbyte *)barrValue, JNI_ABORT );
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transaction_1commit(JNIEnv *jenv, jobject, jlong tPtr) {
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_foundationdb_FDBTransaction_Transaction_1commit(JNIEnv *jenv, jobject, jlong tPtr) {
|
||||
if( !tPtr ) {
|
||||
throwParamNotNull(jenv);
|
||||
return 0;
|
||||
|
@ -803,7 +839,7 @@ JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transacti
|
|||
return (jlong)f;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transaction_1setOption(JNIEnv *jenv, jobject, jlong tPtr, jint code, jbyteArray value) {
|
||||
JNIEXPORT void JNICALL Java_com_apple_foundationdb_FDBTransaction_Transaction_1setOption(JNIEnv *jenv, jobject, jlong tPtr, jint code, jbyteArray value) {
|
||||
if( !tPtr ) {
|
||||
throwParamNotNull(jenv);
|
||||
return;
|
||||
|
@ -829,7 +865,7 @@ JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transactio
|
|||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transaction_1getCommittedVersion(JNIEnv *jenv, jobject, jlong tPtr) {
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_foundationdb_FDBTransaction_Transaction_1getCommittedVersion(JNIEnv *jenv, jobject, jlong tPtr) {
|
||||
if( !tPtr ) {
|
||||
throwParamNotNull(jenv);
|
||||
return 0;
|
||||
|
@ -844,7 +880,7 @@ JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transacti
|
|||
return (jlong)version;
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transaction_1getVersionstamp(JNIEnv *jenv, jobject, jlong tPtr) {
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_foundationdb_FDBTransaction_Transaction_1getVersionstamp(JNIEnv *jenv, jobject, jlong tPtr) {
|
||||
if (!tPtr) {
|
||||
throwParamNotNull(jenv);
|
||||
return 0;
|
||||
|
@ -854,7 +890,7 @@ JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transacti
|
|||
return (jlong)f;
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transaction_1getKeyLocations(JNIEnv *jenv, jobject, jlong tPtr, jbyteArray key) {
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_foundationdb_FDBTransaction_Transaction_1getKeyLocations(JNIEnv *jenv, jobject, jlong tPtr, jbyteArray key) {
|
||||
if( !tPtr || !key ) {
|
||||
throwParamNotNull(jenv);
|
||||
return 0;
|
||||
|
@ -875,7 +911,7 @@ JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transacti
|
|||
return (jlong)f;
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transaction_1onError(JNIEnv *jenv, jobject, jlong tPtr, jint errorCode) {
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_foundationdb_FDBTransaction_Transaction_1onError(JNIEnv *jenv, jobject, jlong tPtr, jint errorCode) {
|
||||
if( !tPtr ) {
|
||||
throwParamNotNull(jenv);
|
||||
return 0;
|
||||
|
@ -885,7 +921,7 @@ JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transacti
|
|||
return (jlong)f;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transaction_1dispose(JNIEnv *jenv, jobject, jlong tPtr) {
|
||||
JNIEXPORT void JNICALL Java_com_apple_foundationdb_FDBTransaction_Transaction_1dispose(JNIEnv *jenv, jobject, jlong tPtr) {
|
||||
if( !tPtr ) {
|
||||
throwParamNotNull(jenv);
|
||||
return;
|
||||
|
@ -893,7 +929,7 @@ JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transactio
|
|||
fdb_transaction_destroy( (FDBTransaction *)tPtr );
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transaction_1reset(JNIEnv *jenv, jobject, jlong tPtr) {
|
||||
JNIEXPORT void JNICALL Java_com_apple_foundationdb_FDBTransaction_Transaction_1reset(JNIEnv *jenv, jobject, jlong tPtr) {
|
||||
if( !tPtr ) {
|
||||
throwParamNotNull(jenv);
|
||||
return;
|
||||
|
@ -901,7 +937,7 @@ JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transactio
|
|||
fdb_transaction_reset( (FDBTransaction *)tPtr );
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transaction_1watch(JNIEnv *jenv, jobject, jlong tPtr, jbyteArray key) {
|
||||
JNIEXPORT jlong JNICALL Java_com_apple_foundationdb_FDBTransaction_Transaction_1watch(JNIEnv *jenv, jobject, jlong tPtr, jbyteArray key) {
|
||||
if( !tPtr || !key ) {
|
||||
throwParamNotNull(jenv);
|
||||
return 0;
|
||||
|
@ -921,7 +957,7 @@ JNIEXPORT jlong JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transacti
|
|||
return (jlong)f;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transaction_1cancel(JNIEnv *jenv, jobject, jlong tPtr) {
|
||||
JNIEXPORT void JNICALL Java_com_apple_foundationdb_FDBTransaction_Transaction_1cancel(JNIEnv *jenv, jobject, jlong tPtr) {
|
||||
if( !tPtr ) {
|
||||
throwParamNotNull(jenv);
|
||||
return;
|
||||
|
@ -929,7 +965,7 @@ JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transactio
|
|||
fdb_transaction_cancel( (FDBTransaction *)tPtr );
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transaction_1addConflictRange(
|
||||
JNIEXPORT void JNICALL Java_com_apple_foundationdb_FDBTransaction_Transaction_1addConflictRange(
|
||||
JNIEnv *jenv, jobject, jlong tPtr, jbyteArray keyBegin, jbyteArray keyEnd, jint conflictType) {
|
||||
if( !tPtr || !keyBegin || !keyEnd ) {
|
||||
throwParamNotNull(jenv);
|
||||
|
@ -964,7 +1000,7 @@ JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDBTransaction_Transactio
|
|||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDB_Select_1API_1version(JNIEnv *jenv, jclass, jint version) {
|
||||
JNIEXPORT void JNICALL Java_com_apple_foundationdb_FDB_Select_1API_1version(JNIEnv *jenv, jclass, jint version) {
|
||||
fdb_error_t err = fdb_select_api_version( (int)version );
|
||||
if( err ) {
|
||||
if( err == 2203 ) {
|
||||
|
@ -989,7 +1025,7 @@ JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDB_Select_1API_1version(
|
|||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDB_Network_1setOption(JNIEnv *jenv, jobject, jint code, jbyteArray value) {
|
||||
JNIEXPORT void JNICALL Java_com_apple_foundationdb_FDB_Network_1setOption(JNIEnv *jenv, jobject, jint code, jbyteArray value) {
|
||||
uint8_t *barr = NULL;
|
||||
int size = 0;
|
||||
if(value != 0) {
|
||||
|
@ -1009,14 +1045,14 @@ JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDB_Network_1setOption(JN
|
|||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDB_Network_1setup(JNIEnv *jenv, jobject) {
|
||||
JNIEXPORT void JNICALL Java_com_apple_foundationdb_FDB_Network_1setup(JNIEnv *jenv, jobject) {
|
||||
fdb_error_t err = fdb_setup_network();
|
||||
if( err ) {
|
||||
safeThrow( jenv, getThrowable( jenv, err ) );
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDB_Network_1run(JNIEnv *jenv, jobject) {
|
||||
JNIEXPORT void JNICALL Java_com_apple_foundationdb_FDB_Network_1run(JNIEnv *jenv, jobject) {
|
||||
// initialize things for the callbacks on the network thread
|
||||
g_thread_jenv = jenv;
|
||||
if( !g_IFutureCallback_call_methodID ) {
|
||||
|
@ -1024,19 +1060,29 @@ JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDB_Network_1run(JNIEnv *
|
|||
return;
|
||||
}
|
||||
|
||||
fdb_error_t hookErr = fdb_add_network_thread_completion_hook( &detachIfExternalThread, NULL );
|
||||
if( hookErr ) {
|
||||
safeThrow( jenv, getThrowable( jenv, hookErr ) );
|
||||
}
|
||||
|
||||
fdb_error_t err = fdb_run_network();
|
||||
if( err ) {
|
||||
safeThrow( jenv, getThrowable( jenv, err ) );
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_apple_cie_foundationdb_FDB_Network_1stop(JNIEnv *jenv, jobject) {
|
||||
JNIEXPORT void JNICALL Java_com_apple_foundationdb_FDB_Network_1stop(JNIEnv *jenv, jobject) {
|
||||
fdb_error_t err = fdb_stop_network();
|
||||
if( err ) {
|
||||
safeThrow( jenv, getThrowable( jenv, err ) );
|
||||
}
|
||||
}
|
||||
|
||||
jint JNI_OnLoad(JavaVM *vm, void *reserved) {
|
||||
g_jvm = vm;
|
||||
return JNI_VERSION_1_1;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -58,12 +58,12 @@ if exist "$(OutDir)fdb-java-*.jar" del "$(OutDir)fdb-java-*.jar"</Command>
|
|||
<Command>rmdir /S /Q classes
|
||||
mkdir classes\main
|
||||
mkdir classes\test
|
||||
"C:\Program Files\Java\jdk6\bin\javac.exe" -source 1.6 -target 1.6 -d classes\main src\main\com\apple\cie\foundationdb\*.java src\main\com\apple\cie\foundationdb\async\*.java src\main\com\apple\cie\foundationdb\tuple\*.java src\main\com\apple\cie\foundationdb\directory\*.java src\main\com\apple\cie\foundationdb\subspace\*.java
|
||||
"C:\Program Files\Java\jdk6\bin\javac.exe" -source 1.6 -target 1.6 -cp classes\main -d classes\test src\test\com\apple\cie\foundationdb\test\*.java
|
||||
"C:\Program Files\Java\jdk6\bin\javac.exe" -source 1.6 -target 1.6 -d classes\main src\main\com\apple\foundationdb\*.java src\main\com\apple\foundationdb\async\*.java src\main\com\apple\foundationdb\tuple\*.java src\main\com\apple\foundationdb\directory\*.java src\main\com\apple\foundationdb\subspace\*.java
|
||||
"C:\Program Files\Java\jdk6\bin\javac.exe" -source 1.6 -target 1.6 -cp classes\main -d classes\test src\test\com\apple\foundationdb\test\*.java
|
||||
mkdir classes\main\lib\windows\amd64
|
||||
copy "$(TargetPath)" "classes\main\lib\windows\amd64"
|
||||
"C:\Program Files\Java\jdk6\bin\jar.exe" cf "$(OutDir)fdb-java-$(Version)$(PreReleaseDecoration)-windows-$(Platform).jar" -C classes\main com\apple\cie\foundationdb -C classes\main lib\windows\amd64
|
||||
"C:\Program Files\Java\jdk6\bin\jar.exe" cf "$(OutDir)foundationdb-tests.jar" -C classes\test com\apple\cie\foundationdb
|
||||
"C:\Program Files\Java\jdk6\bin\jar.exe" cf "$(OutDir)fdb-java-$(Version)$(PreReleaseDecoration)-windows-$(Platform).jar" -C classes\main com\apple\foundationdb -C classes\main lib\windows\amd64
|
||||
"C:\Program Files\Java\jdk6\bin\jar.exe" cf "$(OutDir)foundationdb-tests.jar" -C classes\test com\apple\foundationdb
|
||||
FOR /F "tokens=1" %%i in ('hg.exe id') do copy /Y "$(TargetPath)" "$(TargetPath)-%%i"</Command>
|
||||
</PostBuildEvent>
|
||||
<Link>
|
||||
|
@ -121,4 +121,4 @@ FOR /F "tokens=1" %%i in ('hg.exe id') do copy /Y "$(TargetPath)" "$(TargetPath)
|
|||
<Message Text="Cleaning old jar and dll files" Importance="high" />
|
||||
<Delete Files="@(FilesToDelete)" />
|
||||
</Target>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -40,22 +40,22 @@ endif
|
|||
|
||||
define add_java_binding_targets
|
||||
|
||||
JAVA$(1)_GENERATED_SOURCES := bindings/java/src$(1)/main/com/apple/apple/foundationdbdb/NetworkOptions.java bindings/java/src$(1)/main/com/apple/apple/foundationdbdb/ClusterOptions.java bindings/java/src$(1)/main/com/apple/apple/foundationdbdb/DatabaseOptions.java bindings/java/src$(1)/main/com/apple/apple/foundationdbdb/TransactionOptions.java bindings/java/src$(1)/main/com/apple/apple/foundationdbdb/StreamingMode.java bindings/java/src$(1)/main/com/apple/apple/foundationdbdb/ConflictRangeType.java bindings/java/src$(1)/main/com/apple/apple/foundationdbdb/MutationType.java bindings/java/src$(1)/main/com/apple/apple/foundationdbdb/FDBException.java
|
||||
JAVA$(1)_GENERATED_SOURCES := bindings/java/src$(1)/main/com/apple/foundationdb/NetworkOptions.java bindings/java/src$(1)/main/com/apple/foundationdb/ClusterOptions.java bindings/java/src$(1)/main/com/apple/foundationdb/DatabaseOptions.java bindings/java/src$(1)/main/com/apple/foundationdb/TransactionOptions.java bindings/java/src$(1)/main/com/apple/foundationdb/StreamingMode.java bindings/java/src$(1)/main/com/apple/foundationdb/ConflictRangeType.java bindings/java/src$(1)/main/com/apple/foundationdb/MutationType.java bindings/java/src$(1)/main/com/apple/foundationdb/FDBException.java
|
||||
|
||||
JAVA$(1)_SOURCES := $$(JAVA$(1)_GENERATED_SOURCES) bindings/java/src$(1)/main/com/apple/apple/foundationdbdb/*.java bindings/java/src$(1)/main/com/apple/apple/foundationdbdb/async/*.java bindings/java/src$(1)/main/com/apple/apple/foundationdbdb/tuple/*.java bindings/java/src$(1)/main/com/apple/apple/foundationdbdb/directory/*.java bindings/java/src$(1)/main/com/apple/apple/foundationdbdb/subspace/*.java bindings/java/src$(1)/test/com/apple/apple/foundationdbdb/test/*.java
|
||||
JAVA$(1)_SOURCES := $$(JAVA$(1)_GENERATED_SOURCES) bindings/java/src$(1)/main/com/apple/foundationdb/*.java bindings/java/src$(1)/main/com/apple/foundationdb/async/*.java bindings/java/src$(1)/main/com/apple/foundationdb/tuple/*.java bindings/java/src$(1)/main/com/apple/foundationdb/directory/*.java bindings/java/src$(1)/main/com/apple/foundationdb/subspace/*.java bindings/java/src$(1)/test/com/apple/foundationdb/test/*.java
|
||||
|
||||
fdb_java$(1): bindings/java/foundationdb-client$(1).jar bindings/java/foundationdb-tests$(1).jar
|
||||
|
||||
bindings/java/foundationdb-tests$(1).jar: bindings/java/.classstamp$(1)
|
||||
@echo "Building $$@"
|
||||
@jar cf $$@ -C bindings/java/classes$(1)/test com/apple/apple/foundationdbdb
|
||||
@jar cf $$@ -C bindings/java/classes$(1)/test com/apple/foundationdb
|
||||
|
||||
bindings/java/foundationdb-client$(1).jar: bindings/java/.classstamp$(1) lib/libfdb_java.$(DLEXT)
|
||||
@echo "Building $$@"
|
||||
@rm -rf bindings/java/classes$(1)/main/lib/$$(PLATFORM)/$$(java_ARCH)
|
||||
@mkdir -p bindings/java/classes$(1)/main/lib/$$(PLATFORM)/$$(java_ARCH)
|
||||
@cp lib/libfdb_java.$$(DLEXT) bindings/java/classes$(1)/main/lib/$$(PLATFORM)/$$(java_ARCH)/libfdb_java.$$(java_DLEXT)
|
||||
@jar cf $$@ -C bindings/java/classes$(1)/main com/apple/apple/foundationdbdb -C bindings/java/classes$(1)/main lib
|
||||
@jar cf $$@ -C bindings/java/classes$(1)/main com/apple/foundationdb -C bindings/java/classes$(1)/main lib
|
||||
|
||||
fdb_java$(1)_jar_clean:
|
||||
@rm -rf $$(JAVA$(1)_GENERATED_SOURCES)
|
||||
|
@ -65,20 +65,20 @@ define add_java_binding_targets
|
|||
# Redefinition of a target already defined in generated.mk, but it's "okay" and the way things were done before.
|
||||
fdb_java_clean: fdb_java$(1)_jar_clean
|
||||
|
||||
bindings/java/src$(1)/main/com/apple/apple/foundationdbdb/StreamingMode.java: bin/vexillographer.exe fdbclient/vexillographer/fdb.options
|
||||
bindings/java/src$(1)/main/com/apple/foundationdb/StreamingMode.java: bin/vexillographer.exe fdbclient/vexillographer/fdb.options
|
||||
@echo "Building Java options"
|
||||
@$$(MONO) bin/vexillographer.exe fdbclient/vexillographer/fdb.options java $$(@D)
|
||||
|
||||
bindings/java/src$(1)/main/com/apple/apple/foundationdbdb/MutationType.java: bindings/java/src$(1)/main/com/apple/apple/foundationdbdb/StreamingMode.java
|
||||
bindings/java/src$(1)/main/com/apple/foundationdb/MutationType.java: bindings/java/src$(1)/main/com/apple/foundationdb/StreamingMode.java
|
||||
@true
|
||||
|
||||
bindings/java/src$(1)/main/com/apple/apple/foundationdbdb/ConflictRangeType.java: bindings/java/src$(1)/main/com/apple/apple/foundationdbdb/StreamingMode.java
|
||||
bindings/java/src$(1)/main/com/apple/foundationdb/ConflictRangeType.java: bindings/java/src$(1)/main/com/apple/foundationdb/StreamingMode.java
|
||||
@true
|
||||
|
||||
bindings/java/src$(1)/main/com/apple/apple/foundationdbdb/FDBException.java: bindings/java/src$(1)/main/com/apple/apple/foundationdbdb/StreamingMode.java
|
||||
bindings/java/src$(1)/main/com/apple/foundationdb/FDBException.java: bindings/java/src$(1)/main/com/apple/foundationdb/StreamingMode.java
|
||||
@true
|
||||
|
||||
bindings/java/src$(1)/main/com/apple/apple/foundationdbdb/%Options.java: bindings/java/src$(1)/main/com/apple/apple/foundationdbdb/StreamingMode.java
|
||||
bindings/java/src$(1)/main/com/apple/foundationdb/%Options.java: bindings/java/src$(1)/main/com/apple/foundationdb/StreamingMode.java
|
||||
@true
|
||||
|
||||
bindings/java/src$(1)/main/overview.html: bindings/java/src$(1)/main/overview.html.in $$(ALL_MAKEFILES) versions.target
|
||||
|
@ -89,8 +89,8 @@ define add_java_binding_targets
|
|||
@rm -rf bindings/java/classes$(1)
|
||||
@mkdir -p bindings/java/classes$(1)/main
|
||||
@mkdir -p bindings/java/classes$(1)/test
|
||||
@$$(JAVAC) $$(JAVA$(1)FLAGS) -d bindings/java/classes$(1)/main bindings/java/src$(1)/main/com/apple/apple/foundationdbdb/*.java bindings/java/src$(1)/main/com/apple/apple/foundationdbdb/async/*.java bindings/java/src$(1)/main/com/apple/apple/foundationdbdb/tuple/*.java bindings/java/src$(1)/main/com/apple/apple/foundationdbdb/directory/*.java bindings/java/src$(1)/main/com/apple/apple/foundationdbdb/subspace/*.java
|
||||
@$$(JAVAC) $$(JAVA$(1)FLAGS) -cp bindings/java/classes$(1)/main -d bindings/java/classes$(1)/test bindings/java/src$(1)/test/com/apple/apple/foundationdbdb/test/*.java
|
||||
@$$(JAVAC) $$(JAVA$(1)FLAGS) -d bindings/java/classes$(1)/main bindings/java/src$(1)/main/com/apple/foundationdb/*.java bindings/java/src$(1)/main/com/apple/foundationdb/async/*.java bindings/java/src$(1)/main/com/apple/foundationdb/tuple/*.java bindings/java/src$(1)/main/com/apple/foundationdb/directory/*.java bindings/java/src$(1)/main/com/apple/foundationdb/subspace/*.java
|
||||
@$$(JAVAC) $$(JAVA$(1)FLAGS) -cp bindings/java/classes$(1)/main -d bindings/java/classes$(1)/test bindings/java/src$(1)/test/com/apple/foundationdb/test/*.java
|
||||
@echo timestamp > bindings/java/.classstamp$(1)
|
||||
|
||||
javadoc$(1): $$(JAVA$(1)_SOURCES) bindings/java/src$(1)/main/overview.html
|
||||
|
@ -101,7 +101,7 @@ define add_java_binding_targets
|
|||
-windowtitle "FoundationDB Java Client API" \
|
||||
-doctitle "FoundationDB Java Client API" \
|
||||
-link "http://docs.oracle.com/javase/8/docs/api" \
|
||||
com.apple.cie.foundationdb.org.apple.cie.foundationdb.async com.apple.cie.foundationdb.tuple com.apple.cie.foundationdb.directory com.apple.cie.foundationdb.subspace
|
||||
com.apple.foundationdb.org.apple.foundationdb.async com.apple.foundationdb.tuple com.apple.foundationdb.directory com.apple.foundationdb.subspace
|
||||
|
||||
javadoc$(1)_clean:
|
||||
@rm -rf $$(JAVADOC_DIR)/javadoc$(1)
|
||||
|
@ -152,7 +152,7 @@ define add_java_binding_targets
|
|||
packages/fdb-java$(1)-$$(JARVER)-sources.jar: $$(JAVA$(1)_GENERATED_SOURCES) versions.target
|
||||
@echo "Building $$@"
|
||||
@rm -f $$@
|
||||
@jar cf $(TOPDIR)/$$@ -C bindings/java/src$(1)/main com/apple/apple/foundationdbdb
|
||||
@jar cf $(TOPDIR)/$$@ -C bindings/java/src$(1)/main com/apple/foundationdb
|
||||
|
||||
packages/fdb-java$(1)-$$(JARVER)-javadoc.jar: javadoc$(1) versions.target
|
||||
@echo "Building $$@"
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.tuple;
|
||||
package com.apple.foundationdb.tuple;
|
||||
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Suite;
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.tuple;
|
||||
package com.apple.foundationdb.tuple;
|
||||
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
@ -29,7 +29,7 @@ import static org.junit.Assert.fail;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.apple.cie.foundationdb.tuple.ByteArrayUtil;
|
||||
import com.apple.foundationdb.tuple.ByteArrayUtil;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.concurrent.Executor;
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
/**
|
||||
* A FoundationDB object with native resources that can be freed. It is not mandatory to call
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
@ -34,7 +34,7 @@ import java.util.concurrent.ThreadFactory;
|
|||
* This call is required before using any other part of the API. The call allows
|
||||
* an error to be thrown at this point to prevent client code from accessing a later library
|
||||
* with incorrect assumptions from the current version. The API version documented here is version
|
||||
* {@code 500}.<br><br>
|
||||
* {@code 510}.<br><br>
|
||||
* FoundationDB encapsulates multiple versions of its interface by requiring
|
||||
* the client to explicitly specify the version of the API it uses. The purpose
|
||||
* of this design is to allow you to upgrade the server, client libraries, or
|
||||
|
@ -157,15 +157,15 @@ public class FDB {
|
|||
}
|
||||
if(version < 500)
|
||||
throw new IllegalArgumentException("API version not supported (minimum 500)");
|
||||
if(version > 500)
|
||||
throw new IllegalArgumentException("API version not supported (maximum 500)");
|
||||
if(version > 510)
|
||||
throw new IllegalArgumentException("API version not supported (maximum 510)");
|
||||
Select_API_version(version);
|
||||
return singleton = new FDB(version);
|
||||
}
|
||||
|
||||
/**
|
||||
* Connects to the cluster specified by the
|
||||
* <a href="https://foundationdb.com/documentation/api-general.html#default-cluster-file" target="_blank">default fdb.cluster file</a>.
|
||||
* <a href="https://foundationdb.org/documentation/api-general.html#default-cluster-file" target="_blank">default fdb.cluster file</a>.
|
||||
* 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.
|
||||
*
|
||||
|
@ -230,7 +230,7 @@ public class FDB {
|
|||
|
||||
/**
|
||||
* Initializes networking, connects with the
|
||||
* <a href="https://foundationdb.com/documentation/api-general.html#default-cluster-file" target="_blank">default fdb.cluster file</a>,
|
||||
* <a href="https://foundationdb.org/documentation/api-general.html#default-cluster-file" target="_blank">default fdb.cluster file</a>,
|
||||
* and opens the database.
|
||||
*
|
||||
* @return a {@code CompletableFuture} that will be set to a FoundationDB {@link Database}
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CompletionException;
|
||||
|
@ -28,7 +28,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
|||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.apple.cie.foundationdb.async.AsyncUtil;
|
||||
import com.apple.foundationdb.async.AsyncUtil;
|
||||
|
||||
class FDBDatabase extends DefaultDisposableImpl implements Database, Disposable, OptionConsumer {
|
||||
private DatabaseOptions options;
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CompletionException;
|
||||
|
@ -26,8 +26,8 @@ import java.util.concurrent.ExecutionException;
|
|||
import java.util.concurrent.Executor;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.apple.cie.foundationdb.async.*;
|
||||
import com.apple.cie.foundationdb.tuple.ByteArrayUtil;
|
||||
import com.apple.foundationdb.async.*;
|
||||
import com.apple.foundationdb.tuple.ByteArrayUtil;
|
||||
|
||||
class FDBTransaction extends DefaultDisposableImpl implements Disposable, Transaction, OptionConsumer {
|
||||
private final Database database;
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
|
@ -18,9 +18,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
import com.apple.cie.foundationdb.tuple.ByteArrayUtil;
|
||||
import com.apple.foundationdb.tuple.ByteArrayUtil;
|
||||
|
||||
/**
|
||||
* A {@code KeySelector} identifies a particular key in the database. FoundationDB's
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Arrays;
|
||||
|
@ -27,10 +27,10 @@ import java.util.concurrent.CompletableFuture;
|
|||
import java.util.concurrent.CompletionException;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import com.apple.cie.foundationdb.async.AsyncIterable;
|
||||
import com.apple.cie.foundationdb.async.AsyncIterator;
|
||||
import com.apple.cie.foundationdb.async.AsyncUtil;
|
||||
import com.apple.cie.foundationdb.tuple.ByteArrayUtil;
|
||||
import com.apple.foundationdb.async.AsyncIterable;
|
||||
import com.apple.foundationdb.async.AsyncIterator;
|
||||
import com.apple.foundationdb.async.AsyncUtil;
|
||||
import com.apple.foundationdb.tuple.ByteArrayUtil;
|
||||
|
||||
/**
|
||||
* The FoundationDB API comes with a set of functions for discovering the
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
/**
|
||||
* An object on which encoded options can be set. Rarely used outside of
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
|
@ -18,11 +18,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.apple.cie.foundationdb.tuple.ByteArrayUtil;
|
||||
import com.apple.foundationdb.tuple.ByteArrayUtil;
|
||||
|
||||
/**
|
||||
* A simple description of an exact range of keyspace, specified by a begin and end key. As with
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
|
@ -27,9 +27,9 @@ import java.util.concurrent.CompletableFuture;
|
|||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.apple.cie.foundationdb.async.AsyncIterable;
|
||||
import com.apple.cie.foundationdb.async.AsyncIterator;
|
||||
import com.apple.cie.foundationdb.async.AsyncUtil;
|
||||
import com.apple.foundationdb.async.AsyncIterable;
|
||||
import com.apple.foundationdb.async.AsyncIterator;
|
||||
import com.apple.foundationdb.async.AsyncUtil;
|
||||
|
||||
/**
|
||||
* Represents a query against FoundationDB for a range of keys. The
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
class RangeResultInfo {
|
||||
RangeResultSummary getSummary() {
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
class RangeResultSummary {
|
||||
final byte[] lastKey;
|
|
@ -18,13 +18,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import com.apple.cie.foundationdb.async.AsyncIterable;
|
||||
import com.apple.cie.foundationdb.async.AsyncIterator;
|
||||
import com.apple.cie.foundationdb.tuple.Tuple;
|
||||
import com.apple.foundationdb.async.AsyncIterable;
|
||||
import com.apple.foundationdb.async.AsyncIterator;
|
||||
import com.apple.foundationdb.tuple.Tuple;
|
||||
|
||||
/**
|
||||
* A read-only subset of a FoundationDB {@link Transaction}. This is the interface that
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
|
@ -18,11 +18,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Function;
|
||||
import com.apple.cie.foundationdb.tuple.Tuple;
|
||||
import com.apple.foundationdb.tuple.Tuple;
|
||||
|
||||
/**
|
||||
* A Transaction represents a FoundationDB database transaction. All operations on FoundationDB
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Function;
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.async;
|
||||
package com.apple.foundationdb.async;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
|
@ -18,13 +18,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.async;
|
||||
package com.apple.foundationdb.async;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import com.apple.cie.foundationdb.Disposable;
|
||||
import com.apple.foundationdb.Disposable;
|
||||
|
||||
/**
|
||||
* A version of {@code Iterator} that allows for non-blocking iteration over elements.
|
|
@ -18,11 +18,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.async;
|
||||
package com.apple.foundationdb.async;
|
||||
|
||||
import static com.apple.cie.foundationdb.FDB.DEFAULT_EXECUTOR;
|
||||
import static com.apple.foundationdb.FDB.DEFAULT_EXECUTOR;
|
||||
|
||||
import com.apple.cie.foundationdb.FDBException;
|
||||
import com.apple.foundationdb.FDBException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.async;
|
||||
package com.apple.foundationdb.async;
|
||||
|
||||
/**
|
||||
* Describes an operation or signal that can be cancelled. Cancellation will be assumed
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.async;
|
||||
package com.apple.foundationdb.async;
|
||||
|
||||
/**
|
||||
* An {@link Exception} that can be duplicated with a new backtrace.
|
|
@ -22,4 +22,4 @@
|
|||
* Provides additional constructs for asynchronous programming against Java's {@link java.util.concurrent.CompletableFuture CompletableFuture}s.
|
||||
*
|
||||
*/
|
||||
package com.apple.cie.foundationdb.async;
|
||||
package com.apple.foundationdb.async;
|
|
@ -18,16 +18,16 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.directory;
|
||||
package com.apple.foundationdb.directory;
|
||||
|
||||
import static com.apple.cie.foundationdb.directory.DirectoryLayer.EMPTY_BYTES;
|
||||
import static com.apple.cie.foundationdb.directory.DirectoryLayer.EMPTY_PATH;
|
||||
import static com.apple.foundationdb.directory.DirectoryLayer.EMPTY_BYTES;
|
||||
import static com.apple.foundationdb.directory.DirectoryLayer.EMPTY_PATH;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import com.apple.cie.foundationdb.ReadTransactionContext;
|
||||
import com.apple.cie.foundationdb.TransactionContext;
|
||||
import com.apple.foundationdb.ReadTransactionContext;
|
||||
import com.apple.foundationdb.TransactionContext;
|
||||
|
||||
/**
|
||||
* Represents a directory in the {@code DirectoryLayer}. A {@code Directory} stores the path
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.directory;
|
||||
package com.apple.foundationdb.directory;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.directory;
|
||||
package com.apple.foundationdb.directory;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.directory;
|
||||
package com.apple.foundationdb.directory;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
@ -31,19 +31,19 @@ import java.util.Random;
|
|||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.apple.cie.foundationdb.KeyValue;
|
||||
import com.apple.cie.foundationdb.MutationType;
|
||||
import com.apple.cie.foundationdb.Range;
|
||||
import com.apple.cie.foundationdb.ReadTransaction;
|
||||
import com.apple.cie.foundationdb.ReadTransactionContext;
|
||||
import com.apple.cie.foundationdb.Transaction;
|
||||
import com.apple.cie.foundationdb.TransactionContext;
|
||||
import com.apple.cie.foundationdb.async.AsyncIterable;
|
||||
import com.apple.cie.foundationdb.async.AsyncIterator;
|
||||
import com.apple.cie.foundationdb.async.AsyncUtil;
|
||||
import com.apple.cie.foundationdb.subspace.Subspace;
|
||||
import com.apple.cie.foundationdb.tuple.ByteArrayUtil;
|
||||
import com.apple.cie.foundationdb.tuple.Tuple;
|
||||
import com.apple.foundationdb.KeyValue;
|
||||
import com.apple.foundationdb.MutationType;
|
||||
import com.apple.foundationdb.Range;
|
||||
import com.apple.foundationdb.ReadTransaction;
|
||||
import com.apple.foundationdb.ReadTransactionContext;
|
||||
import com.apple.foundationdb.Transaction;
|
||||
import com.apple.foundationdb.TransactionContext;
|
||||
import com.apple.foundationdb.async.AsyncIterable;
|
||||
import com.apple.foundationdb.async.AsyncIterator;
|
||||
import com.apple.foundationdb.async.AsyncUtil;
|
||||
import com.apple.foundationdb.subspace.Subspace;
|
||||
import com.apple.foundationdb.tuple.ByteArrayUtil;
|
||||
import com.apple.foundationdb.tuple.Tuple;
|
||||
|
||||
/**
|
||||
* Provides a class for managing directories in FoundationDB.
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.directory;
|
||||
package com.apple.foundationdb.directory;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -18,16 +18,16 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.directory;
|
||||
package com.apple.foundationdb.directory;
|
||||
|
||||
import static com.apple.cie.foundationdb.directory.DirectoryLayer.DEFAULT_NODE_SUBSPACE_PREFIX;
|
||||
import static com.apple.foundationdb.directory.DirectoryLayer.DEFAULT_NODE_SUBSPACE_PREFIX;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.apple.cie.foundationdb.subspace.Subspace;
|
||||
import com.apple.cie.foundationdb.Range;
|
||||
import com.apple.cie.foundationdb.tuple.ByteArrayUtil;
|
||||
import com.apple.cie.foundationdb.tuple.Tuple;
|
||||
import com.apple.foundationdb.subspace.Subspace;
|
||||
import com.apple.foundationdb.Range;
|
||||
import com.apple.foundationdb.tuple.ByteArrayUtil;
|
||||
import com.apple.foundationdb.tuple.Tuple;
|
||||
|
||||
/**
|
||||
* A {@code DirectoryPartition} is a {@link DirectorySubspace} whose prefix is prepended to all of its descendant directories' prefixes.
|
|
@ -18,20 +18,20 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.directory;
|
||||
package com.apple.foundationdb.directory;
|
||||
|
||||
import static com.apple.cie.foundationdb.directory.DirectoryLayer.EMPTY_BYTES;
|
||||
import static com.apple.cie.foundationdb.directory.DirectoryLayer.EMPTY_PATH;
|
||||
import static com.apple.cie.foundationdb.tuple.ByteArrayUtil.printable;
|
||||
import static com.apple.foundationdb.directory.DirectoryLayer.EMPTY_BYTES;
|
||||
import static com.apple.foundationdb.directory.DirectoryLayer.EMPTY_PATH;
|
||||
import static com.apple.foundationdb.tuple.ByteArrayUtil.printable;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import com.apple.cie.foundationdb.ReadTransactionContext;
|
||||
import com.apple.cie.foundationdb.TransactionContext;
|
||||
import com.apple.cie.foundationdb.subspace.Subspace;
|
||||
import com.apple.foundationdb.ReadTransactionContext;
|
||||
import com.apple.foundationdb.TransactionContext;
|
||||
import com.apple.foundationdb.subspace.Subspace;
|
||||
|
||||
/**
|
||||
* A DirectorySubspace represents the <i>contents</i> of a directory, but it
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.directory;
|
||||
package com.apple.foundationdb.directory;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.directory;
|
||||
package com.apple.foundationdb.directory;
|
||||
|
||||
/**
|
||||
* An {@link Exception} that is thrown when the version of the directory layer
|
|
@ -18,9 +18,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.directory;
|
||||
package com.apple.foundationdb.directory;
|
||||
|
||||
import com.apple.cie.foundationdb.tuple.ByteArrayUtil;
|
||||
import com.apple.foundationdb.tuple.ByteArrayUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.directory;
|
||||
package com.apple.foundationdb.directory;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.directory;
|
||||
package com.apple.foundationdb.directory;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
|
@ -35,4 +35,4 @@
|
|||
* directory documentation</a> for information about how directories work and
|
||||
* interact with other parts of the built-in keyspace management features.
|
||||
*/
|
||||
package com.apple.cie.foundationdb.directory;
|
||||
package com.apple.foundationdb.directory;
|
|
@ -20,16 +20,16 @@
|
|||
|
||||
/**
|
||||
* Provides an API for the FoundationDB transactional key/value store. Clients operating
|
||||
* on a {@link com.apple.cie.foundationdb.Database} should, in most cases, use the
|
||||
* {@link com.apple.cie.foundationdb.TransactionContext#run(Function) run(Function)}
|
||||
* on a {@link com.apple.foundationdb.Database} should, in most cases, use the
|
||||
* {@link com.apple.foundationdb.TransactionContext#run(Function) run(Function)}
|
||||
* or the
|
||||
* {@link com.apple.cie.foundationdb.TransactionContext#runAsync(Function) runAsync(Function)}
|
||||
* {@link com.apple.foundationdb.TransactionContext#runAsync(Function) runAsync(Function)}
|
||||
* constructs. These two functions (and their two derivations) implement a proper
|
||||
* retry loop around the work that needs to get done and, in the case of {@code Database},
|
||||
* assure that {@link com.apple.cie.foundationdb.Transaction#commit()} has returned successfully
|
||||
* assure that {@link com.apple.foundationdb.Transaction#commit()} has returned successfully
|
||||
* before itself returning. If you are not able to use these functions for some reason
|
||||
* please closely read and understand the other
|
||||
* <a href="/documentation/data-modeling.html#tuples">developer
|
||||
* documentation on FoundationDB transactions</a>.
|
||||
*/
|
||||
package com.apple.cie.foundationdb;
|
||||
package com.apple.foundationdb;
|
|
@ -18,16 +18,16 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.subspace;
|
||||
package com.apple.foundationdb.subspace;
|
||||
|
||||
import static com.apple.cie.foundationdb.tuple.ByteArrayUtil.join;
|
||||
import static com.apple.cie.foundationdb.tuple.ByteArrayUtil.printable;
|
||||
import static com.apple.foundationdb.tuple.ByteArrayUtil.join;
|
||||
import static com.apple.foundationdb.tuple.ByteArrayUtil.printable;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.apple.cie.foundationdb.Range;
|
||||
import com.apple.cie.foundationdb.tuple.ByteArrayUtil;
|
||||
import com.apple.cie.foundationdb.tuple.Tuple;
|
||||
import com.apple.foundationdb.Range;
|
||||
import com.apple.foundationdb.tuple.ByteArrayUtil;
|
||||
import com.apple.foundationdb.tuple.Tuple;
|
||||
|
||||
/**
|
||||
* {@code Subspace} provide a convenient way to use {@link Tuple}s to define namespaces for
|
||||
|
@ -110,6 +110,9 @@ public class Subspace
|
|||
}
|
||||
|
||||
/**
|
||||
* Create a human-readable string representation of this subspace. This is
|
||||
* really only useful for debugging purposes, but it includes information
|
||||
* on what raw prefix the subspace is using.
|
||||
* @return a printable representation of the subspace
|
||||
*/
|
||||
@Override
|
||||
|
@ -117,6 +120,16 @@ public class Subspace
|
|||
return "Subspace(rawPrefix=" + printable(rawPrefix) + ")";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a hash-table compatible hash of this subspace. This is based off
|
||||
* of the hash of the underlying byte-array prefix.
|
||||
* @return a hash of this subspace
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Arrays.hashCode(rawPrefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a new subspace which is equivalent to this subspace with its prefix {@link Tuple} extended by
|
||||
* the specified {@code Object}. The object will be inserted into a {@link Tuple} and passed to {@link #get(Tuple)}.
|
|
@ -30,4 +30,4 @@
|
|||
* subspace documentation</a> for information about how subspaces work and
|
||||
* interact with other parts of the built-in keyspace management features.
|
||||
*/
|
||||
package com.apple.cie.foundationdb.subspace;
|
||||
package com.apple.foundationdb.subspace;
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.tuple;
|
||||
package com.apple.foundationdb.tuple;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.nio.ByteBuffer;
|
||||
|
@ -27,7 +27,7 @@ import java.util.Arrays;
|
|||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import com.apple.cie.foundationdb.Transaction;
|
||||
import com.apple.foundationdb.Transaction;
|
||||
|
||||
/**
|
||||
* Utility functions for operating on byte arrays. Although built for
|
||||
|
@ -368,12 +368,12 @@ public class ByteArrayUtil {
|
|||
/**
|
||||
* Encode an 64-bit integer (long) into a byte array. Encodes the integer in little
|
||||
* endian byte order. The result is valid for use with
|
||||
* {@link Transaction#mutate(com.apple.cie.foundationdb.MutationType, byte[], byte[]) Transaction.mutate(...)}.
|
||||
* {@link Transaction#mutate(com.apple.foundationdb.MutationType, byte[], byte[]) Transaction.mutate(...)}.
|
||||
*
|
||||
* @param i the number to encode
|
||||
* @return an 8-byte array containing the
|
||||
*
|
||||
* @see Transaction#mutate(com.apple.cie.foundationdb.MutationType, byte[], byte[])
|
||||
* @see Transaction#mutate(com.apple.foundationdb.MutationType, byte[], byte[])
|
||||
*/
|
||||
public static byte[] encodeInt(long i) {
|
||||
return ByteBuffer.allocate(8).order(ByteOrder.LITTLE_ENDIAN).putLong(i).array();
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.tuple;
|
||||
package com.apple.foundationdb.tuple;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.tuple;
|
||||
package com.apple.foundationdb.tuple;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
|
@ -32,7 +32,7 @@ import java.util.UUID;
|
|||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.apple.cie.foundationdb.Range;
|
||||
import com.apple.foundationdb.Range;
|
||||
|
||||
/**
|
||||
* Represents a set of elements that make up a sortable, typed key. This object
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.tuple;
|
||||
package com.apple.foundationdb.tuple;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.nio.ByteBuffer;
|
|
@ -20,10 +20,10 @@
|
|||
|
||||
/**
|
||||
* Provides a set of utilities for serializing and deserializing typed data
|
||||
* for use in FoundationDB. When packed together into a {@link com.apple.cie.foundationdb.tuple.Tuple}
|
||||
* for use in FoundationDB. When packed together into a {@link com.apple.foundationdb.tuple.Tuple}
|
||||
* this data is suitable for use as an index or organizational structure within FoundationDB
|
||||
* keyspace. See <a href="/documentation/data-modeling.html#tuples">general Tuple
|
||||
* documentation</a> for information about how Tuples sort and can be used to efficiently
|
||||
* model data.
|
||||
*/
|
||||
package com.apple.cie.foundationdb.tuple;
|
||||
package com.apple.foundationdb.tuple;
|
|
@ -24,24 +24,24 @@ and add it to your classpath.<br>
|
|||
<br>
|
||||
<h3>Getting started</h3>
|
||||
To start using FoundationDB from Java, create an instance of the
|
||||
{@link com.apple.cie.foundationdb.FDB FoundationDB API interface} with the version of the
|
||||
API that you want to use (this release of the FoundationDB Java API supports only version {@code 500}).
|
||||
With this API object you can then open {@link com.apple.cie.foundationdb.Cluster Cluster}s and
|
||||
{@link com.apple.cie.foundationdb.Database Database}s and start using
|
||||
{@link com.apple.cie.foundationdb.Transaction Transactions}s.
|
||||
{@link com.apple.foundationdb.FDB FoundationDB API interface} with the version of the
|
||||
API that you want to use (this release of the FoundationDB Java API supports versions between {@code 500} and {@code 510}).
|
||||
With this API object you can then open {@link com.apple.foundationdb.Cluster Cluster}s and
|
||||
{@link com.apple.foundationdb.Database Database}s and start using
|
||||
{@link com.apple.foundationdb.Transaction Transactions}s.
|
||||
Here we give an example. The example relies on a cluster file at the
|
||||
<a href="/documentation/api-general.html#default-cluster-file">default location</a>
|
||||
for your platform and a running server.<br>
|
||||
<br>
|
||||
<pre>
|
||||
{@code
|
||||
import com.apple.cie.foundationdb.*;
|
||||
import com.apple.foundationdb.*;
|
||||
import Function;
|
||||
import Tuple;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
FDB fdb = FDB.selectAPIVersion(500);
|
||||
FDB fdb = FDB.selectAPIVersion(510);
|
||||
Database db = fdb.open();
|
||||
|
||||
// Run an operation on the database
|
||||
|
@ -64,21 +64,21 @@ public class Example {
|
|||
}
|
||||
}
|
||||
</pre>
|
||||
<h3>FoundationDB {@link com.apple.cie.foundationdb.tuple Tuple API}</h3>
|
||||
The {@link com.apple.cie.foundationdb.tuple Tuple API} is provided with the core Java API for FoundationDB.
|
||||
<h3>FoundationDB {@link com.apple.foundationdb.tuple Tuple API}</h3>
|
||||
The {@link com.apple.foundationdb.tuple Tuple API} is provided with the core Java API for FoundationDB.
|
||||
This layer is provided in some form in all official language bindings. It enables
|
||||
cross-language support for storing and retrieving typed data from the
|
||||
binary data that FoundationDB supports. And, just as importantly, data packed into
|
||||
{@code Tuple}s and used as keys sort in predictable and useful ways. See the
|
||||
{@link com.apple.cie.foundationdb.tuple Tuple class documentation} for information about use in Java
|
||||
{@link com.apple.foundationdb.tuple Tuple class documentation} for information about use in Java
|
||||
and <a href="/documentation/data-modeling.html#tuples">general Tuple documentation</a>
|
||||
for information about how Tuples sort and can be used to efficiently model data.
|
||||
<br>
|
||||
<h3>FoundationDB {@link com.apple.cie.foundationdb.directory Directory API}</h3>
|
||||
The {@link com.apple.cie.foundationdb.directory Directory API} is provided with the core
|
||||
<h3>FoundationDB {@link com.apple.foundationdb.directory Directory API}</h3>
|
||||
The {@link com.apple.foundationdb.directory Directory API} is provided with the core
|
||||
Java API for FoundationDB. This layer is provided in some form in all official
|
||||
language bindings. The FoundationDB API provides directories as a tool for
|
||||
managing related {@link com.apple.cie.foundationdb.subspace.Subspace Subspace}s. Directories are a
|
||||
managing related {@link com.apple.foundationdb.subspace.Subspace Subspace}s. Directories are a
|
||||
recommended approach for administering applications. Each application should
|
||||
create or open at least one directory to manage its subspaces. Directories are
|
||||
identified by hierarchical paths analogous to the paths in a Unix-like file system.
|
||||
|
|
|
@ -18,16 +18,16 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.test;
|
||||
package com.apple.foundationdb.test;
|
||||
|
||||
import com.apple.cie.foundationdb.Database;
|
||||
import com.apple.cie.foundationdb.FDB;
|
||||
import com.apple.foundationdb.Database;
|
||||
import com.apple.foundationdb.FDB;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class AbstractTester {
|
||||
public static final int API_VERSION = 500;
|
||||
public static final int API_VERSION = 510;
|
||||
protected static final int NUM_RUNS = 25;
|
||||
protected static final Charset ASCII = Charset.forName("ASCII");
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.test;
|
||||
package com.apple.foundationdb.test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -27,15 +27,15 @@ import java.util.List;
|
|||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.apple.cie.foundationdb.Range;
|
||||
import com.apple.cie.foundationdb.Transaction;
|
||||
import com.apple.cie.foundationdb.async.AsyncUtil;
|
||||
import com.apple.cie.foundationdb.directory.Directory;
|
||||
import com.apple.cie.foundationdb.directory.DirectoryLayer;
|
||||
import com.apple.cie.foundationdb.directory.DirectorySubspace;
|
||||
import com.apple.cie.foundationdb.subspace.Subspace;
|
||||
import com.apple.cie.foundationdb.tuple.ByteArrayUtil;
|
||||
import com.apple.cie.foundationdb.tuple.Tuple;
|
||||
import com.apple.foundationdb.Range;
|
||||
import com.apple.foundationdb.Transaction;
|
||||
import com.apple.foundationdb.async.AsyncUtil;
|
||||
import com.apple.foundationdb.directory.Directory;
|
||||
import com.apple.foundationdb.directory.DirectoryLayer;
|
||||
import com.apple.foundationdb.directory.DirectorySubspace;
|
||||
import com.apple.foundationdb.subspace.Subspace;
|
||||
import com.apple.foundationdb.tuple.ByteArrayUtil;
|
||||
import com.apple.foundationdb.tuple.Tuple;
|
||||
|
||||
class AsyncDirectoryExtension {
|
||||
List<Object> dirList = new ArrayList<Object>();
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.test;
|
||||
package com.apple.foundationdb.test;
|
||||
|
||||
public class AsyncPerformanceTester {
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.test;
|
||||
package com.apple.foundationdb.test;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.*;
|
||||
|
@ -28,21 +28,21 @@ import java.nio.ByteOrder;
|
|||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.apple.cie.foundationdb.Cluster;
|
||||
import com.apple.cie.foundationdb.Database;
|
||||
import com.apple.cie.foundationdb.FDB;
|
||||
import com.apple.cie.foundationdb.FDBException;
|
||||
import com.apple.cie.foundationdb.KeySelector;
|
||||
import com.apple.cie.foundationdb.KeyValue;
|
||||
import com.apple.cie.foundationdb.MutationType;
|
||||
import com.apple.cie.foundationdb.Range;
|
||||
import com.apple.cie.foundationdb.ReadTransaction;
|
||||
import com.apple.cie.foundationdb.StreamingMode;
|
||||
import com.apple.cie.foundationdb.Transaction;
|
||||
import com.apple.cie.foundationdb.async.AsyncIterable;
|
||||
import com.apple.cie.foundationdb.async.AsyncUtil;
|
||||
import com.apple.cie.foundationdb.tuple.ByteArrayUtil;
|
||||
import com.apple.cie.foundationdb.tuple.Tuple;
|
||||
import com.apple.foundationdb.Cluster;
|
||||
import com.apple.foundationdb.Database;
|
||||
import com.apple.foundationdb.FDB;
|
||||
import com.apple.foundationdb.FDBException;
|
||||
import com.apple.foundationdb.KeySelector;
|
||||
import com.apple.foundationdb.KeyValue;
|
||||
import com.apple.foundationdb.MutationType;
|
||||
import com.apple.foundationdb.Range;
|
||||
import com.apple.foundationdb.ReadTransaction;
|
||||
import com.apple.foundationdb.StreamingMode;
|
||||
import com.apple.foundationdb.Transaction;
|
||||
import com.apple.foundationdb.async.AsyncIterable;
|
||||
import com.apple.foundationdb.async.AsyncUtil;
|
||||
import com.apple.foundationdb.tuple.ByteArrayUtil;
|
||||
import com.apple.foundationdb.tuple.Tuple;
|
||||
|
||||
public class AsyncStackTester {
|
||||
static final String DIRECTORY_PREFIX = "DIRECTORY_";
|
||||
|
@ -593,6 +593,8 @@ public class AsyncStackTester {
|
|||
tr.options().setMaxRetryDelay(100);
|
||||
tr.options().setUsedDuringCommitProtectionDisable();
|
||||
tr.options().setTransactionLoggingEnable("my_transaction");
|
||||
tr.options().setReadLockAware();
|
||||
tr.options().setLockAware();
|
||||
|
||||
if(!(new FDBException("Fake", 1020)).isRetryable() ||
|
||||
(new FDBException("Fake", 10)).isRetryable())
|
|
@ -18,22 +18,22 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.test;
|
||||
package com.apple.foundationdb.test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.apple.cie.foundationdb.Database;
|
||||
import com.apple.cie.foundationdb.FDB;
|
||||
import com.apple.cie.foundationdb.Transaction;
|
||||
import com.apple.foundationdb.Database;
|
||||
import com.apple.foundationdb.FDB;
|
||||
import com.apple.foundationdb.Transaction;
|
||||
|
||||
public class BlockingBenchmark {
|
||||
private static final int REPS = 100000;
|
||||
private static final int PARALLEL = 100;
|
||||
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
FDB fdb = FDB.selectAPIVersion(500);
|
||||
FDB fdb = FDB.selectAPIVersion(510);
|
||||
|
||||
// The cluster file DOES NOT need to be valid, although it must exist.
|
||||
// This is because the database is never really contacted in this test.
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.test;
|
||||
package com.apple.foundationdb.test;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.security.SecureRandom;
|
||||
|
@ -28,9 +28,9 @@ import java.util.concurrent.Semaphore;
|
|||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.apple.cie.foundationdb.Database;
|
||||
import com.apple.cie.foundationdb.FDB;
|
||||
import com.apple.cie.foundationdb.Transaction;
|
||||
import com.apple.foundationdb.Database;
|
||||
import com.apple.foundationdb.FDB;
|
||||
import com.apple.foundationdb.Transaction;
|
||||
|
||||
public class ConcurrentGetSetGet {
|
||||
public static final Charset UTF8 = Charset.forName("UTF-8");
|
||||
|
@ -51,7 +51,7 @@ public class ConcurrentGetSetGet {
|
|||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Database database = FDB.selectAPIVersion(500).open();
|
||||
Database database = FDB.selectAPIVersion(510).open();
|
||||
new ConcurrentGetSetGet().apply(database);
|
||||
}
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.test;
|
||||
package com.apple.foundationdb.test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
|
@ -29,14 +29,14 @@ import java.util.concurrent.CompletableFuture;
|
|||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.apple.cie.foundationdb.Database;
|
||||
import com.apple.cie.foundationdb.FDBException;
|
||||
import com.apple.cie.foundationdb.KeySelector;
|
||||
import com.apple.cie.foundationdb.Range;
|
||||
import com.apple.cie.foundationdb.StreamingMode;
|
||||
import com.apple.cie.foundationdb.Transaction;
|
||||
import com.apple.cie.foundationdb.tuple.ByteArrayUtil;
|
||||
import com.apple.cie.foundationdb.tuple.Tuple;
|
||||
import com.apple.foundationdb.Database;
|
||||
import com.apple.foundationdb.FDBException;
|
||||
import com.apple.foundationdb.KeySelector;
|
||||
import com.apple.foundationdb.Range;
|
||||
import com.apple.foundationdb.StreamingMode;
|
||||
import com.apple.foundationdb.Transaction;
|
||||
import com.apple.foundationdb.tuple.ByteArrayUtil;
|
||||
import com.apple.foundationdb.tuple.Tuple;
|
||||
|
||||
abstract class Context implements Runnable {
|
||||
final Stack stack = new Stack();
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.test;
|
||||
package com.apple.foundationdb.test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.test;
|
||||
package com.apple.foundationdb.test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -26,13 +26,13 @@ import java.util.List;
|
|||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import com.apple.cie.foundationdb.Range;
|
||||
import com.apple.cie.foundationdb.directory.Directory;
|
||||
import com.apple.cie.foundationdb.directory.DirectoryLayer;
|
||||
import com.apple.cie.foundationdb.directory.DirectorySubspace;
|
||||
import com.apple.cie.foundationdb.subspace.Subspace;
|
||||
import com.apple.cie.foundationdb.tuple.ByteArrayUtil;
|
||||
import com.apple.cie.foundationdb.tuple.Tuple;
|
||||
import com.apple.foundationdb.Range;
|
||||
import com.apple.foundationdb.directory.Directory;
|
||||
import com.apple.foundationdb.directory.DirectoryLayer;
|
||||
import com.apple.foundationdb.directory.DirectorySubspace;
|
||||
import com.apple.foundationdb.subspace.Subspace;
|
||||
import com.apple.foundationdb.tuple.ByteArrayUtil;
|
||||
import com.apple.foundationdb.tuple.Tuple;
|
||||
|
||||
class DirectoryExtension {
|
||||
List<Object> dirList = new ArrayList<Object>();
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.test;
|
||||
package com.apple.foundationdb.test;
|
||||
|
||||
enum DirectoryOperation {
|
||||
DIRECTORY_CREATE_SUBSPACE(true),
|
|
@ -18,7 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.apple.cie.foundationdb.test;
|
||||
package com.apple.foundationdb.test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -26,20 +26,20 @@ import java.util.List;
|
|||
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.apple.cie.foundationdb.Cluster;
|
||||
import com.apple.cie.foundationdb.Database;
|
||||
import com.apple.cie.foundationdb.FDB;
|
||||
import com.apple.cie.foundationdb.Transaction;
|
||||
import com.apple.cie.foundationdb.TransactionContext;
|
||||
import com.apple.cie.foundationdb.directory.DirectoryLayer;
|
||||
import com.apple.cie.foundationdb.directory.DirectorySubspace;
|
||||
import com.apple.foundationdb.Cluster;
|
||||
import com.apple.foundationdb.Database;
|
||||
import com.apple.foundationdb.FDB;
|
||||
import com.apple.foundationdb.Transaction;
|
||||
import com.apple.foundationdb.TransactionContext;
|
||||
import com.apple.foundationdb.directory.DirectoryLayer;
|
||||
import com.apple.foundationdb.directory.DirectorySubspace;
|
||||
|
||||
public class DirectoryTest {
|
||||
private static final String CLUSTER_FILE = "/home/ajb/fdb.cluster";
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
try {
|
||||
Cluster c = FDB.selectAPIVersion(500).createCluster(CLUSTER_FILE);
|
||||
Cluster c = FDB.selectAPIVersion(510).createCluster(CLUSTER_FILE);
|
||||
Database db = c.openDatabase();
|
||||
runTests(db);
|
||||
} catch(Throwable t) {
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue