Skip to content

Commit

Permalink
Implement type conversion for simple types
Browse files Browse the repository at this point in the history
  • Loading branch information
mattjala committed Oct 10, 2023
1 parent 05531c7 commit 3dc9833
Show file tree
Hide file tree
Showing 5 changed files with 720 additions and 79 deletions.
6 changes: 4 additions & 2 deletions src/rest_vol.c
Original file line number Diff line number Diff line change
Expand Up @@ -3527,8 +3527,9 @@ RV_get_index_of_matching_handle(dataset_transfer_info *transfer_info, size_t cou

herr_t
RV_curl_multi_perform(CURL *curl_multi_handle, dataset_transfer_info *transfer_info, size_t count,
herr_t(success_callback)(hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id,
void *buf, struct response_buffer resp_buffer))
herr_t(success_callback)(hid_t mem_type_id, hid_t mem_space_id, hid_t file_type_id,
hid_t file_space_id, void *buf,
struct response_buffer resp_buffer))
{

herr_t ret_value = SUCCEED;
Expand Down Expand Up @@ -3659,6 +3660,7 @@ RV_curl_multi_perform(CURL *curl_multi_handle, dataset_transfer_info *transfer_i

if (success_callback(
transfer_info[handle_index].mem_type_id, transfer_info[handle_index].mem_space_id,
transfer_info[handle_index].file_type_id,
transfer_info[handle_index].file_space_id, transfer_info[handle_index].buf,
transfer_info[handle_index].resp_buffer) < 0)
FUNC_GOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL,
Expand Down
22 changes: 21 additions & 1 deletion src/rest_vol.h
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,13 @@ typedef struct dataset_transfer_info {
hid_t mem_type_id;
hid_t mem_space_id;
hid_t file_space_id;
hid_t file_type_id;
char *selection_body;

/* Fields for type conversion */
void *tconv_buf;
void *bkg_buf;

transfer_type_t transfer_type;

union {
Expand Down Expand Up @@ -643,6 +648,13 @@ typedef struct loc_info {
RV_object_t *domain;
} loc_info;

/* Enum to indicate if the supplied read buffer can be used as a type conversion or background buffer */
typedef enum {
RV_TCONV_REUSE_NONE, /* Cannot reuse buffer */
RV_TCONV_REUSE_TCONV, /* Use buffer as type conversion buffer */
RV_TCONV_REUSE_BKG /* Use buffer as background buffer */
} RV_tconv_reuse_t;

/****************************
* *
* Prototypes *
Expand Down Expand Up @@ -718,9 +730,17 @@ void RV_free_visited_link_hash_table_key(rv_hash_table_key_t value);
* and waits until all requests on it have finished before returning. */
herr_t RV_curl_multi_perform(CURL *curl_multi_ptr, dataset_transfer_info *transfer_info, size_t count,
herr_t(success_callback)(hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, void *buf,
hid_t file_type_id, hid_t file_space_id, void *buf,
struct response_buffer resp_buffer));

/* Dtermine if datatype conversion is necessary */
htri_t RV_need_tconv(hid_t src_type_id, hid_t dst_type_id);

/* Initialize variables and buffers used for type conversion */
herr_t RV_tconv_init(hid_t src_type_id, size_t *src_type_size, hid_t dst_type_id, size_t *dst_type_size,
size_t num_elem, hbool_t clear_tconv_buf, hbool_t dst_file, void **tconv_buf,
void **bkg_buf, RV_tconv_reuse_t *reuse, hbool_t *fill_bkg);

#define SERVER_VERSION_MATCHES_OR_EXCEEDS(version, major_needed, minor_needed, patch_needed) \
(version.major > major_needed) || (version.major == major_needed && version.minor > minor_needed) || \
(version.major == major_needed && version.minor == minor_needed && version.patch >= patch_needed)
Expand Down
Loading

0 comments on commit 3dc9833

Please sign in to comment.