(core) updates from grist-core

This commit is contained in:
Paul Fitzpatrick
2023-07-23 11:53:20 -04:00
9 changed files with 645 additions and 234 deletions

View File

@@ -2138,6 +2138,9 @@ export class ActiveDoc extends EventEmitter {
private async _checkDataSizeLimitRatio(docSession: OptDocSession | null) {
const start = Date.now();
if (!this.docStorage.isInitialized()) {
return;
}
const dataSizeBytes = await this._updateDataSize();
const timeToMeasure = Date.now() - start;
log.rawInfo('Data size from dbstat...', {

View File

@@ -25,19 +25,21 @@ type MinIOBucketItemStat = minio.BucketItemStat & {
* will work with MinIO and other S3-compatible storage.
*/
export class MinIOExternalStorage implements ExternalStorage {
private _s3: MinIOClient;
// Specify bucket to use, and optionally the max number of keys to request
// in any call to listObjectVersions (used for testing)
constructor(public bucket: string, public options: {
endPoint: string,
port?: number,
useSSL?: boolean,
accessKey: string,
secretKey: string,
region: string
}, private _batchSize?: number) {
this._s3 = new minio.Client(options) as MinIOClient;
constructor(
public bucket: string,
public options: {
endPoint: string,
port?: number,
useSSL?: boolean,
accessKey: string,
secretKey: string,
region: string
},
private _batchSize?: number,
private _s3 = new minio.Client(options) as MinIOClient
) {
}
public async exists(key: string, snapshotId?: string) {
@@ -131,7 +133,10 @@ export class MinIOExternalStorage implements ExternalStorage {
(options?.includeDeleteMarkers || !(v as any).isDeleteMarker))
.map(v => ({
lastModified: v.lastModified.toISOString(),
snapshotId: (v as any).versionId!,
// Circumvent inconsistency of MinIO API with versionId by casting it to string
// PR to MinIO so we don't have to do that anymore:
// https://github.com/minio/minio-js/pull/1193
snapshotId: String((v as any).versionId!),
}));
}