2020-07-21 13:20:51 +00:00
|
|
|
import {DocEntry} from 'app/common/DocListAPI';
|
2020-10-30 16:53:23 +00:00
|
|
|
import {DocSnapshots} from 'app/common/DocSnapshot';
|
2022-05-16 17:41:12 +00:00
|
|
|
import {DocumentUsage} from 'app/common/DocUsage';
|
2020-07-21 13:20:51 +00:00
|
|
|
import {DocReplacementOptions} from 'app/common/UserAPI';
|
|
|
|
|
|
|
|
export interface IDocStorageManager {
|
|
|
|
getPath(docName: string): string;
|
|
|
|
getSampleDocPath(sampleDocName: string): string|null;
|
|
|
|
getCanonicalDocName(altDocName: string): Promise<string>;
|
|
|
|
|
|
|
|
// This method must not be called for the same docName twice in parallel.
|
|
|
|
// In the current implementation, it is called in the context of an
|
|
|
|
// AsyncCreate[docName].
|
2021-01-12 15:48:40 +00:00
|
|
|
prepareLocalDoc(docName: string): Promise<boolean>;
|
2020-12-21 14:46:50 +00:00
|
|
|
prepareToCreateDoc(docName: string): Promise<void>;
|
2021-04-28 18:53:18 +00:00
|
|
|
prepareFork(srcDocName: string, destDocName: string): Promise<string>; // Returns filename.
|
2020-07-21 13:20:51 +00:00
|
|
|
|
|
|
|
listDocs(): Promise<DocEntry[]>;
|
|
|
|
deleteDoc(docName: string, deletePermanently?: boolean): Promise<void>;
|
|
|
|
renameDoc(oldName: string, newName: string): Promise<void>;
|
|
|
|
makeBackup(docName: string, backupTag: string): Promise<string>;
|
|
|
|
showItemInFolder(docName: string): Promise<void>;
|
|
|
|
closeStorage(): Promise<void>;
|
|
|
|
closeDocument(docName: string): Promise<void>;
|
2020-10-30 16:53:23 +00:00
|
|
|
// Mark document as needing a backup (due to edits, migrations, etc).
|
|
|
|
// If reason is set to 'edit' the user-facing timestamp on the document should be updated.
|
|
|
|
markAsChanged(docName: string, reason?: 'edit'): void;
|
2022-05-16 17:41:12 +00:00
|
|
|
scheduleUsageUpdate(docName: string, usage: DocumentUsage|null, minimizeDelay?: boolean): void;
|
2020-07-21 13:20:51 +00:00
|
|
|
testReopenStorage(): void; // restart storage during tests
|
2020-12-21 14:46:50 +00:00
|
|
|
addToStorage(docName: string): Promise<void>; // add a new local document to storage
|
2020-07-21 13:20:51 +00:00
|
|
|
prepareToCloseStorage(): void; // speed up sync with remote store
|
|
|
|
getCopy(docName: string): Promise<string>; // get an immutable copy of a document
|
|
|
|
|
|
|
|
flushDoc(docName: string): Promise<void>; // flush a document to persistent storage
|
2020-12-18 17:37:16 +00:00
|
|
|
// If skipMetadataCache is set, then any caching of snapshots lists should be skipped.
|
|
|
|
// Metadata may not be returned in this case.
|
|
|
|
getSnapshots(docName: string, skipMetadataCache?: boolean): Promise<DocSnapshots>;
|
|
|
|
removeSnapshots(docName: string, snapshotIds: string[]): Promise<void>;
|
2020-07-21 13:20:51 +00:00
|
|
|
replace(docName: string, options: DocReplacementOptions): Promise<void>;
|
|
|
|
}
|