MCPcopy Create free account
hub / github.com/defold/defold / WriteEntry

Function WriteEntry

engine/dlib/src/dlib/http_cache.cpp:295–326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

293 };
294
295 static void WriteEntry(WriteEntryContext* context, const uint64_t* key, Entry* entry)
296 {
297 if (context->m_Error)
298 return;
299
300 if(entry->m_WriteLock)
301 {
302 dmLogWarning("Invalid http cache state. Not yet flushed cache entry (etag: %s).", entry->m_Info.m_ETag);
303 return;
304 }
305
306 FileEntry file_entry;
307 memset(&file_entry, 0, sizeof(file_entry));
308
309 file_entry.m_UriHash = *key;
310 memcpy(file_entry.m_ETag, entry->m_Info.m_ETag, sizeof(file_entry.m_ETag));
311 dmStrlCpy(file_entry.m_URI, entry->m_Info.m_URI, sizeof(file_entry.m_URI));
312 file_entry.m_IdentifierHash = entry->m_Info.m_IdentifierHash;
313 file_entry.m_LastAccessed = entry->m_Info.m_LastAccessed;
314 file_entry.m_Expires = entry->m_Info.m_Expires;
315 file_entry.m_Checksum = entry->m_Info.m_Checksum;
316 file_entry.m_RangeStart = entry->m_Info.m_RangeStart;
317 file_entry.m_RangeEnd = entry->m_Info.m_RangeEnd;
318 file_entry.m_DocumentSize = entry->m_Info.m_DocumentSize;
319
320 dmHashUpdateBuffer64(&context->m_HashState, &file_entry, sizeof(file_entry));
321 size_t n_written = fwrite(&file_entry, 1, sizeof(file_entry), context->m_File);
322 if (n_written != sizeof(file_entry))
323 {
324 context->m_Error = true;
325 }
326 }
327
328 static Result WriteIndex(HCache cache, FILE* f)
329 {

Callers

nothing calls this directly

Calls 2

dmStrlCpyFunction · 0.85
dmHashUpdateBuffer64Function · 0.85

Tested by

no test coverage detected