Skip to content

Commit

Permalink
move chunk.ts file to core/tree (microsoft#23173)
Browse files Browse the repository at this point in the history
## Description

Moves the `chunk.ts` to `core/tree` to separate some chunk interfaces
and types from the `ChunkedForest`.
  • Loading branch information
daesunp authored Dec 2, 2024
1 parent fb57999 commit 9e61721
Show file tree
Hide file tree
Showing 16 changed files with 46 additions and 25 deletions.
5 changes: 5 additions & 0 deletions packages/dds/tree/src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ export {
type DeltaFieldChanges,
type ExclusiveMapTree,
deepCopyMapTree,
type TreeChunk,
dummyRoot,
cursorChunk,
tryGetChunk,
type ChunkedCursor,
} from "./tree/index.js";

export {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

import { assert } from "@fluidframework/core-utils/internal";

import type { ReferenceCounted } from "../../util/index.js";
import type { FieldKey } from "../schema-stored/index.js";
import { rootFieldKey } from "./types.js";
import {
CursorLocationType,
type FieldKey,
type ITreeCursor,
type ITreeCursorSynchronous,
rootFieldKey,
} from "../../core/index.js";
import type { ReferenceCounted } from "../../util/index.js";
} from "./cursor.js";

/**
* Contiguous part of the tree which get stored together in some data format.
Expand Down
8 changes: 8 additions & 0 deletions packages/dds/tree/src/core/tree/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,13 @@ export {
emptyDelta,
} from "./deltaUtil.js";

export {
type TreeChunk,
dummyRoot,
cursorChunk,
tryGetChunk,
type ChunkedCursor,
} from "./chunk.js";

export { DetachedFieldIndex } from "./detachedFieldIndex.js";
export { type ForestRootId } from "./detachedFieldIndexTypes.js";
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ import {
type TreeValue,
type UpPath,
type Value,
type ChunkedCursor,
type TreeChunk,
cursorChunk,
dummyRoot,
} from "../../core/index.js";
import { ReferenceCountedBase, fail } from "../../util/index.js";
import { SynchronousCursor, prefixPath } from "../treeCursorUtils.js";

import { type ChunkedCursor, type TreeChunk, cursorChunk, dummyRoot } from "./chunk.js";

/**
* General purpose one node chunk.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ import {
mapCursorFields,
Multiplicity,
ValueSchema,
type TreeChunk,
tryGetChunk,
} from "../../core/index.js";
import { fail, getOrCreate } from "../../util/index.js";
import type { FullSchemaPolicy } from "../modular-schema/index.js";

import { BasicChunk } from "./basicChunk.js";
import { type TreeChunk, tryGetChunk } from "./chunk.js";
import { SequenceChunk } from "./sequenceChunk.js";
import { type FieldShape, TreeShape, UniformChunk } from "./uniformChunk.js";
import { isStableNodeKey } from "../node-key/index.js";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import {
detachedFieldAsKey,
mapCursorField,
rootFieldKey,
type ChunkedCursor,
type TreeChunk,
} from "../../core/index.js";
import {
assertValidRange,
Expand All @@ -42,7 +44,6 @@ import {
} from "../../util/index.js";

import { BasicChunk, BasicChunkCursor, type SiblingsOrKey } from "./basicChunk.js";
import type { ChunkedCursor, TreeChunk } from "./chunk.js";
import { type IChunker, basicChunkTree, chunkTree } from "./chunkTree.js";
import type { IIdCompressor } from "@fluidframework/id-compressor";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@

import { assert, oob } from "@fluidframework/core-utils/internal";

import type { TreeValue } from "../../../core/index.js";
import type { TreeValue, TreeChunk } from "../../../core/index.js";
import { assertValidIndex } from "../../../util/index.js";
import { type FluidSerializableReadOnly, assertAllowedValue } from "../../valueUtilities.js";
import type { TreeChunk } from "../chunk.js";

/**
* Utilities related to chunk encoding and decoding that do not depend on specific chunk types or formats.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@
import { assert, unreachableCase, oob } from "@fluidframework/core-utils/internal";

import { DiscriminatedUnionDispatcher } from "../../../codec/index.js";
import type { FieldKey, TreeNodeSchemaIdentifier, Value } from "../../../core/index.js";
import type {
FieldKey,
TreeNodeSchemaIdentifier,
Value,
TreeChunk,
} from "../../../core/index.js";
import { assertValidIndex } from "../../../util/index.js";
import { BasicChunk } from "../basicChunk.js";
import type { TreeChunk } from "../chunk.js";
import { emptyChunk } from "../emptyChunk.js";
import { SequenceChunk } from "../sequenceChunk.js";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { assert } from "@fluidframework/core-utils/internal";

import type { DiscriminatedUnionDispatcher } from "../../../codec/index.js";
import type { BrandedType } from "../../../util/index.js";
import type { TreeChunk } from "../chunk.js";
import type { TreeChunk } from "../../../core/index.js";

import {
type ChunkDecoder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ import {
type FieldUpPath,
type PathRootPrefix,
type UpPath,
type ChunkedCursor,
type TreeChunk,
cursorChunk,
dummyRoot,
} from "../../core/index.js";
import { fail } from "../../util/index.js";
import { prefixFieldPath } from "../treeCursorUtils.js";

import { type ChunkedCursor, type TreeChunk, cursorChunk, dummyRoot } from "./chunk.js";

/**
* Chunk that is empty.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

export { uniformChunk, ChunkShape } from "./uniformChunk.js";
export { type TreeChunk, dummyRoot } from "./chunk.js";
export { type TreeChunk, dummyRoot } from "../../core/index.js";
export {
chunkTree,
defaultChunkPolicy,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { ReferenceCountedBase } from "../../util/index.js";

import { BasicChunkCursor } from "./basicChunk.js";
import { type ChunkedCursor, type TreeChunk, dummyRoot } from "./chunk.js";
import { type ChunkedCursor, type TreeChunk, dummyRoot } from "../../core/index.js";

/**
* General purpose multi-node sequence chunk.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ import {
type TreeValue,
type UpPath,
type Value,
type ChunkedCursor,
type TreeChunk,
cursorChunk,
dummyRoot,
} from "../../core/index.js";
import { ReferenceCountedBase, fail, hasSome } from "../../util/index.js";
import { SynchronousCursor, prefixFieldPath, prefixPath } from "../treeCursorUtils.js";

import { type ChunkedCursor, type TreeChunk, cursorChunk, dummyRoot } from "./chunk.js";
import type { SessionSpaceCompressedId, IIdCompressor } from "@fluidframework/id-compressor";
import { UsageError } from "@fluidframework/telemetry-utils/internal";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,10 @@ import {
type ITreeCursor,
type ITreeCursorSynchronous,
type JsonableTree,
type ChunkedCursor,
} from "../../../core/index.js";
// eslint-disable-next-line import/no-internal-modules
import { BasicChunk } from "../../../feature-libraries/chunked-forest/basicChunk.js";
import type {
ChunkedCursor,
// eslint-disable-next-line import/no-internal-modules
} from "../../../feature-libraries/chunked-forest/chunk.js";
import {
basicChunkTree,
basicOnlyChunkPolicy,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ import {
type FieldKey,
type Value,
mapCursorField,
tryGetChunk,
} from "../../../core/index.js";
// eslint-disable-next-line import/no-internal-modules
import { BasicChunk } from "../../../feature-libraries/chunked-forest/basicChunk.js";
// eslint-disable-next-line import/no-internal-modules
import { tryGetChunk } from "../../../feature-libraries/chunked-forest/chunk.js";
import {
type ChunkPolicy,
type ShapeInfo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { type Static, Type } from "@sinclair/typebox";

import { DiscriminatedUnionDispatcher, unionOptions } from "../../../../codec/index.js";
// eslint-disable-next-line import/no-internal-modules
import type { ChunkedCursor } from "../../../../feature-libraries/chunked-forest/chunk.js";
import type { ChunkedCursor } from "../../../../core/index.js";
import {
type ChunkDecoder,
type StreamCursor,
Expand Down

0 comments on commit 9e61721

Please sign in to comment.