Added API doc for the new range split API. Updated some old ones to be consistent.
This commit is contained in:
parent
5d902f9177
commit
079f27d47d
|
@ -87,7 +87,7 @@ func (s Snapshot) GetDatabase() Database {
|
|||
return s.transaction.db
|
||||
}
|
||||
|
||||
// GetEstimatedRangeSizeBytes will get an estimate for the number of bytes
|
||||
// GetEstimatedRangeSizeBytes returns an estimate for the number of bytes
|
||||
// stored in the given range.
|
||||
func (s Snapshot) GetEstimatedRangeSizeBytes(r ExactRange) FutureInt64 {
|
||||
beginKey, endKey := r.FDBRangeKeys()
|
||||
|
@ -97,8 +97,9 @@ func (s Snapshot) GetEstimatedRangeSizeBytes(r ExactRange) FutureInt64 {
|
|||
)
|
||||
}
|
||||
|
||||
// GetRangeSplitPoints will return a list of keys that can divide the given range into
|
||||
// chunks based on the chunk size provided.
|
||||
// GetRangeSplitPoints returns a list of keys that can split the given range
|
||||
// into (roughly)equally sized chunks based on chunkSize.
|
||||
// Note: the returned split points contain the start key and end key of the given range.
|
||||
func (s Snapshot) GetRangeSplitPoints(r ExactRange, chunkSize int64) FutureKeyArray {
|
||||
beginKey, endKey := r.FDBRangeKeys()
|
||||
return s.getRangeSplitPoints(
|
||||
|
|
|
@ -319,7 +319,7 @@ func (t *transaction) getEstimatedRangeSizeBytes(beginKey Key, endKey Key) Futur
|
|||
}
|
||||
}
|
||||
|
||||
// GetEstimatedRangeSizeBytes will get an estimate for the number of bytes
|
||||
// GetEstimatedRangeSizeBytes returns an estimate for the number of bytes
|
||||
// stored in the given range.
|
||||
// Note: the estimated size is calculated based on the sampling done by FDB server. The sampling
|
||||
// algorithm works roughly in this way: the larger the key-value pair is, the more likely it would
|
||||
|
@ -348,8 +348,9 @@ func (t *transaction) getRangeSplitPoints(beginKey Key, endKey Key, chunkSize in
|
|||
}
|
||||
}
|
||||
|
||||
// GetRangeSplitPoints will return a list of keys that can divide the given range into
|
||||
// chunks based on the chunk size provided.
|
||||
// GetRangeSplitPoints returns a list of keys that can split the given range
|
||||
// into (roughly)equally sized chunks based on chunkSize.
|
||||
// Note: the returned split points contain the start key and end key of the given range.
|
||||
func (t Transaction) GetRangeSplitPoints(r ExactRange, chunkSize int64) FutureKeyArray {
|
||||
beginKey, endKey := r.FDBRangeKeys()
|
||||
return t.getRangeSplitPoints(
|
||||
|
|
|
@ -456,7 +456,8 @@ public interface ReadTransaction extends ReadTransactionContext {
|
|||
CompletableFuture<Long> getEstimatedRangeSizeBytes(Range range);
|
||||
|
||||
/**
|
||||
* Gets a list of keys that can split the given range into similar sized chunks based on chunkSize
|
||||
* Gets a list of keys that can split the given range into (roughly)equally sized chunks based on chunkSize.
|
||||
* Note: the returned split points contain the start key and end key of the given range.
|
||||
*
|
||||
* @param begin the beginning of the range (inclusive)
|
||||
* @param end the end of the range (exclusive)
|
||||
|
@ -466,7 +467,8 @@ public interface ReadTransaction extends ReadTransactionContext {
|
|||
CompletableFuture<KeyArrayResult> getRangeSplitPoints(byte[] begin, byte[] end, long chunkSize);
|
||||
|
||||
/**
|
||||
* Gets a list of keys that can split the given range into similar sized chunks based on chunkSize
|
||||
* Gets a list of keys that can split the given range into (roughly)equally sized chunks based on chunkSize
|
||||
* Note: the returned split points contain the start key and end key of the given range.
|
||||
*
|
||||
* @param range the range of the keys
|
||||
*
|
||||
|
|
|
@ -301,6 +301,12 @@ See :ref:`developer-guide-programming-with-futures` for further (language-indepe
|
|||
|
||||
|future-get-return1| |future-get-return2|.
|
||||
|
||||
.. function:: fdb_error_t fdb_future_get_key_array( FDBFuture* f, FDBKey const** out_key_array, int* out_count)
|
||||
|
||||
Extracts an array of :type:`FDBKey` from an :type:`FDBFuture*` into a caller-provided variable of type ``FDBKey*``. The size of the array will also be extracted and passed back by a caller-provided variable of type ``int`` |future-warning|
|
||||
|
||||
|future-get-return1| |future-get-return2|.
|
||||
|
||||
.. function:: fdb_error_t fdb_future_get_key(FDBFuture* future, uint8_t const** out_key, int* out_key_length)
|
||||
|
||||
Extracts a key from an :type:`FDBFuture` into caller-provided variables of type ``uint8_t*`` (a pointer to the beginning of the key) and ``int`` (the length of the key). |future-warning|
|
||||
|
@ -480,6 +486,12 @@ Applications must provide error handling and an appropriate retry loop around th
|
|||
|
||||
|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_range_split_points( FDBTransaction* tr, uint8_t const* begin_key_name, int begin_key_name_length, uint8_t const* end_key_name, int end_key_name_length, int64_t chunkSize)
|
||||
Returns a list of keys that can split the given range into (roughly)equally sized chunks based on chunkSize.
|
||||
.. note:: The returned split points contain the start key and end key of the given range
|
||||
|
||||
|future-return0| the list of split points. |future-return1| call :func:`fdb_future_get_key_array()` to extract the array, |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``.
|
||||
|
|
|
@ -799,9 +799,15 @@ 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`.
|
||||
Gets the estimated byte size of the given key range. Returns a :class:`FutureInt64`.
|
||||
.. note:: The estimated size is calculated based on the sampling done by FDB server. The sampling algorithm works roughly in this way: the larger the key-value pair is, the more likely it would be sampled and the more accurate its sampled size would be. And due to that reason it is recommended to use this API to query against large ranges for accuracy considerations. For a rough reference, if the returned size is larger than 3MB, one can consider the size to be accurate.
|
||||
|
||||
.. method:: Transaction.get_range_split_points(self, begin_key, end_key, chunk_size)
|
||||
|
||||
Gets a list of keys that can split the given range into (roughly)equally sized chunks based on chunkSize. Returns a :class:`FutureKeyArray`.
|
||||
.. note:: The returned split points contain the start key and end key of the given range
|
||||
|
||||
|
||||
.. _api-python-transaction-options:
|
||||
|
||||
Transaction misc functions
|
||||
|
|
|
@ -741,11 +741,16 @@ Most applications should use the read version that FoundationDB determines autom
|
|||
Transaction misc functions
|
||||
--------------------------
|
||||
|
||||
.. method:: Transaction.get_estimated_range_size_bytes(begin_key, end_key)
|
||||
.. method:: Transaction.get_estimated_range_size_bytes(begin_key, end_key) -> Int64Future
|
||||
|
||||
Get the estimated byte size of the given key range. Returns a :class:`Int64Future`.
|
||||
Gets the estimated byte size of the given key range. Returns a :class:`Int64Future`.
|
||||
.. note:: The estimated size is calculated based on the sampling done by FDB server. The sampling algorithm works roughly in this way: the larger the key-value pair is, the more likely it would be sampled and the more accurate its sampled size would be. And due to that reason it is recommended to use this API to query against large ranges for accuracy considerations. For a rough reference, if the returned size is larger than 3MB, one can consider the size to be accurate.
|
||||
|
||||
.. method:: Transaction.get_range_split_points(begin_key, end_key, chunk_size) -> FutureKeyArray
|
||||
|
||||
Gets a list of keys that can split the given range into (roughly)equally sized chunks based on chunkSize. Returns a :class:`FutureKeyArray`.
|
||||
.. note:: The returned split points contain the start key and end key of the given range
|
||||
|
||||
.. method:: Transaction.get_approximate_size() -> Int64Future
|
||||
|
||||
|transaction-get-approximate-size-blurb|. Returns a :class:`Int64Future`.
|
||||
|
|
Loading…
Reference in New Issue