import { BinaryFileData , Datastore , DatastoreID , DatastoreInitOpts , DatastoreOverview , DeleteResult , DocMetaSnapshotOpts , DocMetaSnapshotResult , ErrorListener , InitResult , WriteFileOpts , WriteOpts } from './Datastore' ; import { Backend } from 'polar-shared/src/datastore/Backend' ; import { DocMetaFileRef , DocMetaRef } from './DocMetaRef' ; import { DatastoreMutation } from './DatastoreMutation' ; import { DocFileMeta } from 'polar-shared/src/datastore/DocFileMeta' ; import { IDocInfo } from 'polar-shared/src/metadata/IDocInfo' ; import { RendererAnalytics } from '../ga/RendererAnalytics' ; import { DelegatedDatastore } from './DelegatedDatastore' ; import { IDocMeta } from "polar-shared/src/metadata/IDocMeta" ; import { FileRef } from "polar-shared/src/datastore/FileRef" ; import { GetFileOpts } from "polar-shared/src/datastore/IDatastore" ; const tracer = RendererAnalytics . createTracer ( 'datastore' ) ; NotStale export class TracedDatastore extends DelegatedDatastore { constructor ( public readonly delegate , public readonly id = 'traced' ) { super ( delegate ) ; } public async contains ( fingerprint ) { return tracer . traceAsync ( 'contains' , ( ) => this . delegate . contains ( fingerprint ) ) ; } public async containsFile ( backend , ref ) { return tracer . traceAsync ( 'containsFile' , ( ) => this . delegate . containsFile ( backend , ref ) ) ; } public async createBackup ( ) { return tracer . traceAsync ( 'createBackup' , ( ) => this . delegate . createBackup ( ) ) ; } public async deactivate ( ) { return tracer . traceAsync ( 'deactivate' , ( ) => this . delegate . deactivate ( ) ) ; } public async delete ( docMetaFileRef , datastoreMutation ? ) { return tracer . traceAsync ( 'delete' , ( ) => this . delegate . delete ( docMetaFileRef , datastoreMutation ) ) ; } public async deleteFile ( backend , ref ) { return tracer . traceAsync ( 'deleteFile' , ( ) => this . delegate . deleteFile ( backend , ref ) ) ; } public async getDocMeta ( fingerprint ) { return tracer . traceAsync ( 'getDocMeta' , ( ) => this . delegate . getDocMeta ( fingerprint ) ) ; } public async getDocMetaSnapshot ( opts ) { return tracer . traceAsync ( 'getDocMetaSnapshot' , ( ) => this . delegate . getDocMetaSnapshot ( opts ) ) ; } public async getDocMetaRefs ( ) { return tracer . traceAsync ( 'getDocMetaRefs' , ( ) => this . delegate . getDocMetaRefs ( ) ) ; } public getFile ( backend , ref , opts ? ) { return tracer . trace ( 'getFile' , ( ) => this . delegate . getFile ( backend , ref , opts ) ) ; } public async init ( errorListener ? , opts ? ) { return tracer . traceAsync ( 'init' , ( ) => this . delegate . init ( errorListener , opts ) ) ; } public async overview ( ) { return tracer . traceAsync ( 'overview' , ( ) => this . delegate . overview ( ) ) ; } public async synchronizeDocs ( ... docMetaRefs ) { return tracer . traceAsync ( 'synchronizeDocs' , ( ) => this . delegate . synchronizeDocs ( ... docMetaRefs ) ) ; } public async write ( fingerprint , data , docInfo , opts ? ) { return tracer . traceAsync ( 'write' , ( ) => this . delegate . write ( fingerprint , data , docInfo , opts ) ) ; } public async writeDocMeta ( docMeta , datastoreMutation ? ) { return tracer . traceAsync ( 'writeDocMeta' , ( ) => this . delegate . writeDocMeta ( docMeta , datastoreMutation ) ) ; } public async writeFile ( backend , ref , data , opts ? ) { return tracer . traceAsync ( 'writeFile' , ( ) => this . delegate . writeFile ( backend , ref , data , opts ) ) ; } }