Skip to content
File

Blob: src/worker/git/object-store/types.ts

typescript37 lines
1import type { GitObjectType } from "@/worker/git/core";
2export type { PackCatalogRow } from "@/worker/do/repo/db/schema";
3 
4export type PackedObjectLocation = {
5 packKey: string;
6 objectIndex: number;
7 offset: number;
8 nextOffset: number;
9};
10 
11export type PackedObjectResult = PackedObjectLocation & {
12 oid: string;
13 type: GitObjectType;
14 payload: Uint8Array;
15};
16 
17export type PackedObjectReadResult = PackedObjectResult | undefined;
18 
19export type IdxView = {
20 packKey: string;
21 count: number;
22 fanout: Uint32Array;
23 rawNames: Uint8Array;
24 offsets: Float64Array;
25 /** Start of the next pack entry for each object index; last entry points at the pack trailer. */
26 nextOffsetByIndex: Float64Array;
27 /** Pack offsets sorted ascending, paired with sortedOffsetIndices for binary search. */
28 sortedOffsets: Float64Array;
29 /** Entry indices corresponding to each element of sortedOffsets. */
30 sortedOffsetIndices: Uint32Array;
31 packSize: number;
32 /** Pack checksum copied from the `.idx` trailer. */
33 packChecksum: Uint8Array;
34 /** Checksum of the `.idx` contents before its final checksum field. */
35 idxChecksum: Uint8Array;
36};