UNPKG

delta-store

Version:
68 lines (67 loc) 2.45 kB
import { SharedChangeList } from './RepositoryApi'; /** * Created by Papa on 1/10/2016. */ export interface ChangeListShareInfo { name: string; dbId: string; } export interface SharingPlatformSetupInfo { platformType: PlatformType; recordIdField: string; dbIdField: string; } export declare enum PlatformType { GOOGLE_DOCS = 0, IN_MEMORY = 1, OFFLINE = 2, STUB = 3, } export declare namespace deltaStore.platform { const GOOGLE = "GOOGLE"; const IN_MEMORY = "IN_MEMORY"; const STUB = "STUB"; function getName(platformType: PlatformType): string; function getValue(platformTypeName: string): PlatformType; } /** * Possible distribution strategies for Change List Federations. * * A common (and only currently supported) basic setup: * * There is always a Single Shared Store (S3). * There are always at least one or more 'Personal' Stores. * * The stores communicate via servers that propagate data from * personal stores to the shared store. * * What differs is how this propagation is accomplished. * * In the future, we'll add a truly distributed setup, without any S3s. */ export declare enum DistributionStrategy { /** * The server is aware of all Personal Stores and it * subscribes to any possible changes in any of these stores. * It is the server's responsibility to update the S3. */ S3_SECURE_POLL = 0, /** * There is no need for a server, all clients are aware of S3 * and are responsible for pushing their changes to it. */ S3_DISTIBUTED_PUSH = 1, } export declare namespace deltaStore.distributionStrategy { const S3_DISTRIBUTED_PUSH = "S3_DISTRIBUTED_PUSH"; const S3_SECURE_POLL = "S3_SECURE_POLL"; function getName(distributionStrategy: DistributionStrategy): string; function getValue(distributionStrategyName: string): DistributionStrategy; } export interface SharingAdaptor { setupInfoBelongsTo(setupInfo: SharingPlatformSetupInfo, setupInfos: SharingPlatformSetupInfo[]): boolean; initialize(setupInfo: SharingPlatformSetupInfo): Promise<any>; findExistingChangeLists(setupInfo: SharingPlatformSetupInfo): Promise<ChangeListShareInfo[]>; createChangeList(shareInfo: ChangeListShareInfo, setupInfo: SharingPlatformSetupInfo): Promise<SharedChangeList>; loadChangeList(shareInfo: ChangeListShareInfo, setupInfo: SharingPlatformSetupInfo): Promise<SharedChangeList>; }