Merge pull request #2854 from dongxinEric/doc/update-api-docs-for-getEstimatedRangeBytes
Doc/update api docs for get estimated range bytes
This commit is contained in:
commit
0547cf2b4c
|
@ -318,8 +318,8 @@ func (t *transaction) getEstimatedRangeSizeBytes(beginKey Key, endKey Key) Futur
|
|||
}
|
||||
}
|
||||
|
||||
// GetEstimatedRangeSizeBytes will get the byte size of the key range based on the
|
||||
// byte sample collected by FDB
|
||||
// GetEstimatedRangeSizeBytes will get an estimate for the number of bytes
|
||||
// stored in the given range.
|
||||
func (t Transaction) GetEstimatedRangeSizeBytes(r ExactRange) FutureInt64 {
|
||||
beginKey, endKey := r.FDBRangeKeys()
|
||||
return t.getEstimatedRangeSizeBytes(
|
||||
|
|
|
@ -450,15 +450,15 @@ class TransactionRead(_FDBBase):
|
|||
return self.get_range(key.start, key.stop, reverse=(key.step == -1))
|
||||
return self.get(key)
|
||||
|
||||
def get_estimated_range_size_bytes(self, beginKey, endKey):
|
||||
if beginKey is None:
|
||||
beginKey = b''
|
||||
if endKey is None:
|
||||
endKey = b'\xff'
|
||||
def get_estimated_range_size_bytes(self, begin_key, end_key):
|
||||
if begin_key is None:
|
||||
begin_key = b''
|
||||
if end_key is None:
|
||||
end_key = b'\xff'
|
||||
return FutureInt64(self.capi.fdb_transaction_get_estimated_range_size_bytes(
|
||||
self.tpointer,
|
||||
beginKey, len(beginKey),
|
||||
endKey, len(endKey)
|
||||
begin_key, len(begin_key),
|
||||
end_key, len(end_key)
|
||||
))
|
||||
|
||||
|
||||
|
|
|
@ -819,9 +819,9 @@ module FDB
|
|||
get_range(prefix, FDB.strinc(prefix), options, &block)
|
||||
end
|
||||
|
||||
def get_estimated_range_size_bytes(beginKey, endKey)
|
||||
bkey = FDB.key_to_bytes(beginKey)
|
||||
ekey = FDB.key_to_bytes(endKey)
|
||||
def get_estimated_range_size_bytes(begin_key, end_key)
|
||||
bkey = FDB.key_to_bytes(begin_key)
|
||||
ekey = FDB.key_to_bytes(end_key)
|
||||
Int64Future.new(FDBC.fdb_transaction_get_estimated_range_size_bytes(@tpointer, bkey, bkey.bytesize, ekey, ekey.bytesize))
|
||||
end
|
||||
|
||||
|
|
|
@ -474,6 +474,11 @@ Applications must provide error handling and an appropriate retry loop around th
|
|||
``snapshot``
|
||||
|snapshot|
|
||||
|
||||
.. function:: FDBFuture* fdb_transaction_get_estimated_range_size_bytes( FDBTransaction* tr, uint8_t const* begin_key_name, int begin_key_name_length, uint8_t const* end_key_name, int end_key_name_length)
|
||||
Returns an estimated byte size of the key range.
|
||||
|
||||
|future-return0| the estimated size of the key range given. |future-return1| call :func:`fdb_future_get_int64()` to extract the size, |future-return2|
|
||||
|
||||
.. function:: FDBFuture* fdb_transaction_get_key(FDBTransaction* transaction, uint8_t const* key_name, int key_name_length, fdb_bool_t or_equal, int offset, fdb_bool_t snapshot)
|
||||
|
||||
Resolves a :ref:`key selector <key-selectors>` against the keys in the database snapshot represented by ``transaction``.
|
||||
|
|
|
@ -796,6 +796,13 @@ Most applications should use the read version that FoundationDB determines autom
|
|||
|
||||
|infrequent| |transaction-get-versionstamp-blurb|
|
||||
|
||||
Transaction misc functions
|
||||
--------------------------
|
||||
|
||||
.. method:: Transaction.get_estimated_range_size_bytes(begin_key, end_key)
|
||||
|
||||
Get the estimated byte size of the given key range. Returns a :class:`FutureInt64`.
|
||||
|
||||
.. _api-python-transaction-options:
|
||||
|
||||
Transaction options
|
||||
|
@ -962,9 +969,9 @@ Asynchronous methods return one of the following subclasses of :class:`Future`:
|
|||
|
||||
Represents a future string object and responds to the same methods as string in Python. They may be passed to FoundationDB methods that expect a string.
|
||||
|
||||
.. class:: FutureVersion
|
||||
.. class:: FutureInt64
|
||||
|
||||
Represents a future version (integer). You must call the :meth:`Future.wait()` method on this object to retrieve the version as an integer.
|
||||
Represents a future integer. You must call the :meth:`Future.wait()` method on this object to retrieve the integer.
|
||||
|
||||
.. class:: FutureStringArray
|
||||
|
||||
|
|
|
@ -519,7 +519,7 @@ Snapshot reads
|
|||
|
||||
Like :meth:`Transaction.get_range_start_with`, but as a snapshot read.
|
||||
|
||||
.. method:: Transaction.snapshot.get_read_version() -> Version
|
||||
.. method:: Transaction.snapshot.get_read_version() -> Int64Future
|
||||
|
||||
Identical to :meth:`Transaction.get_read_version` (since snapshot and strictly serializable reads use the same read version).
|
||||
|
||||
|
@ -728,7 +728,7 @@ Most applications should use the read version that FoundationDB determines autom
|
|||
|
||||
|infrequent| Sets the database version that the transaction will read from the database. The database cannot guarantee causal consistency if this method is used (the transaction's reads will be causally consistent only if the provided read version has that property).
|
||||
|
||||
.. method:: Transaction.get_read_version() -> Version
|
||||
.. method:: Transaction.get_read_version() -> Int64Future
|
||||
|
||||
|infrequent| Returns the transaction's read version.
|
||||
|
||||
|
@ -740,6 +740,13 @@ Most applications should use the read version that FoundationDB determines autom
|
|||
|
||||
|infrequent| |transaction-get-versionstamp-blurb|
|
||||
|
||||
Transaction misc functions
|
||||
--------------------------
|
||||
|
||||
.. method:: Transaction.get_estimated_range_size_bytes(begin_key, end_key)
|
||||
|
||||
Get the estimated byte size of the given key range. Returns a :class:`Int64Future`.
|
||||
|
||||
Transaction options
|
||||
-------------------
|
||||
|
||||
|
@ -946,7 +953,7 @@ Asynchronous methods return one of the following subclasses of :class:`Future`:
|
|||
|
||||
An implementation quirk of :class:`Value` is that it will never evaluate to ``false``, even if its value is ``nil``. It is important to use ``if value.nil?`` rather than ``if ~value`` when checking to see if a key was not present in the database.
|
||||
|
||||
.. class:: Version
|
||||
.. class:: Int64Future
|
||||
|
||||
This type is a future :class:`Integer` object. Objects of this type respond to the same methods as objects of type :class:`Integer`, and may be passed to any method that expects a :class:`Integer`.
|
||||
|
||||
|
@ -962,6 +969,7 @@ Asynchronous methods return one of the following subclasses of :class:`Future`:
|
|||
|
||||
For a :class:`FutureNil` object returned by :meth:`Transaction.commit` or :meth:`Transaction.on_error`, you must call :meth:`FutureNil.wait`, which will return ``nil`` if the operation succeeds or raise an :exc:`FDB::Error` if an error occurred. Failure to call :meth:`FutureNil.wait` on a returned :class:`FutureNil` object means that any potential errors raised by the asynchronous operation that returned the object *will not be seen*, and represents a significant error in your code.
|
||||
|
||||
|
||||
.. _ruby streaming mode:
|
||||
|
||||
Streaming modes
|
||||
|
|
Loading…
Reference in New Issue