A CTDB_ON_RECORD_RESET callback is invoked when a record buffer is going inactive because the table is being closed. The handle passed as a parameter with this callback is a record handle and you can safely typecast the handle parameter to a pCTDBRECORD structure pointer.
The following CTDBRECORD structure members keep information regarding the record buffer kept by the record handle:
CTDBRECORD Structure Member |
Explanation |
---|---|
pUTEXT recbuf |
record buffer |
VRLEN recbuf_size |
size in bytes of memory allocated for record buffer |
VRLEN recbuf_len |
actual length of data in record buffer |
c-treeDB API C API Example
CTDBRET ctdbDECL OnRecordReset(CTHANDLE Handle)
{
CTDBRET Retval = CTDBRET_OK;
pCTDBRECORD pRecord = (pCTDBRECORD)Handle;
if (!pRecord)
Retval = CTDBRET_NOTRECORD;
else
{
/* release memory allocated for the localTag */
if (pRecord->localTag)
pRecord->pSession->onFree(pRecord->localTag);
pRecord->localTag = NULL;
}
return Retval;
}