MCPcopy Create free account
hub / github.com/OriginQ/QPanda-2 / bp__tree_read_head

Function bp__tree_read_head

ThirdParty/bplus-tree/src/bplus.cpp:365–388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

363/* internal utils */
364
365int bp__tree_read_head(bp__writer_t *w, void *data)
366{
367 int ret;
368 bp_db_t *t = (bp_db_t *) w;
369 bp__tree_head_t* head = (bp__tree_head_t *) data;
370
371 t->head.offset = myntohll(head->offset);
372 t->head.config = myntohll(head->config);
373 t->head.page_size = myntohll(head->page_size);
374 t->head.hash = myntohll(head->hash);
375
376 /* we've copied all data - free it */
377 free(data);
378
379 /* Check hash first */
380 if (bp__compute_hashl(t->head.offset) != t->head.hash) return 1;
381
382 ret = bp__page_load(t, t->head.offset, t->head.config, &t->head.page);
383 if (ret != BP_OK) return ret;
384
385 t->head.page->is_head = 1;
386
387 return ret;
388}
389
390int bp__tree_write_head(bp__writer_t *w, void *data)
391{

Callers

nothing calls this directly

Calls 3

myntohllFunction · 0.85
bp__compute_hashlFunction · 0.85
bp__page_loadFunction · 0.85

Tested by

no test coverage detected