40#define CALLBACK_ENTRY(id, callback) [id] = {.cb = &callback, .name = #callback}
96 elog(
ERROR,
"callback %d does not have a completion callback",
cb_id);
98 elog(
PANIC,
"too many callbacks, the max is %d",
104 "adding cb #%d, id %d/%s",
105 ioh->num_callbacks + 1,
108 ioh->num_callbacks++;
129 for (
int i = 0;
i <
len;
i++)
131 ioh->handle_data_len =
len;
147 for (
int i = 0;
i <
len;
i++)
149 ioh->handle_data_len =
len;
160 *
len =
ioh->handle_data_len;
181 if (
ce->cb->report ==
NULL)
182 elog(
ERROR,
"callback %d/%s does not have report callback",
183 result.
id,
ce->name);
185 ce->cb->report(result, target_data, elevel);
204 for (
int i =
ioh->num_callbacks;
i > 0;
i--)
214 "calling cb #%d %d/%s->stage(%u)",
243 for (
int i =
ioh->num_callbacks;
i > 0;
i--)
249 if (!
ce->cb->complete_shared)
253 "calling cb #%d, id %d/%s->complete_shared(%u) with distilled result: (status %s, id %u, error_data %d, result %d)",
264 ioh->distilled_result = result;
267 "after shared completion: distilled result: (status %s, id %u, error_data: %d, result %d), raw_result: %d",
295 result =
ioh->distilled_result;
298 for (
int i =
ioh->num_callbacks;
i > 0;
i--)
304 if (!
ce->cb->complete_local)
308 "calling cb #%d, id %d/%s->complete_local(%u) with distilled result: status %s, id %u, error_data %d, result %d",
325 "after local completion: result: (status %s, id %u, error_data %d, result %d), raw_result: %d",
const char * pgaio_result_status_string(PgAioResultStatus rs)
@ PGAIO_HCB_LOCAL_BUFFER_READV
@ PGAIO_HCB_SHARED_BUFFER_READV
#define PGAIO_HANDLE_MAX_CALLBACKS
void pgaio_io_call_stage(PgAioHandle *ioh)
static const PgAioHandleCallbacksEntry aio_handle_cbs[]
void pgaio_io_set_handle_data_32(PgAioHandle *ioh, uint32 *data, uint8 len)
PgAioResult pgaio_io_call_complete_local(PgAioHandle *ioh)
void pgaio_io_register_callbacks(PgAioHandle *ioh, PgAioHandleCallbackID cb_id, uint8 cb_data)
void pgaio_io_call_complete_shared(PgAioHandle *ioh)
uint64 * pgaio_io_get_handle_data(PgAioHandle *ioh, uint8 *len)
void pgaio_io_set_handle_data_64(PgAioHandle *ioh, uint64 *data, uint8 len)
static const PgAioHandleCallbacks aio_invalid_cb
#define CALLBACK_ENTRY(id, callback)
void pgaio_result_report(PgAioResult result, const PgAioTargetData *target_data, int elevel)
#define pgaio_debug_io(elevel, ioh, msg,...)
const PgAioHandleCallbacks aio_shared_buffer_readv_cb
const PgAioHandleCallbacks aio_local_buffer_readv_cb
#define Assert(condition)
const PgAioHandleCallbacks aio_md_readv_cb
#define START_CRIT_SECTION()
#define END_CRIT_SECTION()
const PgAioHandleCallbacks *const cb
PgAioHandleCallbackComplete complete_local