mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-31 18:19:35 +08:00
Remove futureGetVersion in C binding and FutureVersion in Python binding
This commit is contained in:
parent
d5cc2beb5f
commit
14cb21285f
bindings
documentation/sphinx/source
fdbclient
@ -290,13 +290,13 @@ int64_t run_op_getreadversion(FDBTransaction *transaction) {
|
||||
} while (err && retry--);
|
||||
|
||||
if (err) {
|
||||
fprintf(stderr, "ERROR: fdb_transaction_get_version: %s\n", fdb_get_error(err));
|
||||
fprintf(stderr, "ERROR: fdb_transaction_get_read_version: %s\n", fdb_get_error(err));
|
||||
return -1;
|
||||
}
|
||||
|
||||
err = fdb_future_get_version(f, &rv);
|
||||
err = fdb_future_get_int64(f, &rv);
|
||||
if (err) {
|
||||
fprintf(stderr, "ERROR: fdb_future_get_version: %s\n", fdb_get_error(err));
|
||||
fprintf(stderr, "ERROR: fdb_future_get_int64: %s\n", fdb_get_error(err));
|
||||
}
|
||||
fdb_future_destroy(f);
|
||||
return rv;
|
||||
|
@ -224,7 +224,7 @@ void runTests(struct ResultSet *rs) {
|
||||
checkError(fdb_future_block_until_ready(f), "block for read version", rs);
|
||||
|
||||
int64_t version;
|
||||
checkError(fdb_future_get_version(f, &version), "get version", rs);
|
||||
checkError(fdb_future_get_int64(f, &version), "get version", rs);
|
||||
fdb_future_destroy(f);
|
||||
|
||||
insertData(tr);
|
||||
|
@ -405,7 +405,7 @@ class TransactionRead(_FDBBase):
|
||||
|
||||
def get_read_version(self):
|
||||
"""Get the read version of the transaction."""
|
||||
return FutureVersion(self.capi.fdb_transaction_get_read_version(self.tpointer))
|
||||
return FutureInt64(self.capi.fdb_transaction_get_read_version(self.tpointer))
|
||||
|
||||
def get(self, key):
|
||||
key = keyToBytes(key)
|
||||
@ -691,14 +691,6 @@ class FutureVoid(Future):
|
||||
return None
|
||||
|
||||
|
||||
class FutureVersion(Future):
|
||||
def wait(self):
|
||||
self.block_until_ready()
|
||||
version = ctypes.c_int64()
|
||||
self.capi.fdb_future_get_int64(self.fpointer, ctypes.byref(version))
|
||||
return version.value
|
||||
|
||||
|
||||
class FutureInt64(Future):
|
||||
def wait(self):
|
||||
self.block_until_ready()
|
||||
|
@ -289,12 +289,6 @@ See :ref:`developer-guide-programming-with-futures` for further (language-indepe
|
||||
|
||||
|future-get-return1|.
|
||||
|
||||
.. function:: fdb_error_t fdb_future_get_version(FDBFuture* future, int64_t* out_version)
|
||||
|
||||
Extracts a version from an :type:`FDBFuture` into a caller-provided variable of type ``int64_t``. |future-warning|
|
||||
|
||||
|future-get-return1| |future-get-return2|.
|
||||
|
||||
.. function:: fdb_error_t fdb_future_get_int64(FDBFuture* future, int64_t* out)
|
||||
|
||||
Extracts a 64-bit integer from an :type:`FDBFuture*` into a caller-provided variable of type ``int64_t``. |future-warning|
|
||||
@ -451,7 +445,7 @@ Applications must provide error handling and an appropriate retry loop around th
|
||||
|
||||
.. function:: FDBFuture* fdb_transaction_get_read_version(FDBTransaction* transaction)
|
||||
|
||||
|future-return0| the transaction snapshot read version. |future-return1| call :func:`fdb_future_get_version()` to extract the version into an int64_t that you provide, |future-return2|
|
||||
|future-return0| the transaction snapshot read version. |future-return1| call :func:`fdb_future_get_int64()` to extract the version into an int64_t that you provide, |future-return2|
|
||||
|
||||
The transaction obtains a snapshot read version automatically at the time of the first call to :func:`fdb_transaction_get_*()` (including this one) and (unless causal consistency has been deliberately compromised by transaction options) is guaranteed to represent all transactions which were reported committed before that call.
|
||||
|
||||
|
@ -47,7 +47,7 @@ ThreadFuture<Version> DLTransaction::getReadVersion() {
|
||||
|
||||
return toThreadFuture<Version>(api, f, [](FdbCApi::FDBFuture *f, FdbCApi *api) {
|
||||
int64_t version;
|
||||
FdbCApi::fdb_error_t error = api->futureGetVersion(f, &version);
|
||||
FdbCApi::fdb_error_t error = api->futureGetInt64(f, &version);
|
||||
ASSERT(!error);
|
||||
return version;
|
||||
});
|
||||
@ -309,8 +309,7 @@ void DLApi::init() {
|
||||
loadClientFunction(&api->transactionAddConflictRange, lib, fdbCPath, "fdb_transaction_add_conflict_range");
|
||||
|
||||
loadClientFunction(&api->futureGetDatabase, lib, fdbCPath, "fdb_future_get_database");
|
||||
loadClientFunction(&api->futureGetVersion, lib, fdbCPath, "fdb_future_get_version", headerVersion < 620);
|
||||
loadClientFunction(&api->futureGetInt64, lib, fdbCPath, "fdb_future_get_int64", headerVersion >= 620);
|
||||
loadClientFunction(&api->futureGetInt64, lib, fdbCPath, headerVersion >= 620 ? "fdb_future_get_int64" : "fdb_future_get_version");
|
||||
loadClientFunction(&api->futureGetError, lib, fdbCPath, "fdb_future_get_error");
|
||||
loadClientFunction(&api->futureGetKey, lib, fdbCPath, "fdb_future_get_key");
|
||||
loadClientFunction(&api->futureGetValue, lib, fdbCPath, "fdb_future_get_value");
|
||||
|
@ -95,7 +95,6 @@ struct FdbCApi : public ThreadSafeReferenceCounted<FdbCApi> {
|
||||
|
||||
//Future
|
||||
fdb_error_t (*futureGetDatabase)(FDBFuture *f, FDBDatabase **outDb);
|
||||
fdb_error_t (*futureGetVersion)(FDBFuture *f, int64_t *outVersion);
|
||||
fdb_error_t (*futureGetInt64)(FDBFuture *f, int64_t *outValue);
|
||||
fdb_error_t (*futureGetError)(FDBFuture *f);
|
||||
fdb_error_t (*futureGetKey)(FDBFuture *f, uint8_t const **outKey, int *outKeyLength);
|
||||
|
Loading…
x
Reference in New Issue
Block a user