Hierarchy

  • TypedEmitter
    • SyncApi

Constructors

  • Parameters

    • opts: {
          blobStore: BlobStore;
          coreManager: CoreManager;
          coreOwnership: CoreOwnership;
          getReplicationStream: (() => ReplicationStream);
          getServerWebsocketUrls: (() => Promise<Iterable<string, any, any>>);
          logger: undefined | Logger;
          makeWebsocket: undefined | ((url: string) => WebSocket);
          roles: Roles;
          throttleMs: undefined | number;
      }

    Returns SyncApi

Properties

[kSyncState]: SyncState

Methods

  • Parameters

    • discoveryKey: Buffer
    • protomux: Protomux<NoiseSecretStream<Duplex<any, any, any, any, true, true, DuplexEvents<any, any>>>>

    Returns void

  • Request a graceful stop to all sync.

    Returns void

  • Rescind any requests for a full stop.

    Returns void

  • Parameters

    • deviceId: string
    • abortSignal: AbortSignal

    Returns Promise<void>

  • Returns void

  • Returns void

  • Get the current sync state (initial and full). Also emitted via the 'sync-state' event

    Returns State

  • Parameters

    • autostopDataSyncAfter: null | number

    Returns void

  • Start syncing data cores.

    If the app is backgrounded and sync has already completed, this will do nothing until the app is foregrounded.

    Parameters

    • Optionaloptions: {
          autostopDataSyncAfter: undefined | null | number;
      } = {}
      • autostopDataSyncAfter: undefined | null | number

        If no data sync happens after this duration in milliseconds, sync will be automatically stopped as if stop was called.

    Returns void

  • Stop syncing data cores.

    Pre-sync cores will continue syncing unless the app is backgrounded.

    Returns void

  • Parameters

    • type: SyncType
    • Optionaloptions: {
          timeoutMs: undefined | number;
      } = {}
      • timeoutMs: undefined | number

        Timeout in milliseconds for max time to wait between sync state updates before giving up. As long as syncing is happening, this will never timeout, but if more than timeoutMs passes without any sync activity, then this will reject.

    Returns Promise<void>