Merge pull request #3261 from bnamasivayam/api-version-update-700
Api version update 700
This commit is contained in:
commit
23a29abdb4
|
@ -26,7 +26,7 @@ sys.path[:0] = [os.path.join(os.path.dirname(__file__), '..', '..', 'bindings',
|
||||||
|
|
||||||
import util
|
import util
|
||||||
|
|
||||||
FDB_API_VERSION = 630
|
FDB_API_VERSION = 700
|
||||||
|
|
||||||
LOGGING = {
|
LOGGING = {
|
||||||
'version': 1,
|
'version': 1,
|
||||||
|
|
|
@ -157,7 +157,7 @@ def choose_api_version(selected_api_version, tester_min_version, tester_max_vers
|
||||||
api_version = min_version
|
api_version = min_version
|
||||||
elif random.random() < 0.9:
|
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,
|
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, 520, 600, 610, 620, 630] if v >= min_version and v <= max_version])
|
440, 450, 460, 500, 510, 520, 600, 610, 620, 630, 700] if v >= min_version and v <= max_version])
|
||||||
else:
|
else:
|
||||||
api_version = random.randint(min_version, max_version)
|
api_version = random.randint(min_version, max_version)
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
MAX_API_VERSION = 630
|
MAX_API_VERSION = 700
|
||||||
COMMON_TYPES = ['null', 'bytes', 'string', 'int', 'uuid', 'bool', 'float', 'double', 'tuple']
|
COMMON_TYPES = ['null', 'bytes', 'string', 'int', 'uuid', 'bool', 'float', 'double', 'tuple']
|
||||||
ALL_TYPES = COMMON_TYPES + ['versionstamp']
|
ALL_TYPES = COMMON_TYPES + ['versionstamp']
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ fdb.api_version(FDB_API_VERSION)
|
||||||
|
|
||||||
|
|
||||||
class ScriptedTest(Test):
|
class ScriptedTest(Test):
|
||||||
TEST_API_VERSION = 630
|
TEST_API_VERSION = 700
|
||||||
|
|
||||||
def __init__(self, subspace):
|
def __init__(self, subspace):
|
||||||
super(ScriptedTest, self).__init__(subspace, ScriptedTest.TEST_API_VERSION, ScriptedTest.TEST_API_VERSION)
|
super(ScriptedTest, self).__init__(subspace, ScriptedTest.TEST_API_VERSION, ScriptedTest.TEST_API_VERSION)
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define FDB_API_VERSION 630
|
#define FDB_API_VERSION 700
|
||||||
#define FDB_INCLUDE_LEGACY_TYPES
|
#define FDB_INCLUDE_LEGACY_TYPES
|
||||||
|
|
||||||
#include "fdbclient/MultiVersionTransaction.h"
|
#include "fdbclient/MultiVersionTransaction.h"
|
||||||
|
|
|
@ -28,10 +28,10 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(FDB_API_VERSION)
|
#if !defined(FDB_API_VERSION)
|
||||||
#error You must #define FDB_API_VERSION prior to including fdb_c.h (current version is 630)
|
#error You must #define FDB_API_VERSION prior to including fdb_c.h (current version is 700)
|
||||||
#elif FDB_API_VERSION < 13
|
#elif FDB_API_VERSION < 13
|
||||||
#error API version no longer supported (upgrade to 13)
|
#error API version no longer supported (upgrade to 13)
|
||||||
#elif FDB_API_VERSION > 630
|
#elif FDB_API_VERSION > 700
|
||||||
#error Requested API version requires a newer version of this header
|
#error Requested API version requires a newer version of this header
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ extern "C" {
|
||||||
DLLEXPORT WARN_UNUSED_RESULT fdb_error_t fdb_add_network_thread_completion_hook(void (*hook)(void*), void *hook_parameter);
|
DLLEXPORT WARN_UNUSED_RESULT fdb_error_t fdb_add_network_thread_completion_hook(void (*hook)(void*), void *hook_parameter);
|
||||||
|
|
||||||
#pragma pack(push, 4)
|
#pragma pack(push, 4)
|
||||||
#if FDB_API_VERSION >= 630
|
#if FDB_API_VERSION >= 700
|
||||||
typedef struct keyvalue {
|
typedef struct keyvalue {
|
||||||
const uint8_t* key;
|
const uint8_t* key;
|
||||||
int key_length;
|
int key_length;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FDB_API_VERSION
|
#ifndef FDB_API_VERSION
|
||||||
#define FDB_API_VERSION 630
|
#define FDB_API_VERSION 700
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <foundationdb/fdb_c.h>
|
#include <foundationdb/fdb_c.h>
|
||||||
|
|
|
@ -603,7 +603,7 @@ void runTests(struct ResultSet *rs) {
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
struct ResultSet *rs = newResultSet();
|
struct ResultSet *rs = newResultSet();
|
||||||
checkError(fdb_select_api_version(630), "select API version", rs);
|
checkError(fdb_select_api_version(700), "select API version", rs);
|
||||||
printf("Running performance test at client version: %s\n", fdb_get_client_version());
|
printf("Running performance test at client version: %s\n", fdb_get_client_version());
|
||||||
|
|
||||||
valueStr = (uint8_t*)malloc((sizeof(uint8_t))*valueSize);
|
valueStr = (uint8_t*)malloc((sizeof(uint8_t))*valueSize);
|
||||||
|
|
|
@ -244,7 +244,7 @@ void runTests(struct ResultSet *rs) {
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
struct ResultSet *rs = newResultSet();
|
struct ResultSet *rs = newResultSet();
|
||||||
checkError(fdb_select_api_version(630), "select API version", rs);
|
checkError(fdb_select_api_version(700), "select API version", rs);
|
||||||
printf("Running RYW Benchmark test at client version: %s\n", fdb_get_client_version());
|
printf("Running RYW Benchmark test at client version: %s\n", fdb_get_client_version());
|
||||||
|
|
||||||
keys = generateKeys(numKeys, keySize);
|
keys = generateKeys(numKeys, keySize);
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
#ifndef FDB_API_VERSION
|
#ifndef FDB_API_VERSION
|
||||||
#define FDB_API_VERSION 630
|
#define FDB_API_VERSION 700
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <foundationdb/fdb_c.h>
|
#include <foundationdb/fdb_c.h>
|
||||||
|
|
|
@ -97,7 +97,7 @@ void runTests(struct ResultSet *rs) {
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
struct ResultSet *rs = newResultSet();
|
struct ResultSet *rs = newResultSet();
|
||||||
checkError(fdb_select_api_version(630), "select API version", rs);
|
checkError(fdb_select_api_version(700), "select API version", rs);
|
||||||
printf("Running performance test at client version: %s\n", fdb_get_client_version());
|
printf("Running performance test at client version: %s\n", fdb_get_client_version());
|
||||||
|
|
||||||
keys = generateKeys(numKeys, KEY_SIZE);
|
keys = generateKeys(numKeys, KEY_SIZE);
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define FDB_API_VERSION 630
|
#define FDB_API_VERSION 700
|
||||||
#include "foundationdb/fdb_c.h"
|
#include "foundationdb/fdb_c.h"
|
||||||
#undef DLLEXPORT
|
#undef DLLEXPORT
|
||||||
#include "workloads.h"
|
#include "workloads.h"
|
||||||
|
@ -258,7 +258,7 @@ struct SimpleWorkload : FDBWorkload {
|
||||||
insertsPerTx = context->getOption("insertsPerTx", 100ul);
|
insertsPerTx = context->getOption("insertsPerTx", 100ul);
|
||||||
opsPerTx = context->getOption("opsPerTx", 100ul);
|
opsPerTx = context->getOption("opsPerTx", 100ul);
|
||||||
runFor = context->getOption("runFor", 10.0);
|
runFor = context->getOption("runFor", 10.0);
|
||||||
auto err = fdb_select_api_version(630);
|
auto err = fdb_select_api_version(700);
|
||||||
if (err) {
|
if (err) {
|
||||||
context->trace(FDBSeverity::Info, "SelectAPIVersionFailed",
|
context->trace(FDBSeverity::Info, "SelectAPIVersionFailed",
|
||||||
{ { "Error", std::string(fdb_get_error(err)) } });
|
{ { "Error", std::string(fdb_get_error(err)) } });
|
||||||
|
|
|
@ -36,7 +36,7 @@ THREAD_FUNC networkThread(void* fdb) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ACTOR Future<Void> _test() {
|
ACTOR Future<Void> _test() {
|
||||||
API *fdb = FDB::API::selectAPIVersion(630);
|
API *fdb = FDB::API::selectAPIVersion(700);
|
||||||
auto db = fdb->createDatabase();
|
auto db = fdb->createDatabase();
|
||||||
state Reference<Transaction> tr = db->createTransaction();
|
state Reference<Transaction> tr = db->createTransaction();
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ ACTOR Future<Void> _test() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void fdb_flow_test() {
|
void fdb_flow_test() {
|
||||||
API *fdb = FDB::API::selectAPIVersion(630);
|
API *fdb = FDB::API::selectAPIVersion(700);
|
||||||
fdb->setupNetwork();
|
fdb->setupNetwork();
|
||||||
startThread(networkThread, fdb);
|
startThread(networkThread, fdb);
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#include <flow/flow.h>
|
#include <flow/flow.h>
|
||||||
|
|
||||||
#define FDB_API_VERSION 630
|
#define FDB_API_VERSION 700
|
||||||
#include <bindings/c/foundationdb/fdb_c.h>
|
#include <bindings/c/foundationdb/fdb_c.h>
|
||||||
#undef DLLEXPORT
|
#undef DLLEXPORT
|
||||||
|
|
||||||
|
|
|
@ -1817,7 +1817,7 @@ ACTOR void _test_versionstamp() {
|
||||||
try {
|
try {
|
||||||
g_network = newNet2(TLSConfig());
|
g_network = newNet2(TLSConfig());
|
||||||
|
|
||||||
API *fdb = FDB::API::selectAPIVersion(630);
|
API *fdb = FDB::API::selectAPIVersion(700);
|
||||||
|
|
||||||
fdb->setupNetwork();
|
fdb->setupNetwork();
|
||||||
startThread(networkThread, fdb);
|
startThread(networkThread, fdb);
|
||||||
|
|
|
@ -9,7 +9,7 @@ This package requires:
|
||||||
- [Mono](http://www.mono-project.com/) (macOS or Linux) or [Visual Studio](https://www.visualstudio.com/) (Windows) (build-time only)
|
- [Mono](http://www.mono-project.com/) (macOS or Linux) or [Visual Studio](https://www.visualstudio.com/) (Windows) (build-time only)
|
||||||
- FoundationDB C API 2.0.x-6.1.x (part of the [FoundationDB client packages](https://apple.github.io/foundationdb/downloads.html#c))
|
- FoundationDB C API 2.0.x-6.1.x (part of the [FoundationDB client packages](https://apple.github.io/foundationdb/downloads.html#c))
|
||||||
|
|
||||||
Use of this package requires the selection of a FoundationDB API version at runtime. This package currently supports FoundationDB API versions 200-630.
|
Use of this package requires the selection of a FoundationDB API version at runtime. This package currently supports FoundationDB API versions 200-700.
|
||||||
|
|
||||||
To install this package, you can run the "fdb-go-install.sh" script (for versions 5.0.x and greater):
|
To install this package, you can run the "fdb-go-install.sh" script (for versions 5.0.x and greater):
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
package fdb
|
package fdb
|
||||||
|
|
||||||
// #define FDB_API_VERSION 630
|
// #define FDB_API_VERSION 700
|
||||||
// #include <foundationdb/fdb_c.h>
|
// #include <foundationdb/fdb_c.h>
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
package fdb
|
package fdb
|
||||||
|
|
||||||
// #define FDB_API_VERSION 630
|
// #define FDB_API_VERSION 700
|
||||||
// #include <foundationdb/fdb_c.h>
|
// #include <foundationdb/fdb_c.h>
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ A basic interaction with the FoundationDB API is demonstrated below:
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Different API versions may expose different runtime behaviors.
|
// Different API versions may expose different runtime behaviors.
|
||||||
fdb.MustAPIVersion(630)
|
fdb.MustAPIVersion(700)
|
||||||
|
|
||||||
// Open the default database from the system cluster
|
// Open the default database from the system cluster
|
||||||
db := fdb.MustOpenDefault()
|
db := fdb.MustOpenDefault()
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
package fdb
|
package fdb
|
||||||
|
|
||||||
// #define FDB_API_VERSION 630
|
// #define FDB_API_VERSION 700
|
||||||
// #include <foundationdb/fdb_c.h>
|
// #include <foundationdb/fdb_c.h>
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
package fdb
|
package fdb
|
||||||
|
|
||||||
// #define FDB_API_VERSION 630
|
// #define FDB_API_VERSION 700
|
||||||
// #include <foundationdb/fdb_c.h>
|
// #include <foundationdb/fdb_c.h>
|
||||||
// #include <stdlib.h>
|
// #include <stdlib.h>
|
||||||
import "C"
|
import "C"
|
||||||
|
@ -108,7 +108,7 @@ func (opt NetworkOptions) setOpt(code int, param []byte) error {
|
||||||
// library, an error will be returned. APIVersion must be called prior to any
|
// library, an error will be returned. APIVersion must be called prior to any
|
||||||
// other functions in the fdb package.
|
// other functions in the fdb package.
|
||||||
//
|
//
|
||||||
// Currently, this package supports API versions 200 through 630.
|
// Currently, this package supports API versions 200 through 700.
|
||||||
//
|
//
|
||||||
// Warning: When using the multi-version client API, setting an API version that
|
// 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
|
// is not supported by a particular client library will prevent that client from
|
||||||
|
@ -116,7 +116,7 @@ func (opt NetworkOptions) setOpt(code int, param []byte) error {
|
||||||
// the API version of your application after upgrading your client until the
|
// the API version of your application after upgrading your client until the
|
||||||
// cluster has also been upgraded.
|
// cluster has also been upgraded.
|
||||||
func APIVersion(version int) error {
|
func APIVersion(version int) error {
|
||||||
headerVersion := 630
|
headerVersion := 700
|
||||||
|
|
||||||
networkMutex.Lock()
|
networkMutex.Lock()
|
||||||
defer networkMutex.Unlock()
|
defer networkMutex.Unlock()
|
||||||
|
@ -128,7 +128,7 @@ func APIVersion(version int) error {
|
||||||
return errAPIVersionAlreadySet
|
return errAPIVersionAlreadySet
|
||||||
}
|
}
|
||||||
|
|
||||||
if version < 200 || version > 630 {
|
if version < 200 || version > 700 {
|
||||||
return errAPIVersionNotSupported
|
return errAPIVersionNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ import (
|
||||||
func ExampleOpenDefault() {
|
func ExampleOpenDefault() {
|
||||||
var e error
|
var e error
|
||||||
|
|
||||||
e = fdb.APIVersion(630)
|
e = fdb.APIVersion(700)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
fmt.Printf("Unable to set API version: %v\n", e)
|
fmt.Printf("Unable to set API version: %v\n", e)
|
||||||
return
|
return
|
||||||
|
@ -52,7 +52,7 @@ func ExampleOpenDefault() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVersionstamp(t *testing.T) {
|
func TestVersionstamp(t *testing.T) {
|
||||||
fdb.MustAPIVersion(630)
|
fdb.MustAPIVersion(700)
|
||||||
db := fdb.MustOpenDefault()
|
db := fdb.MustOpenDefault()
|
||||||
|
|
||||||
setVs := func(t fdb.Transactor, key fdb.Key) (fdb.FutureKey, error) {
|
setVs := func(t fdb.Transactor, key fdb.Key) (fdb.FutureKey, error) {
|
||||||
|
@ -98,7 +98,7 @@ func TestVersionstamp(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExampleTransactor() {
|
func ExampleTransactor() {
|
||||||
fdb.MustAPIVersion(630)
|
fdb.MustAPIVersion(700)
|
||||||
db := fdb.MustOpenDefault()
|
db := fdb.MustOpenDefault()
|
||||||
|
|
||||||
setOne := func(t fdb.Transactor, key fdb.Key, value []byte) error {
|
setOne := func(t fdb.Transactor, key fdb.Key, value []byte) error {
|
||||||
|
@ -149,7 +149,7 @@ func ExampleTransactor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExampleReadTransactor() {
|
func ExampleReadTransactor() {
|
||||||
fdb.MustAPIVersion(630)
|
fdb.MustAPIVersion(700)
|
||||||
db := fdb.MustOpenDefault()
|
db := fdb.MustOpenDefault()
|
||||||
|
|
||||||
getOne := func(rt fdb.ReadTransactor, key fdb.Key) ([]byte, error) {
|
getOne := func(rt fdb.ReadTransactor, key fdb.Key) ([]byte, error) {
|
||||||
|
@ -202,7 +202,7 @@ func ExampleReadTransactor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExamplePrefixRange() {
|
func ExamplePrefixRange() {
|
||||||
fdb.MustAPIVersion(630)
|
fdb.MustAPIVersion(700)
|
||||||
db := fdb.MustOpenDefault()
|
db := fdb.MustOpenDefault()
|
||||||
|
|
||||||
tr, e := db.CreateTransaction()
|
tr, e := db.CreateTransaction()
|
||||||
|
@ -241,7 +241,7 @@ func ExamplePrefixRange() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExampleRangeIterator() {
|
func ExampleRangeIterator() {
|
||||||
fdb.MustAPIVersion(630)
|
fdb.MustAPIVersion(700)
|
||||||
db := fdb.MustOpenDefault()
|
db := fdb.MustOpenDefault()
|
||||||
|
|
||||||
tr, e := db.CreateTransaction()
|
tr, e := db.CreateTransaction()
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
package fdb
|
package fdb
|
||||||
|
|
||||||
// #cgo LDFLAGS: -lfdb_c -lm
|
// #cgo LDFLAGS: -lfdb_c -lm
|
||||||
// #define FDB_API_VERSION 630
|
// #define FDB_API_VERSION 700
|
||||||
// #include <foundationdb/fdb_c.h>
|
// #include <foundationdb/fdb_c.h>
|
||||||
// #include <string.h>
|
// #include <string.h>
|
||||||
//
|
//
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
package fdb
|
package fdb
|
||||||
|
|
||||||
// #define FDB_API_VERSION 630
|
// #define FDB_API_VERSION 700
|
||||||
// #include <foundationdb/fdb_c.h>
|
// #include <foundationdb/fdb_c.h>
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
package fdb
|
package fdb
|
||||||
|
|
||||||
// #define FDB_API_VERSION 630
|
// #define FDB_API_VERSION 700
|
||||||
// #include <foundationdb/fdb_c.h>
|
// #include <foundationdb/fdb_c.h>
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <foundationdb/ClientWorkload.h>
|
#include <foundationdb/ClientWorkload.h>
|
||||||
#define FDB_API_VERSION 630
|
#define FDB_API_VERSION 700
|
||||||
#include <foundationdb/fdb_c.h>
|
#include <foundationdb/fdb_c.h>
|
||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
@ -370,7 +370,7 @@ struct JVM {
|
||||||
jmethodID selectMethod =
|
jmethodID selectMethod =
|
||||||
env->GetStaticMethodID(fdbClass, "selectAPIVersion", "(I)Lcom/apple/foundationdb/FDB;");
|
env->GetStaticMethodID(fdbClass, "selectAPIVersion", "(I)Lcom/apple/foundationdb/FDB;");
|
||||||
checkException();
|
checkException();
|
||||||
auto fdbInstance = env->CallStaticObjectMethod(fdbClass, selectMethod, jint(630));
|
auto fdbInstance = env->CallStaticObjectMethod(fdbClass, selectMethod, jint(700));
|
||||||
checkException();
|
checkException();
|
||||||
env->CallObjectMethod(fdbInstance, getMethod(fdbClass, "disableShutdownHook", "()V"));
|
env->CallObjectMethod(fdbInstance, getMethod(fdbClass, "disableShutdownHook", "()V"));
|
||||||
checkException();
|
checkException();
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define FDB_API_VERSION 630
|
#define FDB_API_VERSION 700
|
||||||
|
|
||||||
#include <foundationdb/fdb_c.h>
|
#include <foundationdb/fdb_c.h>
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||||
* This call is required before using any other part of the API. The call allows
|
* 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
|
* 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
|
* with incorrect assumptions from the current version. The API version documented here is version
|
||||||
* {@code 630}.<br><br>
|
* {@code 700}.<br><br>
|
||||||
* FoundationDB encapsulates multiple versions of its interface by requiring
|
* FoundationDB encapsulates multiple versions of its interface by requiring
|
||||||
* the client to explicitly specify the version of the API it uses. The purpose
|
* 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
|
* of this design is to allow you to upgrade the server, client libraries, or
|
||||||
|
@ -181,8 +181,8 @@ public class FDB {
|
||||||
}
|
}
|
||||||
if(version < 510)
|
if(version < 510)
|
||||||
throw new IllegalArgumentException("API version not supported (minimum 510)");
|
throw new IllegalArgumentException("API version not supported (minimum 510)");
|
||||||
if(version > 630)
|
if(version > 700)
|
||||||
throw new IllegalArgumentException("API version not supported (maximum 630)");
|
throw new IllegalArgumentException("API version not supported (maximum 700)");
|
||||||
|
|
||||||
Select_API_version(version);
|
Select_API_version(version);
|
||||||
singleton = new FDB(version);
|
singleton = new FDB(version);
|
||||||
|
|
|
@ -13,7 +13,7 @@ and then added to your classpath.<br>
|
||||||
<h1>Getting started</h1>
|
<h1>Getting started</h1>
|
||||||
To start using FoundationDB from Java, create an instance of the
|
To start using FoundationDB from Java, create an instance of the
|
||||||
{@link com.apple.foundationdb.FDB FoundationDB API interface} with the version of the
|
{@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 510} and {@code 630}).
|
API that you want to use (this release of the FoundationDB Java API supports versions between {@code 510} and {@code 700}).
|
||||||
With this API object you can then open {@link com.apple.foundationdb.Cluster Cluster}s and
|
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.Database Database}s and start using
|
||||||
{@link com.apple.foundationdb.Transaction Transaction}s.
|
{@link com.apple.foundationdb.Transaction Transaction}s.
|
||||||
|
@ -29,7 +29,7 @@ import com.apple.foundationdb.tuple.Tuple;
|
||||||
|
|
||||||
public class Example {
|
public class Example {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
FDB fdb = FDB.selectAPIVersion(630);
|
FDB fdb = FDB.selectAPIVersion(700);
|
||||||
|
|
||||||
try(Database db = fdb.open()) {
|
try(Database db = fdb.open()) {
|
||||||
// Run an operation on the database
|
// Run an operation on the database
|
||||||
|
|
|
@ -27,7 +27,7 @@ import com.apple.foundationdb.Database;
|
||||||
import com.apple.foundationdb.FDB;
|
import com.apple.foundationdb.FDB;
|
||||||
|
|
||||||
public abstract class AbstractTester {
|
public abstract class AbstractTester {
|
||||||
public static final int API_VERSION = 630;
|
public static final int API_VERSION = 700;
|
||||||
protected static final int NUM_RUNS = 25;
|
protected static final int NUM_RUNS = 25;
|
||||||
protected static final Charset ASCII = Charset.forName("ASCII");
|
protected static final Charset ASCII = Charset.forName("ASCII");
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class BlockingBenchmark {
|
||||||
private static final int PARALLEL = 100;
|
private static final int PARALLEL = 100;
|
||||||
|
|
||||||
public static void main(String[] args) throws InterruptedException {
|
public static void main(String[] args) throws InterruptedException {
|
||||||
FDB fdb = FDB.selectAPIVersion(630);
|
FDB fdb = FDB.selectAPIVersion(700);
|
||||||
|
|
||||||
// The cluster file DOES NOT need to be valid, although it must exist.
|
// 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.
|
// This is because the database is never really contacted in this test.
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class ConcurrentGetSetGet {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
try(Database database = FDB.selectAPIVersion(630).open()) {
|
try(Database database = FDB.selectAPIVersion(700).open()) {
|
||||||
new ConcurrentGetSetGet().apply(database);
|
new ConcurrentGetSetGet().apply(database);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ import com.apple.foundationdb.directory.DirectorySubspace;
|
||||||
public class DirectoryTest {
|
public class DirectoryTest {
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
try {
|
try {
|
||||||
FDB fdb = FDB.selectAPIVersion(630);
|
FDB fdb = FDB.selectAPIVersion(700);
|
||||||
try(Database db = fdb.open()) {
|
try(Database db = fdb.open()) {
|
||||||
runTests(db);
|
runTests(db);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ import com.apple.foundationdb.tuple.Tuple;
|
||||||
|
|
||||||
public class Example {
|
public class Example {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
FDB fdb = FDB.selectAPIVersion(630);
|
FDB fdb = FDB.selectAPIVersion(700);
|
||||||
|
|
||||||
try(Database db = fdb.open()) {
|
try(Database db = fdb.open()) {
|
||||||
// Run an operation on the database
|
// Run an operation on the database
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class IterableTest {
|
||||||
public static void main(String[] args) throws InterruptedException {
|
public static void main(String[] args) throws InterruptedException {
|
||||||
final int reps = 1000;
|
final int reps = 1000;
|
||||||
try {
|
try {
|
||||||
FDB fdb = FDB.selectAPIVersion(630);
|
FDB fdb = FDB.selectAPIVersion(700);
|
||||||
try(Database db = fdb.open()) {
|
try(Database db = fdb.open()) {
|
||||||
runTests(reps, db);
|
runTests(reps, db);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ import com.apple.foundationdb.tuple.ByteArrayUtil;
|
||||||
public class LocalityTests {
|
public class LocalityTests {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
FDB fdb = FDB.selectAPIVersion(630);
|
FDB fdb = FDB.selectAPIVersion(700);
|
||||||
try(Database database = fdb.open(args[0])) {
|
try(Database database = fdb.open(args[0])) {
|
||||||
try(Transaction tr = database.createTransaction()) {
|
try(Transaction tr = database.createTransaction()) {
|
||||||
String[] keyAddresses = LocalityUtil.getAddressesForKey(tr, "a".getBytes()).join();
|
String[] keyAddresses = LocalityUtil.getAddressesForKey(tr, "a".getBytes()).join();
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class ParallelRandomScan {
|
||||||
private static final int PARALLELISM_STEP = 5;
|
private static final int PARALLELISM_STEP = 5;
|
||||||
|
|
||||||
public static void main(String[] args) throws InterruptedException {
|
public static void main(String[] args) throws InterruptedException {
|
||||||
FDB api = FDB.selectAPIVersion(630);
|
FDB api = FDB.selectAPIVersion(700);
|
||||||
try(Database database = api.open(args[0])) {
|
try(Database database = api.open(args[0])) {
|
||||||
for(int i = PARALLELISM_MIN; i <= PARALLELISM_MAX; i += PARALLELISM_STEP) {
|
for(int i = PARALLELISM_MIN; i <= PARALLELISM_MAX; i += PARALLELISM_STEP) {
|
||||||
runTest(database, i, ROWS, DURATION_MS);
|
runTest(database, i, ROWS, DURATION_MS);
|
||||||
|
|
|
@ -34,7 +34,7 @@ import com.apple.foundationdb.Transaction;
|
||||||
import com.apple.foundationdb.async.AsyncIterable;
|
import com.apple.foundationdb.async.AsyncIterable;
|
||||||
|
|
||||||
public class RangeTest {
|
public class RangeTest {
|
||||||
private static final int API_VERSION = 630;
|
private static final int API_VERSION = 700;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println("About to use version " + API_VERSION);
|
System.out.println("About to use version " + API_VERSION);
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class SerialInsertion {
|
||||||
private static final int NODES = 1000000;
|
private static final int NODES = 1000000;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
FDB api = FDB.selectAPIVersion(630);
|
FDB api = FDB.selectAPIVersion(700);
|
||||||
try(Database database = api.open()) {
|
try(Database database = api.open()) {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class SerialIteration {
|
||||||
private static final int THREAD_COUNT = 1;
|
private static final int THREAD_COUNT = 1;
|
||||||
|
|
||||||
public static void main(String[] args) throws InterruptedException {
|
public static void main(String[] args) throws InterruptedException {
|
||||||
FDB api = FDB.selectAPIVersion(630);
|
FDB api = FDB.selectAPIVersion(700);
|
||||||
try(Database database = api.open(args[0])) {
|
try(Database database = api.open(args[0])) {
|
||||||
for(int i = 1; i <= THREAD_COUNT; i++) {
|
for(int i = 1; i <= THREAD_COUNT; i++) {
|
||||||
runThreadedTest(database, i);
|
runThreadedTest(database, i);
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class SerialTest {
|
||||||
public static void main(String[] args) throws InterruptedException {
|
public static void main(String[] args) throws InterruptedException {
|
||||||
final int reps = 1000;
|
final int reps = 1000;
|
||||||
try {
|
try {
|
||||||
FDB fdb = FDB.selectAPIVersion(630);
|
FDB fdb = FDB.selectAPIVersion(700);
|
||||||
try(Database db = fdb.open()) {
|
try(Database db = fdb.open()) {
|
||||||
runTests(reps, db);
|
runTests(reps, db);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class SnapshotTransactionTest {
|
||||||
private static final Subspace SUBSPACE = new Subspace(Tuple.from("test", "conflict_ranges"));
|
private static final Subspace SUBSPACE = new Subspace(Tuple.from("test", "conflict_ranges"));
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
FDB fdb = FDB.selectAPIVersion(630);
|
FDB fdb = FDB.selectAPIVersion(700);
|
||||||
try(Database db = fdb.open()) {
|
try(Database db = fdb.open()) {
|
||||||
snapshotReadShouldNotConflict(db);
|
snapshotReadShouldNotConflict(db);
|
||||||
snapshotShouldNotAddConflictRange(db);
|
snapshotShouldNotAddConflictRange(db);
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class TupleTest {
|
||||||
public static void main(String[] args) throws NoSuchFieldException {
|
public static void main(String[] args) throws NoSuchFieldException {
|
||||||
final int reps = 1000;
|
final int reps = 1000;
|
||||||
try {
|
try {
|
||||||
FDB fdb = FDB.selectAPIVersion(630);
|
FDB fdb = FDB.selectAPIVersion(700);
|
||||||
addMethods();
|
addMethods();
|
||||||
comparisons();
|
comparisons();
|
||||||
emptyTuple();
|
emptyTuple();
|
||||||
|
|
|
@ -32,7 +32,7 @@ import com.apple.foundationdb.tuple.Versionstamp;
|
||||||
|
|
||||||
public class VersionstampSmokeTest {
|
public class VersionstampSmokeTest {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
FDB fdb = FDB.selectAPIVersion(630);
|
FDB fdb = FDB.selectAPIVersion(700);
|
||||||
try(Database db = fdb.open()) {
|
try(Database db = fdb.open()) {
|
||||||
db.run(tr -> {
|
db.run(tr -> {
|
||||||
tr.clear(Tuple.from("prefix").range());
|
tr.clear(Tuple.from("prefix").range());
|
||||||
|
|
|
@ -34,7 +34,7 @@ import com.apple.foundationdb.Transaction;
|
||||||
public class WatchTest {
|
public class WatchTest {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
FDB fdb = FDB.selectAPIVersion(630);
|
FDB fdb = FDB.selectAPIVersion(700);
|
||||||
try(Database database = fdb.open(args[0])) {
|
try(Database database = fdb.open(args[0])) {
|
||||||
database.options().setLocationCacheSize(42);
|
database.options().setLocationCacheSize(42);
|
||||||
try(Transaction tr = database.createTransaction()) {
|
try(Transaction tr = database.createTransaction()) {
|
||||||
|
|
|
@ -52,7 +52,7 @@ def get_api_version():
|
||||||
|
|
||||||
|
|
||||||
def api_version(ver):
|
def api_version(ver):
|
||||||
header_version = 630
|
header_version = 700
|
||||||
|
|
||||||
if '_version' in globals():
|
if '_version' in globals():
|
||||||
if globals()['_version'] != ver:
|
if globals()['_version'] != ver:
|
||||||
|
|
|
@ -253,7 +253,7 @@ def transactional(*tr_args, **tr_kwargs):
|
||||||
@functools.wraps(func)
|
@functools.wraps(func)
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
# We can't throw this from the decorator, as when a user runs
|
# We can't throw this from the decorator, as when a user runs
|
||||||
# >>> import fdb ; fdb.api_version(630)
|
# >>> import fdb ; fdb.api_version(700)
|
||||||
# the code above uses @transactional before the API version is set
|
# the code above uses @transactional before the API version is set
|
||||||
if fdb.get_api_version() >= 630 and inspect.isgeneratorfunction(func):
|
if fdb.get_api_version() >= 630 and inspect.isgeneratorfunction(func):
|
||||||
raise ValueError("Generators can not be wrapped with fdb.transactional")
|
raise ValueError("Generators can not be wrapped with fdb.transactional")
|
||||||
|
|
|
@ -22,7 +22,7 @@ import fdb
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
fdb.api_version(630)
|
fdb.api_version(700)
|
||||||
|
|
||||||
@fdb.transactional
|
@fdb.transactional
|
||||||
def setValue(tr, key, value):
|
def setValue(tr, key, value):
|
||||||
|
|
|
@ -36,7 +36,7 @@ module FDB
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def self.api_version(version)
|
def self.api_version(version)
|
||||||
header_version = 630
|
header_version = 700
|
||||||
if self.is_api_version_selected?()
|
if self.is_api_version_selected?()
|
||||||
if @@chosen_version != version
|
if @@chosen_version != version
|
||||||
raise "FDB API already loaded at version #{@@chosen_version}."
|
raise "FDB API already loaded at version #{@@chosen_version}."
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#define FDB_API_VERSION 630
|
#define FDB_API_VERSION 700
|
||||||
#include <foundationdb/fdb_c.h>
|
#include <foundationdb/fdb_c.h>
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
fdb_select_api_version(630);
|
fdb_select_api_version(700);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ then
|
||||||
python setup.py install
|
python setup.py install
|
||||||
successOr "Installing python bindings failed"
|
successOr "Installing python bindings failed"
|
||||||
popd
|
popd
|
||||||
python -c 'import fdb; fdb.api_version(630)'
|
python -c 'import fdb; fdb.api_version(700)'
|
||||||
successOr "Loading python bindings failed"
|
successOr "Loading python bindings failed"
|
||||||
|
|
||||||
# Test cmake and pkg-config integration: https://github.com/apple/foundationdb/issues/1483
|
# Test cmake and pkg-config integration: https://github.com/apple/foundationdb/issues/1483
|
||||||
|
|
|
@ -133,7 +133,7 @@ API versioning
|
||||||
|
|
||||||
Prior to including ``fdb_c.h``, you must define the ``FDB_API_VERSION`` macro. This, together with the :func:`fdb_select_api_version()` function, allows programs written against an older version of the API to compile and run with newer versions of the C library. The current version of the FoundationDB C API is |api-version|. ::
|
Prior to including ``fdb_c.h``, you must define the ``FDB_API_VERSION`` macro. This, together with the :func:`fdb_select_api_version()` function, allows programs written against an older version of the API to compile and run with newer versions of the C library. The current version of the FoundationDB C API is |api-version|. ::
|
||||||
|
|
||||||
#define FDB_API_VERSION 630
|
#define FDB_API_VERSION 700
|
||||||
#include <foundationdb/fdb_c.h>
|
#include <foundationdb/fdb_c.h>
|
||||||
|
|
||||||
.. function:: fdb_error_t fdb_select_api_version(int version)
|
.. function:: fdb_error_t fdb_select_api_version(int version)
|
||||||
|
|
|
@ -147,7 +147,7 @@
|
||||||
.. |atomic-versionstamps-tuple-warning-value| replace::
|
.. |atomic-versionstamps-tuple-warning-value| replace::
|
||||||
At this time, versionstamped values are not compatible with the Tuple layer except in Java, Python, and Go. Note that this implies versionstamped values may not be used with the Subspace and Directory layers except in those languages.
|
At this time, versionstamped values are not compatible with the Tuple layer except in Java, Python, and Go. Note that this implies versionstamped values may not be used with the Subspace and Directory layers except in those languages.
|
||||||
|
|
||||||
.. |api-version| replace:: 630
|
.. |api-version| replace:: 700
|
||||||
|
|
||||||
.. |streaming-mode-blurb1| replace::
|
.. |streaming-mode-blurb1| replace::
|
||||||
When using |get-range-func| and similar interfaces, API clients can request large ranges of the database to iterate over. Making such a request doesn't necessarily mean that the client will consume all of the data in the range - sometimes the client doesn't know how far it intends to iterate in advance. FoundationDB tries to balance latency and bandwidth by requesting data for iteration in batches.
|
When using |get-range-func| and similar interfaces, API clients can request large ranges of the database to iterate over. Making such a request doesn't necessarily mean that the client will consume all of the data in the range - sometimes the client doesn't know how far it intends to iterate in advance. FoundationDB tries to balance latency and bandwidth by requesting data for iteration in batches.
|
||||||
|
|
|
@ -108,7 +108,7 @@ Opening a database
|
||||||
After importing the ``fdb`` module and selecting an API version, you probably want to open a :class:`Database` using :func:`open`::
|
After importing the ``fdb`` module and selecting an API version, you probably want to open a :class:`Database` using :func:`open`::
|
||||||
|
|
||||||
import fdb
|
import fdb
|
||||||
fdb.api_version(630)
|
fdb.api_version(700)
|
||||||
db = fdb.open()
|
db = fdb.open()
|
||||||
|
|
||||||
.. function:: open( cluster_file=None, event_model=None )
|
.. function:: open( cluster_file=None, event_model=None )
|
||||||
|
|
|
@ -93,7 +93,7 @@ Opening a database
|
||||||
After requiring the ``FDB`` gem and selecting an API version, you probably want to open a :class:`Database` using :func:`open`::
|
After requiring the ``FDB`` gem and selecting an API version, you probably want to open a :class:`Database` using :func:`open`::
|
||||||
|
|
||||||
require 'fdb'
|
require 'fdb'
|
||||||
FDB.api_version 630
|
FDB.api_version 700
|
||||||
db = FDB.open
|
db = FDB.open
|
||||||
|
|
||||||
.. function:: open( cluster_file=nil ) -> Database
|
.. function:: open( cluster_file=nil ) -> Database
|
||||||
|
|
|
@ -29,7 +29,7 @@ Before using the API, we need to specify the API version. This allows programs t
|
||||||
|
|
||||||
.. code-block:: go
|
.. code-block:: go
|
||||||
|
|
||||||
fdb.MustAPIVersion(630)
|
fdb.MustAPIVersion(700)
|
||||||
|
|
||||||
Next, we open a FoundationDB database. The API will connect to the FoundationDB cluster indicated by the :ref:`default cluster file <default-cluster-file>`.
|
Next, we open a FoundationDB database. The API will connect to the FoundationDB cluster indicated by the :ref:`default cluster file <default-cluster-file>`.
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ If this is all working, it looks like we are ready to start building a real appl
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Different API versions may expose different runtime behaviors.
|
// Different API versions may expose different runtime behaviors.
|
||||||
fdb.MustAPIVersion(630)
|
fdb.MustAPIVersion(700)
|
||||||
|
|
||||||
// Open the default database from the system cluster
|
// Open the default database from the system cluster
|
||||||
db := fdb.MustOpenDefault()
|
db := fdb.MustOpenDefault()
|
||||||
|
@ -666,7 +666,7 @@ Here's the code for the scheduling tutorial:
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
fdb.MustAPIVersion(630)
|
fdb.MustAPIVersion(700)
|
||||||
db := fdb.MustOpenDefault()
|
db := fdb.MustOpenDefault()
|
||||||
db.Options().SetTransactionTimeout(60000) // 60,000 ms = 1 minute
|
db.Options().SetTransactionTimeout(60000) // 60,000 ms = 1 minute
|
||||||
db.Options().SetTransactionRetryLimit(100)
|
db.Options().SetTransactionRetryLimit(100)
|
||||||
|
|
|
@ -30,7 +30,7 @@ Before using the API, we need to specify the API version. This allows programs t
|
||||||
private static final Database db;
|
private static final Database db;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
fdb = FDB.selectAPIVersion(630);
|
fdb = FDB.selectAPIVersion(700);
|
||||||
db = fdb.open();
|
db = fdb.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ If this is all working, it looks like we are ready to start building a real appl
|
||||||
private static final Database db;
|
private static final Database db;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
fdb = FDB.selectAPIVersion(630);
|
fdb = FDB.selectAPIVersion(700);
|
||||||
db = fdb.open();
|
db = fdb.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -441,7 +441,7 @@ Here's the code for the scheduling tutorial:
|
||||||
private static final Database db;
|
private static final Database db;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
fdb = FDB.selectAPIVersion(630);
|
fdb = FDB.selectAPIVersion(700);
|
||||||
db = fdb.open();
|
db = fdb.open();
|
||||||
db.options().setTransactionTimeout(60000); // 60,000 ms = 1 minute
|
db.options().setTransactionTimeout(60000); // 60,000 ms = 1 minute
|
||||||
db.options().setTransactionRetryLimit(100);
|
db.options().setTransactionRetryLimit(100);
|
||||||
|
|
|
@ -23,7 +23,7 @@ Open a Ruby interactive interpreter and import the FoundationDB API module::
|
||||||
|
|
||||||
Before using the API, we need to specify the API version. This allows programs to maintain compatibility even if the API is modified in future versions::
|
Before using the API, we need to specify the API version. This allows programs to maintain compatibility even if the API is modified in future versions::
|
||||||
|
|
||||||
> FDB.api_version 630
|
> FDB.api_version 700
|
||||||
=> nil
|
=> nil
|
||||||
|
|
||||||
Next, we open a FoundationDB database. The API will connect to the FoundationDB cluster indicated by the :ref:`default cluster file <default-cluster-file>`. ::
|
Next, we open a FoundationDB database. The API will connect to the FoundationDB cluster indicated by the :ref:`default cluster file <default-cluster-file>`. ::
|
||||||
|
@ -46,7 +46,7 @@ If this is all working, it looks like we are ready to start building a real appl
|
||||||
.. code-block:: ruby
|
.. code-block:: ruby
|
||||||
|
|
||||||
require 'fdb'
|
require 'fdb'
|
||||||
FDB.api_version 630
|
FDB.api_version 700
|
||||||
@db = FDB.open
|
@db = FDB.open
|
||||||
@db['hello'] = 'world'
|
@db['hello'] = 'world'
|
||||||
print 'hello ', @db['hello']
|
print 'hello ', @db['hello']
|
||||||
|
@ -373,7 +373,7 @@ Here's the code for the scheduling tutorial:
|
||||||
|
|
||||||
require 'fdb'
|
require 'fdb'
|
||||||
|
|
||||||
FDB.api_version 630
|
FDB.api_version 700
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
## Initialization ##
|
## Initialization ##
|
||||||
|
|
|
@ -30,7 +30,7 @@ Open a Python interactive interpreter and import the FoundationDB API module::
|
||||||
|
|
||||||
Before using the API, we need to specify the API version. This allows programs to maintain compatibility even if the API is modified in future versions::
|
Before using the API, we need to specify the API version. This allows programs to maintain compatibility even if the API is modified in future versions::
|
||||||
|
|
||||||
>>> fdb.api_version(630)
|
>>> fdb.api_version(700)
|
||||||
|
|
||||||
Next, we open a FoundationDB database. The API will connect to the FoundationDB cluster indicated by the :ref:`default cluster file <default-cluster-file>`. ::
|
Next, we open a FoundationDB database. The API will connect to the FoundationDB cluster indicated by the :ref:`default cluster file <default-cluster-file>`. ::
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ When this command returns without exception, the modification is durably stored
|
||||||
If this is all working, it looks like we are ready to start building a real application. For reference, here's the full code for "hello world"::
|
If this is all working, it looks like we are ready to start building a real application. For reference, here's the full code for "hello world"::
|
||||||
|
|
||||||
import fdb
|
import fdb
|
||||||
fdb.api_version(630)
|
fdb.api_version(700)
|
||||||
db = fdb.open()
|
db = fdb.open()
|
||||||
db[b'hello'] = b'world'
|
db[b'hello'] = b'world'
|
||||||
print 'hello', db[b'hello']
|
print 'hello', db[b'hello']
|
||||||
|
@ -91,7 +91,7 @@ FoundationDB includes a few tools that make it easy to model data using this app
|
||||||
opening a :ref:`directory <developer-guide-directories>` in the database::
|
opening a :ref:`directory <developer-guide-directories>` in the database::
|
||||||
|
|
||||||
import fdb
|
import fdb
|
||||||
fdb.api_version(630)
|
fdb.api_version(700)
|
||||||
|
|
||||||
db = fdb.open()
|
db = fdb.open()
|
||||||
scheduling = fdb.directory.create_or_open(db, ('scheduling',))
|
scheduling = fdb.directory.create_or_open(db, ('scheduling',))
|
||||||
|
@ -337,7 +337,7 @@ Here's the code for the scheduling tutorial::
|
||||||
import fdb
|
import fdb
|
||||||
import fdb.tuple
|
import fdb.tuple
|
||||||
|
|
||||||
fdb.api_version(630)
|
fdb.api_version(700)
|
||||||
|
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
|
|
|
@ -69,7 +69,7 @@ Here’s a basic implementation of the recipe.
|
||||||
private static final long EMPTY_ARRAY = -1;
|
private static final long EMPTY_ARRAY = -1;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
fdb = FDB.selectAPIVersion(630);
|
fdb = FDB.selectAPIVersion(700);
|
||||||
db = fdb.open();
|
db = fdb.open();
|
||||||
docSpace = new Subspace(Tuple.from("D"));
|
docSpace = new Subspace(Tuple.from("D"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ Here’s a simple implementation of multimaps with multisets as described:
|
||||||
private static final int N = 100;
|
private static final int N = 100;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
fdb = FDB.selectAPIVersion(630);
|
fdb = FDB.selectAPIVersion(700);
|
||||||
db = fdb.open();
|
db = fdb.open();
|
||||||
multi = new Subspace(Tuple.from("M"));
|
multi = new Subspace(Tuple.from("M"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ Here's a basic implementation of the model:
|
||||||
private static final Random randno;
|
private static final Random randno;
|
||||||
|
|
||||||
static{
|
static{
|
||||||
fdb = FDB.selectAPIVersion(630);
|
fdb = FDB.selectAPIVersion(700);
|
||||||
db = fdb.open();
|
db = fdb.open();
|
||||||
pq = new Subspace(Tuple.from("P"));
|
pq = new Subspace(Tuple.from("P"));
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ The following is a simple implementation of the basic pattern:
|
||||||
private static final Random randno;
|
private static final Random randno;
|
||||||
|
|
||||||
static{
|
static{
|
||||||
fdb = FDB.selectAPIVersion(630);
|
fdb = FDB.selectAPIVersion(700);
|
||||||
db = fdb.open();
|
db = fdb.open();
|
||||||
queue = new Subspace(Tuple.from("Q"));
|
queue = new Subspace(Tuple.from("Q"));
|
||||||
randno = new Random();
|
randno = new Random();
|
||||||
|
|
|
@ -87,7 +87,7 @@ In this example, we’re storing user data based on user ID but sometimes need t
|
||||||
private static final Subspace index;
|
private static final Subspace index;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
fdb = FDB.selectAPIVersion(630);
|
fdb = FDB.selectAPIVersion(700);
|
||||||
db = fdb.open();
|
db = fdb.open();
|
||||||
main = new Subspace(Tuple.from("user"));
|
main = new Subspace(Tuple.from("user"));
|
||||||
index = new Subspace(Tuple.from("zipcode_index"));
|
index = new Subspace(Tuple.from("zipcode_index"));
|
||||||
|
|
|
@ -62,7 +62,7 @@ Here’s a simple implementation of the basic table pattern:
|
||||||
private static final Subspace colIndex;
|
private static final Subspace colIndex;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
fdb = FDB.selectAPIVersion(630);
|
fdb = FDB.selectAPIVersion(700);
|
||||||
db = fdb.open();
|
db = fdb.open();
|
||||||
table = new Subspace(Tuple.from("T"));
|
table = new Subspace(Tuple.from("T"));
|
||||||
rowIndex = table.subspace(Tuple.from("R"));
|
rowIndex = table.subspace(Tuple.from("R"));
|
||||||
|
|
|
@ -77,7 +77,7 @@ Here’s the basic pattern:
|
||||||
private static final Subspace vector;
|
private static final Subspace vector;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
fdb = FDB.selectAPIVersion(630);
|
fdb = FDB.selectAPIVersion(700);
|
||||||
db = fdb.open();
|
db = fdb.open();
|
||||||
vector = new Subspace(Tuple.from("V"));
|
vector = new Subspace(Tuple.from("V"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ func read_blob(t fdb.ReadTransactor, blob_subspace subspace.Subspace) ([]byte, e
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
fdb.MustAPIVersion(630)
|
fdb.MustAPIVersion(700)
|
||||||
|
|
||||||
db := fdb.MustOpenDefault()
|
db := fdb.MustOpenDefault()
|
||||||
|
|
||||||
|
|
|
@ -219,7 +219,7 @@ func (doc Doc) GetDoc(trtr fdb.Transactor, doc_id int) interface{} {
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
fdb.MustAPIVersion(630)
|
fdb.MustAPIVersion(700)
|
||||||
|
|
||||||
db := fdb.MustOpenDefault()
|
db := fdb.MustOpenDefault()
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ func (graph *Graph) get_in_neighbors(trtr fdb.Transactor, node int) ([]int, erro
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
fdb.MustAPIVersion(630)
|
fdb.MustAPIVersion(700)
|
||||||
|
|
||||||
db := fdb.MustOpenDefault()
|
db := fdb.MustOpenDefault()
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ func (wrkspc Workspace) Session(foo func(directory.DirectorySubspace)) (err erro
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
fdb.MustAPIVersion(630)
|
fdb.MustAPIVersion(700)
|
||||||
|
|
||||||
db := fdb.MustOpenDefault()
|
db := fdb.MustOpenDefault()
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@ func (multi MultiMap) MultiIsElement(trtr fdb.Transactor, index, value interface
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
fdb.MustAPIVersion(630)
|
fdb.MustAPIVersion(700)
|
||||||
|
|
||||||
db := fdb.MustOpenDefault()
|
db := fdb.MustOpenDefault()
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ func (prty Priority) Peek(trtr fdb.Transactor, max bool) interface{} {
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
fdb.MustAPIVersion(630)
|
fdb.MustAPIVersion(700)
|
||||||
|
|
||||||
db := fdb.MustOpenDefault()
|
db := fdb.MustOpenDefault()
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ func (q *Queue) FirstItem(trtr fdb.Transactor) (interface{}, error) {
|
||||||
func main() {
|
func main() {
|
||||||
fmt.Println("Queue Example Program")
|
fmt.Println("Queue Example Program")
|
||||||
|
|
||||||
fdb.MustAPIVersion(630)
|
fdb.MustAPIVersion(700)
|
||||||
|
|
||||||
db := fdb.MustOpenDefault()
|
db := fdb.MustOpenDefault()
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,7 @@ func (tbl Table) TableGetCol(tr fdb.ReadTransactor, col int) ([]interface{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
fdb.MustAPIVersion(630)
|
fdb.MustAPIVersion(700)
|
||||||
|
|
||||||
db := fdb.MustOpenDefault()
|
db := fdb.MustOpenDefault()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue