Skip to content

Commit

Permalink
Automation: main-next integrate
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerbutler committed Dec 12, 2023
2 parents 271401c + 6f07017 commit ef49d00
Show file tree
Hide file tree
Showing 64 changed files with 783 additions and 189 deletions.
10 changes: 10 additions & 0 deletions .changeset/lovely-stave-squad.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@fluidframework/container-runtime": minor
"@fluidframework/runtime-definitions": minor
---

Moves `IdCompressor` and related types from `@fluidframework/container-runtime` and `@fluidframework/runtime-definitions` into their own package, `@fluidframework/id-compressor`.
Exports from original packages have been marked as deprecated.

Additionally, marks the `IdCompressor` class as deprecated.
Consumers should use the interfaces, `IIdCompressor` and `IIdCompressorCore`, in conjunction with the factory function `createIdCompressor` instead.
1 change: 1 addition & 0 deletions experimental/dds/tree2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"@fluidframework/core-interfaces": "workspace:~",
"@fluidframework/core-utils": "workspace:~",
"@fluidframework/datastore-definitions": "workspace:~",
"@fluidframework/id-compressor": "workspace:~",
"@fluidframework/protocol-definitions": "^3.0.0",
"@fluidframework/runtime-definitions": "workspace:~",
"@fluidframework/runtime-utils": "workspace:~",
Expand Down
3 changes: 1 addition & 2 deletions experimental/dds/tree2/src/core/rebase/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
*/

import { assert } from "@fluidframework/core-utils";
import { isStableId } from "@fluidframework/container-runtime";
import { StableId } from "@fluidframework/runtime-definitions";
import { isStableId, StableId } from "@fluidframework/id-compressor";
import { Brand, NestedMap, RangeMap, brandedStringType, generateStableId } from "../../util";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
*/

import { assert } from "@fluidframework/core-utils";
import { assertIsStableId } from "@fluidframework/container-runtime";
import {
assertIsStableId,
IIdCompressor,
SessionSpaceCompressedId,
StableId,
} from "@fluidframework/runtime-definitions";
} from "@fluidframework/id-compressor";
import { brand, extractFromOpaque } from "../../util";
import { StableNodeKey, LocalNodeKey } from "./nodeKey";

Expand Down
4 changes: 2 additions & 2 deletions experimental/dds/tree2/src/util/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import structuredClone from "@ungap/structured-clone";
import {
generateStableId as runtimeGenerateStableId,
assertIsStableId,
} from "@fluidframework/container-runtime";
import { StableId } from "@fluidframework/runtime-definitions";
StableId,
} from "@fluidframework/id-compressor";

