import { Collection } from 'mongodb'; import { CausalRepoStore, CausalRepoObject, CausalRepoBranch, CausalRepoIndex, CausalRepoReflog, CausalRepoSitelog, CausalRepoSitelogType, CausalRepoSitelogConnectionReason, CausalRepoBranchSettings } from '@casual-simulation/causal-trees/core2'; /** * Defines a class that is able to store a causal tree in MongoDB. */ export declare class MongoDBRepoStore implements CausalRepoStore { private _objects; private _heads; private _indexes; private _reflog; private _sitelog; private _settings; constructor(objectsCollection: Collection, headsCollection: Collection, indexesCollection: Collection, reflogCollection: Collection, sitelogCollection: Collection, branchSettingsCollection: Collection); init(): Promise; getBranchSettings(branch: string): Promise; saveSettings(settings: CausalRepoBranchSettings): Promise; getSitelog(branch: string): Promise; logSite(branch: string, site: string, type: CausalRepoSitelogType, connectionReason: CausalRepoSitelogConnectionReason): Promise; getReflog(branch: string): Promise; loadIndex(head: string, index: CausalRepoIndex): Promise; storeIndex(head: string, index: string, objects: CausalRepoObject[]): Promise; getObjects(head: string, keys: string[]): Promise; getObject(key: string): Promise; /** * Stores the given objects. * @param objects The objects to store. */ storeObjects(head: string, objects: CausalRepoObject[]): Promise; /** * Gets the list of branches that match the given prefix. * @param prefix The prefix that branch names should match. If null, then all branches are returned. */ getBranches(prefix: string | null): Promise; /** * Saves/updates the given head to the given repo. * @param head The branch to save. */ saveBranch(head: CausalRepoBranch): Promise; /** * Deletes the given branch from the repo. * @param head The branch to delete. */ deleteBranch(head: CausalRepoBranch): Promise; } export declare function handleMongoDBDuplicateErrors(err: any): void; export interface MongoDBHead extends CausalRepoBranch { } export interface MongoDBObject { _id: string; object: CausalRepoObject; } export interface MongoDBIndex { _id: string; objects: CausalRepoObject[]; } export interface MongoDBReflog { _id?: any; branch: string; hash: string; time: Date; } export interface MongoDBSitelog { _id?: any; branch: string; site: string; time: Date; sitelogType?: CausalRepoSitelogType; } export interface MongoDBBranchSettings { _id?: any; branch: string; time: Date; passwordHash?: string; } export declare function escapeRegex(value: string): string; export declare const REGEX_SPECIAL_CHARACTERS: string[]; //# sourceMappingURL=MongoDBRepoStore.d.ts.map