Data source template used to upload object data to the cluster.
typedef long (*read_from_data_source) (void *cookie, char *buf, long buf_size);
Function pointers of read_from_data_source type are used to upload object data. The function pointer and opaque cookie reference are supplied as arguments to hc_store_both_ez and other functions that store object data. The data source reader function will be called repeatedly, with the supplied cookie as an argument, to gather the object data to upload into storage.
A read_from_data_source function should read up to buf_size bytes from the data source indicated by cookie into the buffer at location buff and return the actual number of bytes read as the return value from the function.
There are two special return codes:
A return value of 0 indicates the end-of-file condition. The data should be committed to the data store.
A return value of -1 indicates a request to cancel the store. The store operation should be aborted with an error code of HCERR_ABORTED_BY_CALLBACK.
An opaque data structure to identify this data cookie. The cookie is likely to be an open file descriptor.
Where to store the data.
The number of available bytes of space in buf.