Skip to content

Commit

Permalink
remove readString (#4779)
Browse files Browse the repository at this point in the history
  • Loading branch information
chensixx authored Jan 11, 2021
1 parent 973f019 commit 41be5b7
Show file tree
Hide file tree
Showing 12 changed files with 2 additions and 84 deletions.
10 changes: 0 additions & 10 deletions packages/drivers/debugger/src/fluidDebuggerController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> {
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<IVersion[]> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> {
const base64Result = await this.read(sha);
return fromBase64ToUtf8(base64Result);
}
}

export interface ISnapshotWriterStorage extends IDocumentStorageService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> {
return this.readWithEncodingOutput(blobId, "string");
}

private async readWithEncodingOutput(blobId: string, outputFormat: "base64" | "string"): Promise<string> {
const blob = await this.readBlobCore(blobId);

Expand Down
1 change: 0 additions & 1 deletion packages/drivers/replay-driver/src/replayController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export abstract class ReadDocumentStorageServiceBase implements IDocumentStorage
public abstract getVersions(versionId: string, count: number): Promise<api.IVersion[]>;
public abstract getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null>;
public abstract read(blobId: string): Promise<string>;
public abstract readString(blobId: string): Promise<string>;

public async uploadSummaryWithContext(summary: api.ISummaryTree, context: ISummaryContext): Promise<string> {
return Promise.reject(new Error("Invalid operation"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ export class ReplayControllerStatic extends ReplayController {
return Promise.reject(new Error("Invalid operation"));
}

public async readString(blobId: string): Promise<string> {
return Promise.reject(new Error("Invalid operation"));
}

public async getStartingOpSequence(): Promise<number> {
return 0;
}
Expand Down
21 changes: 1 addition & 20 deletions packages/drivers/replay-driver/src/storageImplementations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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<string> {
const base64Result = await this.read(blobId);
return fromBase64ToUtf8(base64Result);
}
}

export class SnapshotStorage extends ReadDocumentStorageServiceBase {
Expand Down Expand Up @@ -130,13 +122,6 @@ export class SnapshotStorage extends ReadDocumentStorageServiceBase {
public async read(blobId: string): Promise<string> {
return this.storage.read(blobId);
}

/**
* {@inheritDoc @fluidframework/driver-definitions#IDocumentStorageService.readString}
*/
public async readString(blobId: string): Promise<string> {
return this.storage.readString(blobId);
}
}

export class OpStorage extends ReadDocumentStorageServiceBase {
Expand All @@ -151,10 +136,6 @@ export class OpStorage extends ReadDocumentStorageServiceBase {
public async read(blobId: string): Promise<string> {
throw new Error(`Unknown blob ID: ${blobId}`);
}

public async readString(blobId: string): Promise<string> {
throw new Error(`Unknown blob ID: ${blobId}`);
}
}

export class StaticStorageDocumentService implements IDocumentService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -73,14 +73,6 @@ export class DocumentStorageService implements IDocumentStorageService {
return value.content;
}

/**
* {@inheritDoc @fluidframework/driver-definitions#IDocumentStorageService.readString}
*/
public async readString(blobId: string): Promise<string> {
const base64Result = await this.read(blobId);
return fromBase64ToUtf8(base64Result);
}

public async write(tree: ITree, parents: string[], message: string, ref: string): Promise<IVersion> {
const branch = ref ? `datastores/${this.id}/${ref}` : this.id;
const commit = await this.manager.write(branch, tree, parents, message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ export class NullBlobStorageService implements IDocumentStorageService {
return Promise.reject(new Error("Invalid operation"));
}

public async readString(blobId: string): Promise<string> {
return Promise.reject(new Error("Invalid operation"));
}

public async write(tree: api.ITree, parents: string[], message: string, ref: string): Promise<api.IVersion> {
return Promise.reject(new Error("Null blob storage can not write commit"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ export class RetriableDocumentStorageService extends DocumentStorageServiceProxy
return this.readWithRetry(async () => this.internalStorageService.readBlob(id));
}

public async readString(id: string): Promise<string> {
return this.readWithRetry(async () => this.internalStorageService.readString(id));
}

private async delay(timeMs: number): Promise<void> {
return new Promise((resolve) => setTimeout(() => resolve(), timeMs));
}
Expand Down
5 changes: 0 additions & 5 deletions packages/loader/driver-definitions/src/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@ export interface IDocumentStorageService {
*/
read(id: string): Promise<string>;

/**
* Reads the object with the given ID, returns content in utf8
*/
readString(id: string): Promise<string>;

/**
* Writes to the object with the given ID
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* Licensed under the MIT License.
*/

import { fromBase64ToUtf8 } from "@fluidframework/common-utils";
import {
IDocumentStorageService,
ISummaryContext,
Expand Down Expand Up @@ -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<string> {
const base64Result = await this.read(blobId);
return fromBase64ToUtf8(base64Result);
}

public async write(tree: ITree, parents: string[], message: string, ref: string): Promise<IVersion> {
return this.internalStorageService.write(tree, parents, message, ref);
}
Expand Down

0 comments on commit 41be5b7

Please sign in to comment.