MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / query

Function query

packages/core/src/debug/debugController.ts:436–470  ·  view source on GitHub ↗
(filter?: DebugQuery)

Source from the content-addressed store, hash-verified

434 }
435
436 async function query(filter?: DebugQuery): Promise<readonly DebugRecord[]> {
437 const { headers, result } = await backend.debugQuery(filter ?? {});
438
439 if (result.recordsReturned === 0) {
440 return [];
441 }
442
443 const records: DebugRecord[] = [];
444
445 for (let i = 0; i < result.recordsReturned; i++) {
446 const offset = i * DEBUG_RECORD_HEADER_SIZE;
447 const headerResult = parseRecordHeader(headers, offset);
448
449 if (!headerResult.ok) {
450 continue;
451 }
452
453 const header = headerResult.value;
454 let payload: DebugPayload | null = null;
455
456 if (header.payloadSize > 0) {
457 const payloadBytes = await backend.debugGetPayload(header.recordId);
458 if (payloadBytes) {
459 const payloadResult = parsePayload(header.category, payloadBytes);
460 if (payloadResult.ok) {
461 payload = payloadResult.value;
462 }
463 }
464 }
465
466 records.push({ header, payload });
467 }
468
469 return records;
470 }
471
472 async function getPayload<T extends DebugPayload>(recordId: bigint): Promise<T | null> {
473 const bytes = await backend.debugGetPayload(recordId);

Callers

nothing calls this directly

Calls 5

parseRecordHeaderFunction · 0.85
parsePayloadFunction · 0.85
debugQueryMethod · 0.80
debugGetPayloadMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected