Skip to content

Commit fbfeda1

Browse files
1 parent 775efa8 commit fbfeda1

25 files changed

Lines changed: 549 additions & 544 deletions

‎handwritten/storage/internal-tooling/performApplicationPerformanceTest.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ async function main() {
5656

5757
({bucket} = await performanceTestSetup(
5858
argv.project! as string,
59-
argv.bucket! as string
59+
argv.bucket! as string,
6060
));
6161

6262
switch (argv.test_type) {
@@ -78,7 +78,7 @@ async function main() {
7878
async function uploadInParallel(
7979
bucket: Bucket,
8080
paths: string[],
81-
options: UploadOptions
81+
options: UploadOptions,
8282
) {
8383
const promises: Promise<UploadResponse>[] = [];
8484
for (const index in paths) {
@@ -115,7 +115,7 @@ async function performWriteTest(): Promise<TestResult> {
115115
argv.num_objects as number,
116116
TEST_NAME_STRING,
117117
fileSizeRange.low,
118-
fileSizeRange.high
118+
fileSizeRange.high,
119119
);
120120

121121
const start = performance.now();
@@ -157,7 +157,7 @@ async function performReadTest(): Promise<TestResult> {
157157
argv.num_objects as number,
158158
TEST_NAME_STRING,
159159
fileSizeRange.low,
160-
fileSizeRange.high
160+
fileSizeRange.high,
161161
);
162162
await uploadInParallel(bucket, creationInfo.paths, {validation: checkType});
163163

‎handwritten/storage/internal-tooling/performPerformanceTest.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ async function main() {
5454

5555
({bucket} = await performanceTestSetup(
5656
argv.project! as string,
57-
argv.bucket! as string
57+
argv.bucket! as string,
5858
));
5959

6060
switch (argv.test_type) {
@@ -84,7 +84,7 @@ async function performRangedReadTest(): Promise<TestResult[]> {
8484
fileName,
8585
fileSizeRange.low,
8686
fileSizeRange.high,
87-
getDirName()
87+
getDirName(),
8888
);
8989
const file = bucket.file(`${fileName}`);
9090
const destinationFileName = generateRandomFileName(TEST_NAME_STRING);
@@ -142,7 +142,7 @@ async function performWriteReadTest(): Promise<TestResult[]> {
142142
fileName,
143143
fileSizeRange.low,
144144
fileSizeRange.high,
145-
getDirName()
145+
getDirName(),
146146
);
147147

148148
for (let j = 0; j < DEFAULT_NUMBER_OF_WRITES; j++) {

‎handwritten/storage/internal-tooling/performTransferManagerTest.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ async function main() {
5656

5757
({bucket, transferManager} = await performanceTestSetup(
5858
argv.project! as string,
59-
argv.bucket! as string
59+
argv.bucket! as string,
6060
));
6161

6262
switch (argv.test_type) {
@@ -104,7 +104,7 @@ async function performUploadManyFilesTest(): Promise<TestResult[]> {
104104
TEST_NAME_STRING,
105105
fileSizeRange.low,
106106
fileSizeRange.high,
107-
DIRECTORY_PROBABILITY
107+
DIRECTORY_PROBABILITY,
108108
);
109109

110110
const start = performance.now();
@@ -153,7 +153,7 @@ async function performDownloadManyFilesTest(): Promise<TestResult[]> {
153153
TEST_NAME_STRING,
154154
fileSizeRange.low,
155155
fileSizeRange.high,
156-
DIRECTORY_PROBABILITY
156+
DIRECTORY_PROBABILITY,
157157
);
158158

159159
await transferManager.uploadManyFiles(creationInfo.paths, {
@@ -210,7 +210,7 @@ async function performChunkUploadDownloadTest(): Promise<TestResult[]> {
210210
fileName,
211211
fileSizeRange.low,
212212
fileSizeRange.high,
213-
getDirName()
213+
getDirName(),
214214
);
215215
const file = bucket.file(`${fileName}`);
216216
let result: TestResult = {

‎handwritten/storage/internal-tooling/performanceTest.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function main() {
4444
if (numThreads > iterationsRemaining) {
4545
log(
4646
`${numThreads} is greater than number of iterations (${iterationsRemaining}). Using ${iterationsRemaining} threads instead.`,
47-
argv.debug as boolean
47+
argv.debug as boolean,
4848
);
4949
numThreads = iterationsRemaining;
5050
}
@@ -65,7 +65,7 @@ function createWorker() {
6565
iterationsRemaining--;
6666
log(
6767
`Starting new iteration. Current iterations remaining: ${iterationsRemaining}`,
68-
argv.debug as boolean
68+
argv.debug as boolean,
6969
);
7070
let testPath = '';
7171
if (
@@ -122,7 +122,7 @@ async function recordResult(results: TestResult[] | TestResult) {
122122
: [results];
123123

124124
for await (const outputString of convertToCloudMonitoringFormat(
125-
resultsToAppend
125+
resultsToAppend,
126126
)) {
127127
argv.file_name
128128
? await appendFile(argv.file_name as string, `${outputString}\n`)

‎handwritten/storage/internal-tooling/performanceUtils.ts‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -214,20 +214,20 @@ export function generateRandomFileName(baseName: string): string {
214214
export function generateRandomFile(
215215
fileName: string,
216216
fileSizeLowerBoundBytes: number = getLowHighFileSize(
217-
DEFAULT_OBJECT_RANGE_SIZE_BYTES
217+
DEFAULT_OBJECT_RANGE_SIZE_BYTES,
218218
).low,
219219
fileSizeUpperBoundBytes: number = getLowHighFileSize(
220-
DEFAULT_OBJECT_RANGE_SIZE_BYTES
220+
DEFAULT_OBJECT_RANGE_SIZE_BYTES,
221221
).high,
222-
currentDirectory: string = mkdtempSync(randomString())
222+
currentDirectory: string = mkdtempSync(randomString()),
223223
): number {
224224
const fileSizeBytes = randomInteger(
225225
fileSizeLowerBoundBytes,
226-
fileSizeUpperBoundBytes
226+
fileSizeUpperBoundBytes,
227227
);
228228

229229
execSync(
230-
`head --bytes=${fileSizeBytes} /dev/urandom > ${currentDirectory}/${fileName}`
230+
`head --bytes=${fileSizeBytes} /dev/urandom > ${currentDirectory}/${fileName}`,
231231
);
232232

233233
return fileSizeBytes;
@@ -247,12 +247,12 @@ export function generateRandomDirectoryStructure(
247247
maxObjects: number,
248248
baseName: string,
249249
fileSizeLowerBoundBytes: number = getLowHighFileSize(
250-
DEFAULT_OBJECT_RANGE_SIZE_BYTES
250+
DEFAULT_OBJECT_RANGE_SIZE_BYTES,
251251
).low,
252252
fileSizeUpperBoundBytes: number = getLowHighFileSize(
253-
DEFAULT_OBJECT_RANGE_SIZE_BYTES
253+
DEFAULT_OBJECT_RANGE_SIZE_BYTES,
254254
).high,
255-
directoryProbability: number = DEFAULT_DIRECTORY_PROBABILITY
255+
directoryProbability: number = DEFAULT_DIRECTORY_PROBABILITY,
256256
): RandomDirectoryCreationInformation {
257257
let curPath = baseName;
258258
const creationInfo: RandomDirectoryCreationInformation = {
@@ -272,7 +272,7 @@ export function generateRandomDirectoryStructure(
272272
randomName,
273273
fileSizeLowerBoundBytes,
274274
fileSizeUpperBoundBytes,
275-
curPath
275+
curPath,
276276
);
277277
creationInfo.paths.push(path.join(curPath, randomName));
278278
}
@@ -288,7 +288,7 @@ export function generateRandomDirectoryStructure(
288288
*/
289289
export function cleanupFile(
290290
fileName: string,
291-
directoryName: string = getDirName()
291+
directoryName: string = getDirName(),
292292
): void {
293293
unlinkSync(`${directoryName}/${fileName}`);
294294
}
@@ -302,7 +302,7 @@ export function cleanupFile(
302302
*/
303303
export async function performanceTestSetup(
304304
projectId: string,
305-
bucketName: string
305+
bucketName: string,
306306
): Promise<PerformanceTestSetupResults> {
307307
const storage = new Storage({projectId});
308308
const bucket = storage.bucket(bucketName, {
@@ -346,7 +346,7 @@ export function getValidationType(): 'md5' | 'crc32c' | boolean | undefined {
346346
* @returns {AsyncGenerator<string>} A string containing the results of the conversion to cloud monitoring format.
347347
*/
348348
export async function* convertToCloudMonitoringFormat(
349-
results: TestResult[]
349+
results: TestResult[],
350350
): AsyncGenerator<string> {
351351
for (const curResult of results) {
352352
const throughput =
@@ -384,7 +384,7 @@ export async function* convertToCloudMonitoringFormat(
384384
export function log(
385385
messageOrError: string | Error,
386386
shouldLog: boolean,
387-
isError = false
387+
isError = false,
388388
): void {
389389
if (shouldLog) {
390390
isError ? console.error(messageOrError) : console.log(messageOrError);

‎handwritten/storage/src/acl.ts‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export interface AclOptions {
2323
pathPrefix: string;
2424
request: (
2525
reqOpts: DecorateRequestOptions,
26-
callback: BodyResponseCallback
26+
callback: BodyResponseCallback,
2727
) => void;
2828
}
2929

@@ -35,7 +35,7 @@ export interface GetAclCallback {
3535
(
3636
err: Error | null,
3737
acl?: AccessControlObject | AccessControlObject[] | null,
38-
apiResponse?: AclMetadata
38+
apiResponse?: AclMetadata,
3939
): void;
4040
}
4141
export interface GetAclOptions {
@@ -55,7 +55,7 @@ export interface UpdateAclCallback {
5555
(
5656
err: Error | null,
5757
acl?: AccessControlObject | null,
58-
apiResponse?: AclMetadata
58+
apiResponse?: AclMetadata,
5959
): void;
6060
}
6161

@@ -70,7 +70,7 @@ export interface AddAclCallback {
7070
(
7171
err: Error | null,
7272
acl?: AccessControlObject | null,
73-
apiResponse?: AclMetadata
73+
apiResponse?: AclMetadata,
7474
): void;
7575
}
7676
export type RemoveAclResponse = [AclMetadata];
@@ -331,7 +331,7 @@ class AclRoleAccessorMethods {
331331
(acc as any)[method] = (
332332
entityId: string,
333333
options: {},
334-
callback: Function | {}
334+
callback: Function | {},
335335
) => {
336336
let apiEntity;
337337

@@ -355,7 +355,7 @@ class AclRoleAccessorMethods {
355355
entity: apiEntity,
356356
role,
357357
},
358-
options
358+
options,
359359
);
360360

361361
const args = [options];
@@ -420,7 +420,7 @@ class Acl extends AclRoleAccessorMethods {
420420
pathPrefix: string;
421421
request_: (
422422
reqOpts: DecorateRequestOptions,
423-
callback: BodyResponseCallback
423+
callback: BodyResponseCallback,
424424
) => void;
425425

426426
constructor(options: AclOptions) {
@@ -508,7 +508,7 @@ class Acl extends AclRoleAccessorMethods {
508508
*/
509509
add(
510510
options: AddAclOptions,
511-
callback?: AddAclCallback
511+
callback?: AddAclCallback,
512512
): void | Promise<AddAclResponse> {
513513
const query = {} as AclQuery;
514514

@@ -538,7 +538,7 @@ class Acl extends AclRoleAccessorMethods {
538538
}
539539

540540
callback!(null, this.makeAclObject_(resp), resp);
541-
}
541+
},
542542
);
543543
}
544544

@@ -608,7 +608,7 @@ class Acl extends AclRoleAccessorMethods {
608608
*/
609609
delete(
610610
options: RemoveAclOptions,
611-
callback?: RemoveAclCallback
611+
callback?: RemoveAclCallback,
612612
): void | Promise<RemoveAclResponse> {
613613
const query = {} as AclQuery;
614614

@@ -628,7 +628,7 @@ class Acl extends AclRoleAccessorMethods {
628628
},
629629
(err, resp) => {
630630
callback!(err, resp);
631-
}
631+
},
632632
);
633633
}
634634

@@ -722,7 +722,7 @@ class Acl extends AclRoleAccessorMethods {
722722
*/
723723
get(
724724
optionsOrCallback?: GetAclOptions | GetAclCallback,
725-
cb?: GetAclCallback
725+
cb?: GetAclCallback,
726726
): void | Promise<GetAclResponse> {
727727
const options =
728728
typeof optionsOrCallback === 'object' ? optionsOrCallback : null;
@@ -763,7 +763,7 @@ class Acl extends AclRoleAccessorMethods {
763763
}
764764

765765
callback!(null, results, resp);
766-
}
766+
},
767767
);
768768
}
769769

@@ -830,7 +830,7 @@ class Acl extends AclRoleAccessorMethods {
830830
*/
831831
update(
832832
options: UpdateAclOptions,
833-
callback?: UpdateAclCallback
833+
callback?: UpdateAclCallback,
834834
): void | Promise<UpdateAclResponse> {
835835
const query = {} as AclQuery;
836836

@@ -858,7 +858,7 @@ class Acl extends AclRoleAccessorMethods {
858858
}
859859

860860
callback!(null, this.makeAclObject_(resp), resp);
861-
}
861+
},
862862
);
863863
}
864864

@@ -868,7 +868,7 @@ class Acl extends AclRoleAccessorMethods {
868868
* @private
869869
*/
870870
makeAclObject_(
871-
accessControlObject: AccessControlObject
871+
accessControlObject: AccessControlObject,
872872
): AccessControlObject {
873873
const obj = {
874874
entity: accessControlObject.entity,
@@ -895,7 +895,7 @@ class Acl extends AclRoleAccessorMethods {
895895
*/
896896
request(
897897
reqOpts: DecorateRequestOptions,
898-
callback: BodyResponseCallback
898+
callback: BodyResponseCallback,
899899
): void {
900900
reqOpts.uri = this.pathPrefix + reqOpts.uri;
901901
this.request_(reqOpts, callback);

0 commit comments

Comments
 (0)