Improved comments

This commit is contained in:
Josh Slocum 2021-12-01 17:04:55 -06:00
parent a82845af43
commit c11b8a3625
5 changed files with 35 additions and 9 deletions

View File

@ -731,6 +731,7 @@ extern "C" DLLEXPORT FDBFuture* fdb_transaction_get_estimated_range_size_bytes(F
int begin_key_name_length,
uint8_t const* end_key_name,
int end_key_name_length) {
// FIXME: this can throw inverted_range()
KeyRangeRef range(KeyRef(begin_key_name, begin_key_name_length), KeyRef(end_key_name, end_key_name_length));
return (FDBFuture*)(TXN(tr)->getEstimatedRangeSizeBytes(range).extractPtr());
}
@ -741,6 +742,7 @@ extern "C" DLLEXPORT FDBFuture* fdb_transaction_get_range_split_points(FDBTransa
uint8_t const* end_key_name,
int end_key_name_length,
int64_t chunk_size) {
// FIXME: this can throw inverted_range()
KeyRangeRef range(KeyRef(begin_key_name, begin_key_name_length), KeyRef(end_key_name, end_key_name_length));
return (FDBFuture*)(TXN(tr)->getRangeSplitPoints(range, chunk_size).extractPtr());
}
@ -750,6 +752,7 @@ extern "C" DLLEXPORT FDBFuture* fdb_transaction_get_blob_granule_ranges(FDBTrans
int begin_key_name_length,
uint8_t const* end_key_name,
int end_key_name_length) {
// FIXME: this can throw inverted_range()
KeyRangeRef range(KeyRef(begin_key_name, begin_key_name_length), KeyRef(end_key_name, end_key_name_length));
return (FDBFuture*)(TXN(tr)->getBlobGranuleRanges(range).extractPtr());
}
@ -762,6 +765,7 @@ extern "C" DLLEXPORT FDBResult* fdb_transaction_read_blob_granules(FDBTransactio
int64_t beginVersion,
int64_t readVersion,
FDBReadBlobGranuleContext granule_context) {
// FIXME: this can throw inverted_range()
KeyRangeRef range(KeyRef(begin_key_name, begin_key_name_length), KeyRef(end_key_name, end_key_name_length));
// FIXME: better way to convert?

View File

@ -122,10 +122,17 @@ typedef struct keyrange {
#pragma pack(pop)
typedef struct readgranulecontext {
/* User context to pass along to functions */
void* userContext;
int64_t (*start_load_f)(const char*, int, int64_t, int64_t, void*);
uint8_t* (*get_load_f)(int64_t, void*);
void (*free_load_f)(int64_t, void*);
/* Returns a unique id for the load. Asynchronous to support queueing multiple in parallel. */
int64_t (*start_load_f)(const char* filename, int filenameLength, int64_t offset, int64_t length, void* context);
/* Returns data for the load. Pass the loadId returned by start_load_f */
uint8_t* (*get_load_f)(int64_t loadId, void* context);
/* Frees data from load. Pass the loadId returned by start_load_f */
void (*free_load_f)(int64_t loadId, void* context);
/* Set this to true for testing if you don't want to read the granule files,
just do the request to the blob workers */

View File

@ -1176,9 +1176,15 @@ inline bool isValidPerpetualStorageWiggleLocality(std::string locality) {
// matches what's in fdb_c.h
struct ReadBlobGranuleContext {
void* userContext;
int64_t (*start_load_f)(const char*, int, int64_t, int64_t, void*);
uint8_t* (*get_load_f)(int64_t, void*);
void (*free_load_f)(int64_t, void*);
// Returns a unique id for the load. Asynchronous to support queueing multiple in parallel.
int64_t (*start_load_f)(const char* filename, int filenameLength, int64_t offset, int64_t length, void* context);
// Returns data for the load. Pass the loadId returned by start_load_f
uint8_t* (*get_load_f)(int64_t loadId, void* context);
// Frees data from load. Pass the loadId returned by start_load_f
void (*free_load_f)(int64_t loadId, void* context);
// Set this to true for testing if you don't want to read the granule files,
// just do the request to the blob workers
bool debugNoMaterialize;

View File

@ -241,6 +241,7 @@ ThreadFuture<Standalone<VectorRef<KeyRef>>> DLTransaction::getRangeSplitPoints(c
int keysArrayLength;
FdbCApi::fdb_error_t error = api->futureGetKeyArray(f, &splitKeys, &keysArrayLength);
ASSERT(!error);
// The memory for this is stored in the FDBFuture and is released when the future gets destroyed
return Standalone<VectorRef<KeyRef>>(VectorRef<KeyRef>((KeyRef*)splitKeys, keysArrayLength), Arena());
});
}
@ -257,6 +258,7 @@ ThreadFuture<Standalone<VectorRef<KeyRangeRef>>> DLTransaction::getBlobGranuleRa
int keyRangesLength;
FdbCApi::fdb_error_t error = api->futureGetKeyRangeArray(f, &keyRanges, &keyRangesLength);
ASSERT(!error);
// The memory for this is stored in the FDBFuture and is released when the future gets destroyed
return Standalone<VectorRef<KeyRangeRef>>(VectorRef<KeyRangeRef>((KeyRangeRef*)keyRanges, keyRangesLength),
Arena());
});

View File

@ -62,9 +62,16 @@ struct FdbCApi : public ThreadSafeReferenceCounted<FdbCApi> {
typedef struct readgranulecontext {
void* userContext;
int64_t (*start_load_f)(const char*, int, int64_t, int64_t, void*);
uint8_t* (*get_load_f)(int64_t, void*);
void (*free_load_f)(int64_t, void*);
// Returns a unique id for the load. Asynchronous to support queueing multiple in parallel.
int64_t (
*start_load_f)(const char* filename, int filenameLength, int64_t offset, int64_t length, void* context);
// Returns data for the load. Pass the loadId returned by start_load_f
uint8_t* (*get_load_f)(int64_t loadId, void* context);
// Frees data from load. Pass the loadId returned by start_load_f
void (*free_load_f)(int64_t loadId, void* context);
// set this to true for testing if you don't want to read the granule files, just
// do the request to the blob workers
fdb_bool_t debugNoMaterialize;