/**
* Subset of Map interface.
Expand Down
1 change: 1 addition & 0 deletions feeds/internal-build.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
@fluidframework/test-runtime-utils
@fluidframework/runtime-utils
@fluidframework/runtime-definitions
@fluidframework/id-compressor
@fluidframework/datastore-definitions
@fluidframework/datastore
@fluidframework/container-runtime-definitions
Expand Down
1 change: 1 addition & 0 deletions feeds/internal-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
@fluidframework/test-runtime-utils
@fluidframework/runtime-utils
@fluidframework/runtime-definitions
@fluidframework/id-compressor
@fluidframework/datastore-definitions
@fluidframework/datastore
@fluidframework/container-runtime-definitions
Expand Down
1 change: 1 addition & 0 deletions feeds/public.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
@fluidframework/test-runtime-utils
@fluidframework/runtime-utils
@fluidframework/runtime-definitions
@fluidframework/id-compressor
@fluidframework/datastore-definitions
@fluidframework/datastore
@fluidframework/container-runtime-definitions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
```ts

import { assertIsStableId } from '@fluidframework/id-compressor';
import { AttachState } from '@fluidframework/container-definitions';
import { ContainerWarning } from '@fluidframework/container-definitions';
import { FluidDataStoreRegistryEntry } from '@fluidframework/runtime-definitions';
import { FluidObject } from '@fluidframework/core-interfaces';
import { FlushMode } from '@fluidframework/runtime-definitions';
import { generateStableId } from '@fluidframework/id-compressor';
import { IAudience } from '@fluidframework/container-definitions';
import { IClientDetails } from '@fluidframework/protocol-definitions';
import { IContainerContext } from '@fluidframework/container-definitions';
Expand All @@ -28,8 +30,8 @@ import { IFluidHandle } from '@fluidframework/core-interfaces';
import { IFluidHandleContext } from '@fluidframework/core-interfaces';
import { IGarbageCollectionData } from '@fluidframework/runtime-definitions';
import { IGetPendingLocalStateProps } from '@fluidframework/container-definitions';
import { IIdCompressor } from '@fluidframework/runtime-definitions';
import { IIdCompressorCore } from '@fluidframework/runtime-definitions';
import type { IIdCompressor } from '@fluidframework/id-compressor';
import type { IIdCompressorCore } from '@fluidframework/id-compressor';
import { ILoaderOptions } from '@fluidframework/container-definitions';
import { IProvideFluidHandleContext } from '@fluidframework/core-interfaces';
import { IQuorumClients } from '@fluidframework/protocol-definitions';
Expand All @@ -38,6 +40,7 @@ import { IResponse } from '@fluidframework/core-interfaces';
import { IRuntime } from '@fluidframework/container-definitions';
import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
import { ISignalMessage } from '@fluidframework/protocol-definitions';
import { isStableId } from '@fluidframework/id-compressor';
import { ISummaryAck } from '@fluidframework/protocol-definitions';
import { ISummaryContent } from '@fluidframework/protocol-definitions';
import { ISummaryNack } from '@fluidframework/protocol-definitions';
Expand All @@ -48,7 +51,6 @@ import { ITelemetryContext } from '@fluidframework/runtime-definitions';
import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
import { MessageType } from '@fluidframework/protocol-definitions';
import { NamedFluidDataStoreRegistryEntries } from '@fluidframework/runtime-definitions';
import { StableId } from '@fluidframework/runtime-definitions';
import { TypedEventEmitter } from '@fluid-internal/client-utils';

// @internal
Expand All @@ -60,8 +62,7 @@ export const AllowInactiveRequestHeaderKey = "allowInactive";
// @internal
export const AllowTombstoneRequestHeaderKey = "allowTombstone";

// @internal
export function assertIsStableId(stableId: string): StableId;
export { assertIsStableId }

// @internal
export type CompatModeBehavior =
Expand Down Expand Up @@ -271,8 +272,7 @@ export type GCNodeType = (typeof GCNodeType)[keyof typeof GCNodeType];
// @alpha (undocumented)
export type GCVersion = number;

// @internal
export function generateStableId(): StableId;
export { generateStableId }

// @internal
export interface IAckedSummary {
Expand Down Expand Up @@ -511,8 +511,7 @@ export interface ISerializedElection {
// @internal @deprecated (undocumented)
export function isRuntimeMessage(message: ISequencedDocumentMessage): boolean;

// @internal
export function isStableId(str: string): str is StableId;
export { isStableId }

// @alpha
export interface ISubmitSummaryOpResult extends Omit<IUploadSummaryResult, "stage" | "error"> {
Expand Down
1 change: 1 addition & 0 deletions packages/runtime/container-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"@fluidframework/datastore": "workspace:~",
"@fluidframework/driver-definitions": "workspace:~",
"@fluidframework/driver-utils": "workspace:~",
"@fluidframework/id-compressor": "workspace:~",
"@fluidframework/protocol-definitions": "^3.0.0",
"@fluidframework/runtime-definitions": "workspace:~",
"@fluidframework/runtime-utils": "workspace:~",
Expand Down
14 changes: 9 additions & 5 deletions packages/runtime/container-runtime/src/containerRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,14 @@ import {
channelsTreeName,
IDataStore,
ITelemetryContext,
} from "@fluidframework/runtime-definitions";
import type {
SerializedIdCompressorWithNoSession,
IIdCompressor,
IIdCompressorCore,
IdCreationRange,
SerializedIdCompressorWithOngoingSession,
} from "@fluidframework/runtime-definitions";
} from "@fluidframework/id-compressor";
import {
addBlobToSummary,
addSummarizeResultToSummary,
Expand Down Expand Up @@ -856,16 +858,18 @@ export class ContainerRuntime
metadata?.idCompressorEnabled ?? runtimeOptions.enableRuntimeIdCompressor ?? false;
let idCompressor: (IIdCompressor & IIdCompressorCore) | undefined;
if (idCompressorEnabled) {
const { IdCompressor, createSessionId } = await import("./id-compressor");
const { createIdCompressor, deserializeIdCompressor, createSessionId } = await import(
"@fluidframework/id-compressor"
);

const pendingLocalState = context.pendingLocalState as IPendingRuntimeState;

if (pendingLocalState?.pendingIdCompressorState !== undefined) {
idCompressor = IdCompressor.deserialize(pendingLocalState.pendingIdCompressorState);
idCompressor = deserializeIdCompressor(pendingLocalState.pendingIdCompressorState);
} else if (serializedIdCompressor !== undefined) {
idCompressor = IdCompressor.deserialize(serializedIdCompressor, createSessionId());
idCompressor = deserializeIdCompressor(serializedIdCompressor, createSessionId());
} else {
idCompressor = IdCompressor.create(logger);
idCompressor = createIdCompressor(logger);
}
}

Expand Down
26 changes: 0 additions & 26 deletions packages/runtime/container-runtime/src/id-compressor/index.ts

This file was deleted.

18 changes: 17 additions & 1 deletion packages/runtime/container-runtime/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,21 @@ export {
IRetriableFailureResult,
ISummarizeEventProps,
} from "./summary";
export { isStableId, generateStableId, assertIsStableId } from "./id-compressor";
export { IChunkedOp, unpackRuntimeMessage } from "./opLifecycle";

// Re-exports for backwards compatibility.
// Will be removed in the future.
export {
/**
* @deprecated Import from `@fluidframework/id-compressor` instead.
*/
assertIsStableId,
/**
* @deprecated Import from `@fluidframework/id-compressor` instead.
*/
generateStableId,
/**
* @deprecated Import from `@fluidframework/id-compressor` instead.
*/
isStableId,
} from "@fluidframework/id-compressor";
2 changes: 1 addition & 1 deletion packages/runtime/container-runtime/src/messageTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
IEnvelope,
InboundAttachMessage,
IAttachMessage,
IdCreationRange,
} from "@fluidframework/runtime-definitions";
import type { IdCreationRange } from "@fluidframework/id-compressor";
import { IDataStoreAliasMessage } from "./dataStore";
import { GarbageCollectionMessage } from "./gc";
import { IChunkedOp } from "./opLifecycle";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { IFluidHandle } from '@fluidframework/core-interfaces';
import { IFluidHandleContext } from '@fluidframework/core-interfaces';
import { IFluidLoadable } from '@fluidframework/core-interfaces';
import { IGarbageCollectionData } from '@fluidframework/runtime-definitions';
import { IIdCompressor } from '@fluidframework/runtime-definitions';
import { IIdCompressor } from '@fluidframework/id-compressor';
import { IInboundSignalMessage } from '@fluidframework/runtime-definitions';
import { ILoaderOptions } from '@fluidframework/container-definitions';
import { IProvideFluidDataStoreRegistry } from '@fluidframework/runtime-definitions';
Expand Down
1 change: 1 addition & 0 deletions packages/runtime/datastore-definitions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"dependencies": {
"@fluidframework/container-definitions": "workspace:~",
"@fluidframework/core-interfaces": "workspace:~",
"@fluidframework/id-compressor": "workspace:~",
"@fluidframework/protocol-definitions": "^3.0.0",
"@fluidframework/runtime-definitions": "workspace:~"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import {
ISequencedDocumentMessage,
} from "@fluidframework/protocol-definitions";
import {
IIdCompressor,
IInboundSignalMessage,
IProvideFluidDataStoreRegistry,
} from "@fluidframework/runtime-definitions";
import { IIdCompressor } from "@fluidframework/id-compressor";
import { IChannel } from ".";

/**
Expand Down
27 changes: 27 additions & 0 deletions packages/runtime/id-compressor/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*!
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/

module.exports = {
extends: [require.resolve("@fluidframework/eslint-config-fluid/minimal"), "prettier"],
parserOptions: {
project: ["./tsconfig.json", "./src/test/tsconfig.json"],
},
rules: {
"@typescript-eslint/strict-boolean-expressions": "off",

// This library is used in the browser, so we don't want dependencies on most node libraries.
"import/no-nodejs-modules": ["error", { allow: ["events"] }],
},
overrides: [
{
// Rules only for test files
files: ["*.spec.ts", "src/test/**"],
rules: {
// Test files are run in node only so additional node libraries can be used.
"import/no-nodejs-modules": ["error", { allow: ["assert", "crypto", "events"] }],
},
},
],
};
52 changes: 52 additions & 0 deletions packages/runtime/id-compressor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Compiled TypeScript and CSS
dist
lib

# Babel
public/scripts/es5

# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
.cache-loader

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
node_modules

# Typings
typings

# Debug log from npm
npm-debug.log

# Code coverage
nyc
.nyc_output/

# Chart dependencies
**/charts/*.tgz

# Generated modules
intel_modules/
temp_modules/
12 changes: 12 additions & 0 deletions packages/runtime/id-compressor/.mocharc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*!
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/

"use strict";

const getFluidTestMochaConfig = require("@fluidframework/mocha-test-setup/mocharc-common");

const packageDir = __dirname;
const config = getFluidTestMochaConfig(packageDir);
module.exports = config;
6 changes: 6 additions & 0 deletions packages/runtime/id-compressor/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
nyc
*.log
**/*.tsbuildinfo
src/test
dist/test
**/_api-extractor-temp/**
1 change: 1 addition & 0 deletions packages/runtime/id-compressor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# @fluidframework/id-compressor
Loading

0 comments on commit ef49d00

Please sign in to comment.