MCPcopy Create free account
hub / github.com/apache/trafficserver / RecMessageWriteToDisk

Function RecMessageWriteToDisk

src/records/RecMessage.cc:286–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284//-------------------------------------------------------------------------
285
286int
287RecMessageWriteToDisk(RecMessage *msg, const char *fpath)
288{
289 int msg_size;
290 RecHandle h_file;
291 int bytes_written;
292
293 // Cap the message (e.g. when we read it, o_end should reflect the
294 // size of the new buffer that we write to disk, not the size of the
295 // buffer in memory).
296 msg->o_end = msg->o_write;
297
298 msg_size = sizeof(RecMessageHdr) + (msg->o_write - msg->o_start);
299 if ((h_file = RecFileOpenW(fpath)) != REC_HANDLE_INVALID) {
300 if (RecSnapFileWrite(h_file, reinterpret_cast<char *>(msg), msg_size, &bytes_written) == REC_ERR_FAIL) {
301 RecFileClose(h_file);
302 return REC_ERR_FAIL;
303 }
304 RecFileClose(h_file);
305 }
306
307 return REC_ERR_OKAY;
308}

Callers 1

RecSyncStatsFileFunction · 0.85

Calls 3

RecFileOpenWFunction · 0.85
RecSnapFileWriteFunction · 0.85
RecFileCloseFunction · 0.85

Tested by

no test coverage detected