diff --git a/src/format/flatbuffers/generated/array-manifest.ts b/src/format/flatbuffers/generated/array-manifest.ts index d4ab8d4..3487a53 100644 --- a/src/format/flatbuffers/generated/array-manifest.ts +++ b/src/format/flatbuffers/generated/array-manifest.ts @@ -47,4 +47,27 @@ export class ArrayManifest { const offset = this.bb!.__offset(this.bb_pos, 6); return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; } + + extra(index: number): number | null { + const offset = this.bb!.__offset(this.bb_pos, 8); + return offset + ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) + : 0; + } + + extraLength(): number { + const offset = this.bb!.__offset(this.bb_pos, 8); + return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; + } + + extraArray(): Uint8Array | null { + const offset = this.bb!.__offset(this.bb_pos, 8); + return offset + ? new Uint8Array( + this.bb!.bytes().buffer, + this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), + this.bb!.__vector_len(this.bb_pos + offset), + ) + : null; + } } diff --git a/src/format/flatbuffers/generated/array-node-data.ts b/src/format/flatbuffers/generated/array-node-data.ts index 1b5afb4..9914fdf 100644 --- a/src/format/flatbuffers/generated/array-node-data.ts +++ b/src/format/flatbuffers/generated/array-node-data.ts @@ -4,6 +4,7 @@ import * as flatbuffers from "flatbuffers"; import { DimensionName } from "../generated/dimension-name.js"; import { DimensionShape } from "../generated/dimension-shape.js"; +import { DimensionShapeV2 } from "../generated/dimension-shape-v2.js"; import { ManifestRef } from "../generated/manifest-ref.js"; export class ArrayNodeData { @@ -73,4 +74,21 @@ export class ArrayNodeData { const offset = this.bb!.__offset(this.bb_pos, 8); return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; } + + shapeV2(index: number, obj?: DimensionShapeV2): DimensionShapeV2 | null { + const offset = this.bb!.__offset(this.bb_pos, 10); + return offset + ? (obj || new DimensionShapeV2()).__init( + this.bb!.__indirect( + this.bb!.__vector(this.bb_pos + offset) + index * 4, + ), + this.bb!, + ) + : null; + } + + shapeV2Length(): number { + const offset = this.bb!.__offset(this.bb_pos, 10); + return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; + } } diff --git a/src/format/flatbuffers/generated/chunk-ref.ts b/src/format/flatbuffers/generated/chunk-ref.ts index 83a3337..449250e 100644 --- a/src/format/flatbuffers/generated/chunk-ref.ts +++ b/src/format/flatbuffers/generated/chunk-ref.ts @@ -110,4 +110,50 @@ export class ChunkRef { const offset = this.bb!.__offset(this.bb_pos, 18); return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0; } + + compressedLocation(index: number): number | null { + const offset = this.bb!.__offset(this.bb_pos, 20); + return offset + ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) + : 0; + } + + compressedLocationLength(): number { + const offset = this.bb!.__offset(this.bb_pos, 20); + return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; + } + + compressedLocationArray(): Uint8Array | null { + const offset = this.bb!.__offset(this.bb_pos, 20); + return offset + ? new Uint8Array( + this.bb!.bytes().buffer, + this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), + this.bb!.__vector_len(this.bb_pos + offset), + ) + : null; + } + + extra(index: number): number | null { + const offset = this.bb!.__offset(this.bb_pos, 22); + return offset + ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) + : 0; + } + + extraLength(): number { + const offset = this.bb!.__offset(this.bb_pos, 22); + return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; + } + + extraArray(): Uint8Array | null { + const offset = this.bb!.__offset(this.bb_pos, 22); + return offset + ? new Uint8Array( + this.bb!.bytes().buffer, + this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), + this.bb!.__vector_len(this.bb_pos + offset), + ) + : null; + } } diff --git a/src/format/flatbuffers/generated/dimension-shape-v2.ts b/src/format/flatbuffers/generated/dimension-shape-v2.ts new file mode 100644 index 0000000..f0eaa23 --- /dev/null +++ b/src/format/flatbuffers/generated/dimension-shape-v2.ts @@ -0,0 +1,33 @@ +// automatically generated by the FlatBuffers compiler, do not modify + +import * as flatbuffers from "flatbuffers"; + +export class DimensionShapeV2 { + bb: flatbuffers.ByteBuffer | null = null; + bb_pos = 0; + __init(i: number, bb: flatbuffers.ByteBuffer): DimensionShapeV2 { + this.bb_pos = i; + this.bb = bb; + return this; + } + + static getRootAsDimensionShapeV2( + bb: flatbuffers.ByteBuffer, + obj?: DimensionShapeV2, + ): DimensionShapeV2 { + return (obj || new DimensionShapeV2()).__init( + bb.readInt32(bb.position()) + bb.position(), + bb, + ); + } + + arrayLength(): bigint { + const offset = this.bb!.__offset(this.bb_pos, 4); + return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt("0"); + } + + numChunks(): number { + const offset = this.bb!.__offset(this.bb_pos, 6); + return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0; + } +} diff --git a/src/format/flatbuffers/generated/feature-flag-changed-update.ts b/src/format/flatbuffers/generated/feature-flag-changed-update.ts new file mode 100644 index 0000000..8c81214 --- /dev/null +++ b/src/format/flatbuffers/generated/feature-flag-changed-update.ts @@ -0,0 +1,38 @@ +// automatically generated by the FlatBuffers compiler, do not modify + +import * as flatbuffers from "flatbuffers"; + +export class FeatureFlagChangedUpdate { + bb: flatbuffers.ByteBuffer | null = null; + bb_pos = 0; + __init(i: number, bb: flatbuffers.ByteBuffer): FeatureFlagChangedUpdate { + this.bb_pos = i; + this.bb = bb; + return this; + } + + static getRootAsFeatureFlagChangedUpdate( + bb: flatbuffers.ByteBuffer, + obj?: FeatureFlagChangedUpdate, + ): FeatureFlagChangedUpdate { + return (obj || new FeatureFlagChangedUpdate()).__init( + bb.readInt32(bb.position()) + bb.position(), + bb, + ); + } + + id(): number { + const offset = this.bb!.__offset(this.bb_pos, 4); + return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0; + } + + newValue(): boolean { + const offset = this.bb!.__offset(this.bb_pos, 6); + return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; + } + + isSet(): boolean { + const offset = this.bb!.__offset(this.bb_pos, 8); + return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; + } +} diff --git a/src/format/flatbuffers/generated/manifest-file-info-v2.ts b/src/format/flatbuffers/generated/manifest-file-info-v2.ts new file mode 100644 index 0000000..9e2e00b --- /dev/null +++ b/src/format/flatbuffers/generated/manifest-file-info-v2.ts @@ -0,0 +1,65 @@ +// automatically generated by the FlatBuffers compiler, do not modify + +import * as flatbuffers from "flatbuffers"; + +import { ObjectId12 } from "../generated/object-id12.js"; + +export class ManifestFileInfoV2 { + bb: flatbuffers.ByteBuffer | null = null; + bb_pos = 0; + __init(i: number, bb: flatbuffers.ByteBuffer): ManifestFileInfoV2 { + this.bb_pos = i; + this.bb = bb; + return this; + } + + static getRootAsManifestFileInfoV2( + bb: flatbuffers.ByteBuffer, + obj?: ManifestFileInfoV2, + ): ManifestFileInfoV2 { + return (obj || new ManifestFileInfoV2()).__init( + bb.readInt32(bb.position()) + bb.position(), + bb, + ); + } + + id(obj?: ObjectId12): ObjectId12 | null { + const offset = this.bb!.__offset(this.bb_pos, 4); + return offset + ? (obj || new ObjectId12()).__init(this.bb_pos + offset, this.bb!) + : null; + } + + sizeBytes(): bigint { + const offset = this.bb!.__offset(this.bb_pos, 6); + return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt("0"); + } + + numChunkRefs(): number { + const offset = this.bb!.__offset(this.bb_pos, 8); + return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0; + } + + extra(index: number): number | null { + const offset = this.bb!.__offset(this.bb_pos, 10); + return offset + ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) + : 0; + } + + extraLength(): number { + const offset = this.bb!.__offset(this.bb_pos, 10); + return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; + } + + extraArray(): Uint8Array | null { + const offset = this.bb!.__offset(this.bb_pos, 10); + return offset + ? new Uint8Array( + this.bb!.bytes().buffer, + this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), + this.bb!.__vector_len(this.bb_pos + offset), + ) + : null; + } +} diff --git a/src/format/flatbuffers/generated/manifest.ts b/src/format/flatbuffers/generated/manifest.ts index 6af1f18..b4f1558 100644 --- a/src/format/flatbuffers/generated/manifest.ts +++ b/src/format/flatbuffers/generated/manifest.ts @@ -47,4 +47,55 @@ export class Manifest { const offset = this.bb!.__offset(this.bb_pos, 6); return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; } + + locationDictionary(index: number): number | null { + const offset = this.bb!.__offset(this.bb_pos, 8); + return offset + ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) + : 0; + } + + locationDictionaryLength(): number { + const offset = this.bb!.__offset(this.bb_pos, 8); + return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; + } + + locationDictionaryArray(): Uint8Array | null { + const offset = this.bb!.__offset(this.bb_pos, 8); + return offset + ? new Uint8Array( + this.bb!.bytes().buffer, + this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), + this.bb!.__vector_len(this.bb_pos + offset), + ) + : null; + } + + compressionAlgorithm(): number { + const offset = this.bb!.__offset(this.bb_pos, 10); + return offset ? this.bb!.readUint8(this.bb_pos + offset) : 1; + } + + extra(index: number): number | null { + const offset = this.bb!.__offset(this.bb_pos, 12); + return offset + ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) + : 0; + } + + extraLength(): number { + const offset = this.bb!.__offset(this.bb_pos, 12); + return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; + } + + extraArray(): Uint8Array | null { + const offset = this.bb!.__offset(this.bb_pos, 12); + return offset + ? new Uint8Array( + this.bb!.bytes().buffer, + this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), + this.bb!.__vector_len(this.bb_pos + offset), + ) + : null; + } } diff --git a/src/format/flatbuffers/generated/node-snapshot.ts b/src/format/flatbuffers/generated/node-snapshot.ts index 80599fe..0ae07e9 100644 --- a/src/format/flatbuffers/generated/node-snapshot.ts +++ b/src/format/flatbuffers/generated/node-snapshot.ts @@ -72,4 +72,27 @@ export class NodeSnapshot { const offset = this.bb!.__offset(this.bb_pos, 12); return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null; } + + extra(index: number): number | null { + const offset = this.bb!.__offset(this.bb_pos, 14); + return offset + ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) + : 0; + } + + extraLength(): number { + const offset = this.bb!.__offset(this.bb_pos, 14); + return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; + } + + extraArray(): Uint8Array | null { + const offset = this.bb!.__offset(this.bb_pos, 14); + return offset + ? new Uint8Array( + this.bb!.bytes().buffer, + this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), + this.bb!.__vector_len(this.bb_pos + offset), + ) + : null; + } } diff --git a/src/format/flatbuffers/generated/repo-status-changed-update.ts b/src/format/flatbuffers/generated/repo-status-changed-update.ts new file mode 100644 index 0000000..cdf6a78 --- /dev/null +++ b/src/format/flatbuffers/generated/repo-status-changed-update.ts @@ -0,0 +1,35 @@ +// automatically generated by the FlatBuffers compiler, do not modify + +import * as flatbuffers from "flatbuffers"; + +import { RepoStatus } from "../generated/repo-status.js"; + +export class RepoStatusChangedUpdate { + bb: flatbuffers.ByteBuffer | null = null; + bb_pos = 0; + __init(i: number, bb: flatbuffers.ByteBuffer): RepoStatusChangedUpdate { + this.bb_pos = i; + this.bb = bb; + return this; + } + + static getRootAsRepoStatusChangedUpdate( + bb: flatbuffers.ByteBuffer, + obj?: RepoStatusChangedUpdate, + ): RepoStatusChangedUpdate { + return (obj || new RepoStatusChangedUpdate()).__init( + bb.readInt32(bb.position()) + bb.position(), + bb, + ); + } + + status(obj?: RepoStatus): RepoStatus | null { + const offset = this.bb!.__offset(this.bb_pos, 4); + return offset + ? (obj || new RepoStatus()).__init( + this.bb!.__indirect(this.bb_pos + offset), + this.bb!, + ) + : null; + } +} diff --git a/src/format/flatbuffers/generated/repo.ts b/src/format/flatbuffers/generated/repo.ts index 4a38625..018e9fd 100644 --- a/src/format/flatbuffers/generated/repo.ts +++ b/src/format/flatbuffers/generated/repo.ts @@ -157,4 +157,96 @@ export class Repo { ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; } + + config(index: number): number | null { + const offset = this.bb!.__offset(this.bb_pos, 22); + return offset + ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) + : 0; + } + + configLength(): number { + const offset = this.bb!.__offset(this.bb_pos, 22); + return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; + } + + configArray(): Uint8Array | null { + const offset = this.bb!.__offset(this.bb_pos, 22); + return offset + ? new Uint8Array( + this.bb!.bytes().buffer, + this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), + this.bb!.__vector_len(this.bb_pos + offset), + ) + : null; + } + + enabledFeatureFlags(index: number): number | null { + const offset = this.bb!.__offset(this.bb_pos, 24); + return offset + ? this.bb!.readUint16(this.bb!.__vector(this.bb_pos + offset) + index * 2) + : 0; + } + + enabledFeatureFlagsLength(): number { + const offset = this.bb!.__offset(this.bb_pos, 24); + return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; + } + + enabledFeatureFlagsArray(): Uint16Array | null { + const offset = this.bb!.__offset(this.bb_pos, 24); + return offset + ? new Uint16Array( + this.bb!.bytes().buffer, + this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), + this.bb!.__vector_len(this.bb_pos + offset), + ) + : null; + } + + disabledFeatureFlags(index: number): number | null { + const offset = this.bb!.__offset(this.bb_pos, 26); + return offset + ? this.bb!.readUint16(this.bb!.__vector(this.bb_pos + offset) + index * 2) + : 0; + } + + disabledFeatureFlagsLength(): number { + const offset = this.bb!.__offset(this.bb_pos, 26); + return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; + } + + disabledFeatureFlagsArray(): Uint16Array | null { + const offset = this.bb!.__offset(this.bb_pos, 26); + return offset + ? new Uint16Array( + this.bb!.bytes().buffer, + this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), + this.bb!.__vector_len(this.bb_pos + offset), + ) + : null; + } + + extra(index: number): number | null { + const offset = this.bb!.__offset(this.bb_pos, 28); + return offset + ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) + : 0; + } + + extraLength(): number { + const offset = this.bb!.__offset(this.bb_pos, 28); + return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; + } + + extraArray(): Uint8Array | null { + const offset = this.bb!.__offset(this.bb_pos, 28); + return offset + ? new Uint8Array( + this.bb!.bytes().buffer, + this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), + this.bb!.__vector_len(this.bb_pos + offset), + ) + : null; + } } diff --git a/src/format/flatbuffers/generated/snapshot.ts b/src/format/flatbuffers/generated/snapshot.ts index 6856aa4..be35c83 100644 --- a/src/format/flatbuffers/generated/snapshot.ts +++ b/src/format/flatbuffers/generated/snapshot.ts @@ -3,6 +3,7 @@ import * as flatbuffers from "flatbuffers"; import { ManifestFileInfo } from "../generated/manifest-file-info.js"; +import { ManifestFileInfoV2 } from "../generated/manifest-file-info-v2.js"; import { MetadataItem } from "../generated/metadata-item.js"; import { NodeSnapshot } from "../generated/node-snapshot.js"; import { ObjectId12 } from "../generated/object-id12.js"; @@ -105,4 +106,47 @@ export class Snapshot { const offset = this.bb!.__offset(this.bb_pos, 16); return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; } + + manifestFilesV2( + index: number, + obj?: ManifestFileInfoV2, + ): ManifestFileInfoV2 | null { + const offset = this.bb!.__offset(this.bb_pos, 18); + return offset + ? (obj || new ManifestFileInfoV2()).__init( + this.bb!.__indirect( + this.bb!.__vector(this.bb_pos + offset) + index * 4, + ), + this.bb!, + ) + : null; + } + + manifestFilesV2Length(): number { + const offset = this.bb!.__offset(this.bb_pos, 18); + return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; + } + + extra(index: number): number | null { + const offset = this.bb!.__offset(this.bb_pos, 20); + return offset + ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) + : 0; + } + + extraLength(): number { + const offset = this.bb!.__offset(this.bb_pos, 20); + return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; + } + + extraArray(): Uint8Array | null { + const offset = this.bb!.__offset(this.bb_pos, 20); + return offset + ? new Uint8Array( + this.bb!.bytes().buffer, + this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), + this.bb!.__vector_len(this.bb_pos + offset), + ) + : null; + } } diff --git a/src/format/flatbuffers/generated/transaction-log.ts b/src/format/flatbuffers/generated/transaction-log.ts index fef731a..e9a88a6 100644 --- a/src/format/flatbuffers/generated/transaction-log.ts +++ b/src/format/flatbuffers/generated/transaction-log.ts @@ -159,4 +159,27 @@ export class TransactionLog { const offset = this.bb!.__offset(this.bb_pos, 20); return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; } + + extra(index: number): number | null { + const offset = this.bb!.__offset(this.bb_pos, 22); + return offset + ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) + : 0; + } + + extraLength(): number { + const offset = this.bb!.__offset(this.bb_pos, 22); + return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; + } + + extraArray(): Uint8Array | null { + const offset = this.bb!.__offset(this.bb_pos, 22); + return offset + ? new Uint8Array( + this.bb!.bytes().buffer, + this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), + this.bb!.__vector_len(this.bb_pos + offset), + ) + : null; + } } diff --git a/src/format/flatbuffers/generated/update-type.ts b/src/format/flatbuffers/generated/update-type.ts index c581182..2d2b323 100644 --- a/src/format/flatbuffers/generated/update-type.ts +++ b/src/format/flatbuffers/generated/update-type.ts @@ -6,12 +6,14 @@ import { BranchResetUpdate } from "../generated/branch-reset-update.js"; import { CommitAmendedUpdate } from "../generated/commit-amended-update.js"; import { ConfigChangedUpdate } from "../generated/config-changed-update.js"; import { ExpirationRanUpdate } from "../generated/expiration-ran-update.js"; +import { FeatureFlagChangedUpdate } from "../generated/feature-flag-changed-update.js"; import { GCRanUpdate } from "../generated/gcran-update.js"; import { MetadataChangedUpdate } from "../generated/metadata-changed-update.js"; import { NewCommitUpdate } from "../generated/new-commit-update.js"; import { NewDetachedSnapshotUpdate } from "../generated/new-detached-snapshot-update.js"; import { RepoInitializedUpdate } from "../generated/repo-initialized-update.js"; import { RepoMigratedUpdate } from "../generated/repo-migrated-update.js"; +import { RepoStatusChangedUpdate } from "../generated/repo-status-changed-update.js"; import { TagCreatedUpdate } from "../generated/tag-created-update.js"; import { TagDeletedUpdate } from "../generated/tag-deleted-update.js"; @@ -31,6 +33,8 @@ export enum UpdateType { NewDetachedSnapshotUpdate = 12, GCRanUpdate = 13, ExpirationRanUpdate = 14, + FeatureFlagChangedUpdate = 15, + RepoStatusChangedUpdate = 16, } export function unionToUpdateType( @@ -43,12 +47,14 @@ export function unionToUpdateType( | CommitAmendedUpdate | ConfigChangedUpdate | ExpirationRanUpdate + | FeatureFlagChangedUpdate | GCRanUpdate | MetadataChangedUpdate | NewCommitUpdate | NewDetachedSnapshotUpdate | RepoInitializedUpdate | RepoMigratedUpdate + | RepoStatusChangedUpdate | TagCreatedUpdate | TagDeletedUpdate, ) => @@ -58,12 +64,14 @@ export function unionToUpdateType( | CommitAmendedUpdate | ConfigChangedUpdate | ExpirationRanUpdate + | FeatureFlagChangedUpdate | GCRanUpdate | MetadataChangedUpdate | NewCommitUpdate | NewDetachedSnapshotUpdate | RepoInitializedUpdate | RepoMigratedUpdate + | RepoStatusChangedUpdate | TagCreatedUpdate | TagDeletedUpdate | null, @@ -74,12 +82,14 @@ export function unionToUpdateType( | CommitAmendedUpdate | ConfigChangedUpdate | ExpirationRanUpdate + | FeatureFlagChangedUpdate | GCRanUpdate | MetadataChangedUpdate | NewCommitUpdate | NewDetachedSnapshotUpdate | RepoInitializedUpdate | RepoMigratedUpdate + | RepoStatusChangedUpdate | TagCreatedUpdate | TagDeletedUpdate | null { @@ -116,6 +126,14 @@ export function unionToUpdateType( return accessor(new GCRanUpdate())! as GCRanUpdate; case "ExpirationRanUpdate": return accessor(new ExpirationRanUpdate())! as ExpirationRanUpdate; + case "FeatureFlagChangedUpdate": + return accessor( + new FeatureFlagChangedUpdate(), + )! as FeatureFlagChangedUpdate; + case "RepoStatusChangedUpdate": + return accessor( + new RepoStatusChangedUpdate(), + )! as RepoStatusChangedUpdate; default: return null; } @@ -132,12 +150,14 @@ export function unionListToUpdateType( | CommitAmendedUpdate | ConfigChangedUpdate | ExpirationRanUpdate + | FeatureFlagChangedUpdate | GCRanUpdate | MetadataChangedUpdate | NewCommitUpdate | NewDetachedSnapshotUpdate | RepoInitializedUpdate | RepoMigratedUpdate + | RepoStatusChangedUpdate | TagCreatedUpdate | TagDeletedUpdate, ) => @@ -147,12 +167,14 @@ export function unionListToUpdateType( | CommitAmendedUpdate | ConfigChangedUpdate | ExpirationRanUpdate + | FeatureFlagChangedUpdate | GCRanUpdate | MetadataChangedUpdate | NewCommitUpdate | NewDetachedSnapshotUpdate | RepoInitializedUpdate | RepoMigratedUpdate + | RepoStatusChangedUpdate | TagCreatedUpdate | TagDeletedUpdate | null, @@ -164,12 +186,14 @@ export function unionListToUpdateType( | CommitAmendedUpdate | ConfigChangedUpdate | ExpirationRanUpdate + | FeatureFlagChangedUpdate | GCRanUpdate | MetadataChangedUpdate | NewCommitUpdate | NewDetachedSnapshotUpdate | RepoInitializedUpdate | RepoMigratedUpdate + | RepoStatusChangedUpdate | TagCreatedUpdate | TagDeletedUpdate | null { @@ -213,6 +237,16 @@ export function unionListToUpdateType( return accessor(index, new GCRanUpdate())! as GCRanUpdate; case "ExpirationRanUpdate": return accessor(index, new ExpirationRanUpdate())! as ExpirationRanUpdate; + case "FeatureFlagChangedUpdate": + return accessor( + index, + new FeatureFlagChangedUpdate(), + )! as FeatureFlagChangedUpdate; + case "RepoStatusChangedUpdate": + return accessor( + index, + new RepoStatusChangedUpdate(), + )! as RepoStatusChangedUpdate; default: return null; } diff --git a/src/format/flatbuffers/snapshot-parser.ts b/src/format/flatbuffers/snapshot-parser.ts index d88a800..4a28bea 100644 --- a/src/format/flatbuffers/snapshot-parser.ts +++ b/src/format/flatbuffers/snapshot-parser.ts @@ -80,19 +80,35 @@ export function parseSnapshot(data: Uint8Array): Snapshot { } } - // Parse manifest files (vector of structs) - const manifestFilesLength = fbsSnapshot.manifestFilesLength(); + // Parse manifest files — prefer v2 field, fall back to v1 struct vector const manifestFiles: ManifestFileInfo[] = []; - for (let i = 0; i < manifestFilesLength; i++) { - const fbsMfi = fbsSnapshot.manifestFiles(i); - if (fbsMfi) { - const mfiIdObj = fbsMfi.id(); - if (!mfiIdObj) throw new Error("ManifestFileInfo missing id"); - manifestFiles.push({ - id: asObjectId12(readId12(mfiIdObj.bb!, mfiIdObj.bb_pos)), - sizeBytes: Number(fbsMfi.sizeBytes()), - numChunkRefs: fbsMfi.numChunkRefs(), - }); + const v2Length = fbsSnapshot.manifestFilesV2Length(); + if (v2Length > 0) { + for (let i = 0; i < v2Length; i++) { + const fbsMfi = fbsSnapshot.manifestFilesV2(i); + if (fbsMfi) { + const mfiIdObj = fbsMfi.id(); + if (!mfiIdObj) throw new Error("ManifestFileInfoV2 missing id"); + manifestFiles.push({ + id: asObjectId12(readId12(mfiIdObj.bb!, mfiIdObj.bb_pos)), + sizeBytes: Number(fbsMfi.sizeBytes()), + numChunkRefs: fbsMfi.numChunkRefs(), + }); + } + } + } else { + const v1Length = fbsSnapshot.manifestFilesLength(); + for (let i = 0; i < v1Length; i++) { + const fbsMfi = fbsSnapshot.manifestFiles(i); + if (fbsMfi) { + const mfiIdObj = fbsMfi.id(); + if (!mfiIdObj) throw new Error("ManifestFileInfo missing id"); + manifestFiles.push({ + id: asObjectId12(readId12(mfiIdObj.bb!, mfiIdObj.bb_pos)), + sizeBytes: Number(fbsMfi.sizeBytes()), + numChunkRefs: fbsMfi.numChunkRefs(), + }); + } } } @@ -149,16 +165,32 @@ function parseNodeData( } function parseArrayNodeData(fbsArray: FbsArrayNodeData): ArrayNodeData { - // Parse shape (vector of DimensionShape structs) - const shapeLength = fbsArray.shapeLength(); + // Parse shape — prefer v2 field, fall back to v1 struct vector const shape: DimensionShape[] = []; - for (let i = 0; i < shapeLength; i++) { - const fbsShape = fbsArray.shape(i); - if (fbsShape) { - shape.push({ - arrayLength: Number(fbsShape.arrayLength()), - chunkLength: Number(fbsShape.chunkLength()), - }); + const shapeV2Length = fbsArray.shapeV2Length(); + if (shapeV2Length > 0) { + for (let i = 0; i < shapeV2Length; i++) { + const fbsShape = fbsArray.shapeV2(i); + if (fbsShape) { + const arrayLength = Number(fbsShape.arrayLength()); + const numChunks = fbsShape.numChunks(); + shape.push({ + arrayLength, + chunkLength: numChunks > 0 ? Math.ceil(arrayLength / numChunks) : 0, + numChunks, + }); + } + } + } else { + const shapeLength = fbsArray.shapeLength(); + for (let i = 0; i < shapeLength; i++) { + const fbsShape = fbsArray.shape(i); + if (fbsShape) { + shape.push({ + arrayLength: Number(fbsShape.arrayLength()), + chunkLength: Number(fbsShape.chunkLength()), + }); + } } } diff --git a/src/format/flatbuffers/types.ts b/src/format/flatbuffers/types.ts index 3f59447..207a08e 100644 --- a/src/format/flatbuffers/types.ts +++ b/src/format/flatbuffers/types.ts @@ -133,8 +133,11 @@ export interface DimensionShape { /** Length of the array along this dimension */ arrayLength: number; - /** Chunk size along this dimension */ + /** Chunk size along this dimension (v1 format; approximate in v2) */ chunkLength: number; + + /** Number of chunks along this dimension (v2 format) */ + numChunks?: number; } /** Group node data (empty - just a marker) */ diff --git a/tests/format/flatbuffers/repo-parser.test.ts b/tests/format/flatbuffers/repo-parser.test.ts index 9035edb..61dfdfe 100644 --- a/tests/format/flatbuffers/repo-parser.test.ts +++ b/tests/format/flatbuffers/repo-parser.test.ts @@ -15,10 +15,7 @@ import { encodeObjectId12 } from "../../../src/format/object-id.js"; const __dirname = dirname(fileURLToPath(import.meta.url)); // Path to v2 test repository -const TEST_REPO_V2_PATH = join( - __dirname, - "../../data/test-repo-v2", -); +const TEST_REPO_V2_PATH = join(__dirname, "../../data/test-repo-v2"); describe("repo-parser", () => { describe("parseRepo", () => { diff --git a/tests/format/flatbuffers/snapshot-parser.test.ts b/tests/format/flatbuffers/snapshot-parser.test.ts index e188b8b..75f42e2 100644 --- a/tests/format/flatbuffers/snapshot-parser.test.ts +++ b/tests/format/flatbuffers/snapshot-parser.test.ts @@ -22,11 +22,9 @@ import { import { encodeObjectId12 } from "../../../src/format/object-id.js"; const __dirname = dirname(fileURLToPath(import.meta.url)); -const TEST_DATA_PATH = join( - __dirname, - "../../data", -); +const TEST_DATA_PATH = join(__dirname, "../../data"); const TEST_REPO_V2_PATH = join(TEST_DATA_PATH, "test-repo-v2"); +const MIGRATED_REPO_V2_PATH = join(TEST_DATA_PATH, "test-repo-v2-migrated"); /** Read and parse a snapshot file (header + optional zstd + FlatBuffer) */ function readSnapshot(filePath: string) { @@ -58,10 +56,30 @@ describe("snapshot-parser (real data)", () => { } }); - it("at least one snapshot has non-empty manifestFiles", () => { - let found = false; + it("v2 arrays have non-empty shape via shape_v2", () => { + let arrayCount = 0; for (const file of snapshotFiles) { const snapshot = readSnapshot(join(snapshotDir, file)); + for (const node of snapshot.nodes) { + if (node.nodeData.type === "array") { + arrayCount++; + expect(node.nodeData.shape.length).toBeGreaterThan(0); + for (const dim of node.nodeData.shape) { + expect(dim.arrayLength).toBeGreaterThan(0); + expect(dim.numChunks).toBeGreaterThan(0); + } + } + } + } + expect(arrayCount).toBeGreaterThan(0); + }); + + it("at least one migrated snapshot has non-empty manifestFiles", () => { + const migratedSnapshotDir = join(MIGRATED_REPO_V2_PATH, "snapshots"); + const migratedFiles = readdirSync(migratedSnapshotDir); + let found = false; + for (const file of migratedFiles) { + const snapshot = readSnapshot(join(migratedSnapshotDir, file)); if (snapshot.manifestFiles.length > 0) { found = true; break; @@ -71,8 +89,10 @@ describe("snapshot-parser (real data)", () => { }); it("manifestFiles have valid id, sizeBytes, and numChunkRefs", () => { - for (const file of snapshotFiles) { - const snapshot = readSnapshot(join(snapshotDir, file)); + const migratedSnapshotDir = join(MIGRATED_REPO_V2_PATH, "snapshots"); + const migratedFiles = readdirSync(migratedSnapshotDir); + for (const file of migratedFiles) { + const snapshot = readSnapshot(join(migratedSnapshotDir, file)); for (const mf of snapshot.manifestFiles) { // ID should be a 12-byte ObjectId expect(mf.id).toBeInstanceOf(Uint8Array); @@ -90,20 +110,26 @@ describe("snapshot-parser (real data)", () => { }); it("manifestFiles IDs correspond to files in manifests/", () => { + const migratedSnapshotDir = join(MIGRATED_REPO_V2_PATH, "snapshots"); + const migratedManifestDir = join(MIGRATED_REPO_V2_PATH, "manifests"); + const migratedSnapshotFiles = readdirSync(migratedSnapshotDir); + const migratedManifestFiles = readdirSync(migratedManifestDir); + // Collect all manifest IDs referenced by any snapshot const referencedIds = new Set(); - for (const file of snapshotFiles) { - const snapshot = readSnapshot(join(snapshotDir, file)); + for (const file of migratedSnapshotFiles) { + const snapshot = readSnapshot(join(migratedSnapshotDir, file)); for (const mf of snapshot.manifestFiles) { referencedIds.add(encodeObjectId12(mf.id)); } } // Every referenced manifest ID should have a corresponding file + expect(referencedIds.size).toBeGreaterThan(0); for (const id of referencedIds) { expect( - manifestFiles.includes(id), + migratedManifestFiles.includes(id), `Manifest ID ${id} referenced by snapshot but not found in manifests/`, ).toBe(true); } diff --git a/tests/format/flatbuffers/transaction-log-parser.test.ts b/tests/format/flatbuffers/transaction-log-parser.test.ts index 7d91a96..9c71b5f 100644 --- a/tests/format/flatbuffers/transaction-log-parser.test.ts +++ b/tests/format/flatbuffers/transaction-log-parser.test.ts @@ -18,10 +18,7 @@ import { } from "../../../src/format/header.js"; const __dirname = dirname(fileURLToPath(import.meta.url)); -const TEST_REPO_V2_PATH = join( - __dirname, - "../../data/test-repo-v2", -); +const TEST_REPO_V2_PATH = join(__dirname, "../../data/test-repo-v2"); /** Read and parse a transaction log file (header + optional zstd + FlatBuffer) */ function readTransactionLog(filePath: string) { diff --git a/tests/reader/repository.test.ts b/tests/reader/repository.test.ts index a2fb3fb..7b4e79a 100644 --- a/tests/reader/repository.test.ts +++ b/tests/reader/repository.test.ts @@ -22,10 +22,7 @@ import { encodeObjectId12 } from "../../src/format/object-id.js"; const __dirname = dirname(fileURLToPath(import.meta.url)); // Path to v2 test repository -const TEST_REPO_V2_PATH = join( - __dirname, - "../data/test-repo-v2", -); +const TEST_REPO_V2_PATH = join(__dirname, "../data/test-repo-v2"); describe("Repository", () => { describe("open", () => {