import { CausalRepoObject, CausalRepoBranch, CausalRepoIndex, CausalRepoReflog, CausalRepoSitelog, CausalRepoSitelogType, CausalRepoSitelogConnectionReason, CausalRepoBranchSettings } from './CausalRepoObject'; /** * Defines an interface for a causal repo store. * A causal repo store is simply a key/value store of CausalRepoObjects. */ export interface CausalRepoStore extends CausalObjectStore, CausalBranchStore { } /** * Defines an interface for a causal branch store. * A causal branch store is a store for branches. */ export interface CausalBranchStore { /** * 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. * The old branch will be saved as a ref. * @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; /** * Gets the reflog for the given branch. * Useful for recovering references to old commits. * The returned reflog list will be sorted from most recent to least recent. * @param branch The name of the branch. */ getReflog(branch: string): Promise; /** * Gets the sitelog for the given branch. * Useful for recovering a list of atoms that have been added to the given branch. * The returned sitelog list will be sorted from most recent to least recent. * @param branch The name of the branch. */ getSitelog(branch: string): Promise; /** * Logs that the given site connected to the given branch. * @param branch The name of the branch. * @param site The site. * @param type The type of the sitelog. */ logSite(branch: string, site: string, type: CausalRepoSitelogType, connectionReason?: CausalRepoSitelogConnectionReason): Promise; /** * Gets the most recent settings that have been created the given branch. * @param branch The branch. */ getBranchSettings(branch: string): Promise; /** * Saves the given branch settings. * @param settings The settings to save. */ saveSettings(settings: CausalRepoBranchSettings): Promise; } /** * Defines an interface for a causal object store. * A causal object store is simply a key/value store of Causal Repo Objects. */ export interface CausalObjectStore { /** * Gets the objects with the given key. * @param head The head that the keys are being loaded for. * @param key The keys. */ getObjects(head: string, keys: string[]): Promise; /** * Gets the object with the given key. * @param key The key. */ getObject(key: string): Promise; /** * Gets the objects that are stored for the given index. * @param head The head that the objects are being stored for. * @param index The hash of the index. */ loadIndex?(head: string, index: CausalRepoIndex): Promise; /** * Stores the given objects. * @param head The head that the objects are being stored for. * @param objects The objects to store. */ storeObjects(head: string, objects: CausalRepoObject[]): Promise; /** * Stores the given objects by the given index hash. * @param head The head that the objects are being stored for. * @param index The hash of the index. * @param objects The objects to store in the index. */ storeIndex?(head: string, index: string, objects: CausalRepoObject[]): Promise; } /** * Defines a class that uses one store for branches and another store for objects. */ export declare class CombinedCausalRepoStore implements CausalRepoStore { private _branches; private _objects; constructor(branches: CausalBranchStore, objects: CausalObjectStore); getBranchSettings(branch: string): Promise; saveSettings(settings: CausalRepoBranchSettings): Promise; getReflog(branch: string): Promise; getSitelog(branch: string): Promise; logSite(branch: string, site: string, type: CausalRepoSitelogType, connectionReason: CausalRepoSitelogConnectionReason): Promise; loadIndex: (head: string, index: CausalRepoIndex) => Promise; storeIndex: (head: string, index: string, objects: CausalRepoObject[]) => Promise; private _loadIndex; private _storeIndex; getObjects(head: string, keys: string[]): Promise; getObject(key: string): Promise; storeObjects(head: string, objects: CausalRepoObject[]): Promise; getBranches(prefix: string): Promise; saveBranch(head: CausalRepoBranch): Promise; deleteBranch(head: CausalRepoBranch): Promise; } /** * Defines a class that tries loading objects from one store before trying another store. */ export declare class FallbackCausalObjectStore implements CausalObjectStore { private _first; private _second; constructor(first: CausalObjectStore, second: CausalObjectStore); loadIndex(head: string, index: CausalRepoIndex): Promise; storeIndex(head: string, index: string, objects: CausalRepoObject[]): Promise; getObjects(head: string, keys: string[]): Promise; getObject(key: string): Promise; storeObjects(head: string, objects: CausalRepoObject[]): Promise; } //# sourceMappingURL=CausalRepoStore.d.ts.map