From 41be5b7aba7d28d1a962a97434786d30967c4fb5 Mon Sep 17 00:00:00 2001 From: chensixx <34214774+chensixx@users.noreply.github.com> Date: Mon, 11 Jan 2021 13:10:52 -0800 Subject: [PATCH] remove readString (#4779) --- .../debugger/src/fluidDebuggerController.ts | 10 --------- .../src/fileDocumentStorageService.ts | 8 ------- .../src/outerDocumentServiceFactory.ts | 3 --- .../src/odspDocumentStorageManager.ts | 7 ------- .../replay-driver/src/replayController.ts | 1 - .../src/replayDocumentDeltaConnection.ts | 4 ---- .../src/storageImplementations.ts | 21 +------------------ .../src/documentStorageService.ts | 10 +-------- .../src/nullBlobStorageService.ts | 4 ---- .../src/retriableDocumentStorageService.ts | 4 ---- .../loader/driver-definitions/src/storage.ts | 5 ----- .../src/documentStorageServiceProxy.ts | 9 -------- 12 files changed, 2 insertions(+), 84 deletions(-) diff --git a/packages/drivers/debugger/src/fluidDebuggerController.ts b/packages/drivers/debugger/src/fluidDebuggerController.ts index b0ed7578de4b..1669916a9268 100644 --- a/packages/drivers/debugger/src/fluidDebuggerController.ts +++ b/packages/drivers/debugger/src/fluidDebuggerController.ts @@ -251,16 +251,6 @@ export class DebugReplayController extends ReplayController implements IDebugger throw new Error("Reading blob before storage is setup properly"); } - /** - * {@inheritDoc @fluidframework/driver-definitions#IDocumentStorageService.readString} - */ - public async readString(blobId: string): Promise { - if (this.storage !== undefined) { - return this.storage.readString(blobId); - } - throw new Error("Reading blob before storage is setup properly"); - } - public async getVersions( versionId: string, count: number): Promise { diff --git a/packages/drivers/file-driver/src/fileDocumentStorageService.ts b/packages/drivers/file-driver/src/fileDocumentStorageService.ts index baee1aea22a7..832a5792edcb 100644 --- a/packages/drivers/file-driver/src/fileDocumentStorageService.ts +++ b/packages/drivers/file-driver/src/fileDocumentStorageService.ts @@ -103,14 +103,6 @@ export class FluidFetchReader extends ReadDocumentStorageServiceBase implements } throw new Error(`Can't find blob ${sha}`); } - - /** - * {@inheritDoc @fluidframework/driver-definitions#IDocumentStorageService.readString} - */ - public async readString(sha: string): Promise { - const base64Result = await this.read(sha); - return fromBase64ToUtf8(base64Result); - } } export interface ISnapshotWriterStorage extends IDocumentStorageService { diff --git a/packages/drivers/iframe-driver/src/outerDocumentServiceFactory.ts b/packages/drivers/iframe-driver/src/outerDocumentServiceFactory.ts index d9a6d6f1efb3..05047ba72ed8 100644 --- a/packages/drivers/iframe-driver/src/outerDocumentServiceFactory.ts +++ b/packages/drivers/iframe-driver/src/outerDocumentServiceFactory.ts @@ -174,9 +174,6 @@ export class DocumentServiceFactoryProxy implements IDocumentServiceFactoryProxy read: async (id) => { return storage.read(id); }, - readString: async (id) => { - return storage.readString(id); - }, write: async (root, parents, message, ref) => { return storage.write(root, parents, message, ref); }, diff --git a/packages/drivers/odsp-driver/src/odspDocumentStorageManager.ts b/packages/drivers/odsp-driver/src/odspDocumentStorageManager.ts index e15fbdedc7ce..adc1f6ac9f64 100644 --- a/packages/drivers/odsp-driver/src/odspDocumentStorageManager.ts +++ b/packages/drivers/odsp-driver/src/odspDocumentStorageManager.ts @@ -273,13 +273,6 @@ export class OdspDocumentStorageService implements IDocumentStorageService { return this.readWithEncodingOutput(blobId, "base64"); } - /** - * {@inheritDoc @fluidframework/driver-definitions#IDocumentStorageService.readString} - */ - public async readString(blobId: string): Promise { - return this.readWithEncodingOutput(blobId, "string"); - } - private async readWithEncodingOutput(blobId: string, outputFormat: "base64" | "string"): Promise { const blob = await this.readBlobCore(blobId); diff --git a/packages/drivers/replay-driver/src/replayController.ts b/packages/drivers/replay-driver/src/replayController.ts index a6d1a27521b7..f3a27bdba8e4 100644 --- a/packages/drivers/replay-driver/src/replayController.ts +++ b/packages/drivers/replay-driver/src/replayController.ts @@ -17,7 +17,6 @@ export abstract class ReadDocumentStorageServiceBase implements IDocumentStorage public abstract getVersions(versionId: string, count: number): Promise; public abstract getSnapshotTree(version?: api.IVersion): Promise; public abstract read(blobId: string): Promise; - public abstract readString(blobId: string): Promise; public async uploadSummaryWithContext(summary: api.ISummaryTree, context: ISummaryContext): Promise { return Promise.reject(new Error("Invalid operation")); diff --git a/packages/drivers/replay-driver/src/replayDocumentDeltaConnection.ts b/packages/drivers/replay-driver/src/replayDocumentDeltaConnection.ts index 342201b0fd24..8cfec6b0de79 100644 --- a/packages/drivers/replay-driver/src/replayDocumentDeltaConnection.ts +++ b/packages/drivers/replay-driver/src/replayDocumentDeltaConnection.ts @@ -71,10 +71,6 @@ export class ReplayControllerStatic extends ReplayController { return Promise.reject(new Error("Invalid operation")); } - public async readString(blobId: string): Promise { - return Promise.reject(new Error("Invalid operation")); - } - public async getStartingOpSequence(): Promise { return 0; } diff --git a/packages/drivers/replay-driver/src/storageImplementations.ts b/packages/drivers/replay-driver/src/storageImplementations.ts index 7f48358a4136..4ace05267631 100644 --- a/packages/drivers/replay-driver/src/storageImplementations.ts +++ b/packages/drivers/replay-driver/src/storageImplementations.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. */ -import { assert, fromBase64ToUtf8 } from "@fluidframework/common-utils"; +import { assert } from "@fluidframework/common-utils"; import { IDocumentDeltaConnection, IDocumentDeltaStorageService, @@ -91,14 +91,6 @@ export class FileSnapshotReader extends ReadDocumentStorageServiceBase implement } throw new Error(`Unknown blob ID: ${blobId}`); } - - /** - * {@inheritDoc @fluidframework/driver-definitions#IDocumentStorageService.readString} - */ - public async readString(blobId: string): Promise { - const base64Result = await this.read(blobId); - return fromBase64ToUtf8(base64Result); - } } export class SnapshotStorage extends ReadDocumentStorageServiceBase { @@ -130,13 +122,6 @@ export class SnapshotStorage extends ReadDocumentStorageServiceBase { public async read(blobId: string): Promise { return this.storage.read(blobId); } - - /** - * {@inheritDoc @fluidframework/driver-definitions#IDocumentStorageService.readString} - */ - public async readString(blobId: string): Promise { - return this.storage.readString(blobId); - } } export class OpStorage extends ReadDocumentStorageServiceBase { @@ -151,10 +136,6 @@ export class OpStorage extends ReadDocumentStorageServiceBase { public async read(blobId: string): Promise { throw new Error(`Unknown blob ID: ${blobId}`); } - - public async readString(blobId: string): Promise { - throw new Error(`Unknown blob ID: ${blobId}`); - } } export class StaticStorageDocumentService implements IDocumentService { diff --git a/packages/drivers/routerlicious-driver/src/documentStorageService.ts b/packages/drivers/routerlicious-driver/src/documentStorageService.ts index f968b064aa47..ed12e7f22c96 100644 --- a/packages/drivers/routerlicious-driver/src/documentStorageService.ts +++ b/packages/drivers/routerlicious-driver/src/documentStorageService.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. */ -import { assert, fromBase64ToUtf8, gitHashFile, IsoBuffer, Uint8ArrayToString } from "@fluidframework/common-utils"; +import { assert, gitHashFile, IsoBuffer, Uint8ArrayToString } from "@fluidframework/common-utils"; import { IDocumentStorageService, ISummaryContext } from "@fluidframework/driver-definitions"; import * as resources from "@fluidframework/gitresources"; import { buildHierarchy } from "@fluidframework/protocol-base"; @@ -73,14 +73,6 @@ export class DocumentStorageService implements IDocumentStorageService { return value.content; } - /** - * {@inheritDoc @fluidframework/driver-definitions#IDocumentStorageService.readString} - */ - public async readString(blobId: string): Promise { - const base64Result = await this.read(blobId); - return fromBase64ToUtf8(base64Result); - } - public async write(tree: ITree, parents: string[], message: string, ref: string): Promise { const branch = ref ? `datastores/${this.id}/${ref}` : this.id; const commit = await this.manager.write(branch, tree, parents, message); diff --git a/packages/drivers/routerlicious-driver/src/nullBlobStorageService.ts b/packages/drivers/routerlicious-driver/src/nullBlobStorageService.ts index cd9f5b7cbac4..77760ae0498d 100644 --- a/packages/drivers/routerlicious-driver/src/nullBlobStorageService.ts +++ b/packages/drivers/routerlicious-driver/src/nullBlobStorageService.ts @@ -27,10 +27,6 @@ export class NullBlobStorageService implements IDocumentStorageService { return Promise.reject(new Error("Invalid operation")); } - public async readString(blobId: string): Promise { - return Promise.reject(new Error("Invalid operation")); - } - public async write(tree: api.ITree, parents: string[], message: string, ref: string): Promise { return Promise.reject(new Error("Null blob storage can not write commit")); } diff --git a/packages/loader/container-loader/src/retriableDocumentStorageService.ts b/packages/loader/container-loader/src/retriableDocumentStorageService.ts index 30f2d0bf9227..d54e338f7512 100644 --- a/packages/loader/container-loader/src/retriableDocumentStorageService.ts +++ b/packages/loader/container-loader/src/retriableDocumentStorageService.ts @@ -35,10 +35,6 @@ export class RetriableDocumentStorageService extends DocumentStorageServiceProxy return this.readWithRetry(async () => this.internalStorageService.readBlob(id)); } - public async readString(id: string): Promise { - return this.readWithRetry(async () => this.internalStorageService.readString(id)); - } - private async delay(timeMs: number): Promise { return new Promise((resolve) => setTimeout(() => resolve(), timeMs)); } diff --git a/packages/loader/driver-definitions/src/storage.ts b/packages/loader/driver-definitions/src/storage.ts index eae6813056bb..cfba1fc980bd 100644 --- a/packages/loader/driver-definitions/src/storage.ts +++ b/packages/loader/driver-definitions/src/storage.ts @@ -69,11 +69,6 @@ export interface IDocumentStorageService { */ read(id: string): Promise; - /** - * Reads the object with the given ID, returns content in utf8 - */ - readString(id: string): Promise; - /** * Writes to the object with the given ID */ diff --git a/packages/loader/driver-utils/src/documentStorageServiceProxy.ts b/packages/loader/driver-utils/src/documentStorageServiceProxy.ts index 20154ff9a4e6..130b1af12cb5 100644 --- a/packages/loader/driver-utils/src/documentStorageServiceProxy.ts +++ b/packages/loader/driver-utils/src/documentStorageServiceProxy.ts @@ -3,7 +3,6 @@ * Licensed under the MIT License. */ -import { fromBase64ToUtf8 } from "@fluidframework/common-utils"; import { IDocumentStorageService, ISummaryContext, @@ -36,14 +35,6 @@ export class DocumentStorageServiceProxy implements IDocumentStorageService { return this.internalStorageService.read(blobId); } - /** - * {@inheritDoc @fluidframework/driver-definitions#IDocumentStorageService.readString} - */ - public async readString(blobId: string): Promise { - const base64Result = await this.read(blobId); - return fromBase64ToUtf8(base64Result); - } - public async write(tree: ITree, parents: string[], message: string, ref: string): Promise { return this.internalStorageService.write(tree, parents, message, ref); }