(bytes: Uint8Array)
| 395 | * - _pad0: u32 (bytes 28-31) |
| 396 | */ |
| 397 | export function parseQueryResult(bytes: Uint8Array): DebugParseResult<DebugQueryResult> { |
| 398 | if (bytes.byteLength < DEBUG_QUERY_RESULT_SIZE) { |
| 399 | return fail( |
| 400 | "ZR_TRUNCATED", |
| 401 | 0, |
| 402 | `need ${DEBUG_QUERY_RESULT_SIZE} bytes for query result but only ${bytes.byteLength} available`, |
| 403 | ); |
| 404 | } |
| 405 | |
| 406 | const r = new BinaryReader(bytes); |
| 407 | |
| 408 | const recordsReturned = r.readU32(); |
| 409 | const recordsAvailable = r.readU32(); |
| 410 | const oldestRecordId = readU64(r); |
| 411 | const newestRecordId = readU64(r); |
| 412 | const recordsDropped = r.readU32(); |
| 413 | // Skip _pad0 |
| 414 | |
| 415 | return { |
| 416 | ok: true, |
| 417 | value: { |
| 418 | recordsReturned, |
| 419 | recordsAvailable, |
| 420 | oldestRecordId, |
| 421 | newestRecordId, |
| 422 | recordsDropped, |
| 423 | }, |
| 424 | }; |
| 425 | } |
| 426 | |
| 427 | /** |
| 428 | * Parse debug statistics. |
no test coverage detected