9. Callback Interface#
9.1. CUObjIOOps Structure#
User-defined callback operations structure.
typedef struct CUObjIOOps {
ssize_t (*get)(const void* handle, char* ptr, size_t size, loff_t offset,
const cufileRDMAInfo_t* rdma_info);
ssize_t (*put)(const void* handle, const char* ptr, size_t size, loff_t offset,
const cufileRDMAInfo_t* rdma_info);
} CUObjOps_t;
9.2. GET Callback#
Called during a cuObjGet() operation to handle data retrieval.
ssize_t (*get)(const void* handle, char* ptr, size_t size, loff_t offset,
const cufileRDMAInfo_t* rdma_info);
Parameters:
handle: Cookie to user context. UsecuObjClient::getCtx(handle)to extract the context.ptr: Pointer to the memory chunk to be filled with data.size: Size of the memory chunk being read.offset: Starting object offset for this chunk.rdma_info: RDMA memory descriptor string for out-of-band communication.
Returns:
Size of data read on success.
Negative failure value on failure.
One of the retryable negative
errnovalues listed in the RDMA Multipathing section to allow retry on eligible failures.
Notes:
offsetis0whenMaxRequestCallbackSizeis greater than or equal to the total request size.sizeequals the total request size whenMaxRequestCallbackSizeis greater than or equal to the total request size.Multiple callbacks may be invoked for large requests.
The callback may be called from a thread other than the caller thread.
The callback must communicate with
cuObjServerusing the RDMA descriptor information.rdma_infoand the descriptor string it references are valid only for the duration of the callback invocation.
9.3. PUT Callback#
Called during a cuObjPut() operation to handle data transmission.
ssize_t (*put)(const void* handle, const char* ptr, size_t size, loff_t offset,
const cufileRDMAInfo_t* rdma_info);
Parameters:
handle: Cookie to user context. UsecuObjClient::getCtx(handle)to extract the context.ptr: Pointer to the memory chunk containing data to write.size: Size of the memory chunk being written.offset: Starting object offset for this chunk.rdma_info: RDMA memory descriptor string for out-of-band communication.
Returns:
Size of data written on success.
Negative failure value on failure.
One of the retryable negative
errnovalues listed in the RDMA Multipathing section to allow retry on eligible failures.
Notes:
offsetis0whenMaxRequestCallbackSizeis greater than or equal to the total request size.sizeequals the total request size whenMaxRequestCallbackSizeis greater than or equal to the total request size.Multiple callbacks may be invoked for large requests.
The callback may be called from a thread other than the caller thread.
The callback must communicate with
cuObjServerusing the RDMA descriptor information.rdma_infoand the descriptor string it references are valid only for the duration of the callback invocation.