Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • StateManager

Index

Constructors

constructor

  • Parameters

    • dispatcher: Dispatcher

      currently used instance of Dispatcher

    • pinStore: PinStore

      currently used instance of PinStore

    • executionQ: ExecutionQueue

      currently used instance of ExecutionQueue

    • anchorService: AnchorService

      currently used instance of AnchorService

    • conflictResolution: ConflictResolution

      currently used instance of ConflictResolution

    • logger: DiagnosticsLogger

      Logger

    • fromMemoryOrStore: (streamId: StreamID) => Promise<RunningState | undefined>

      load RunningState from in-memory cache or from state store, see Repository#get.

        • Parameters

          • streamId: StreamID

          Returns Promise<RunningState | undefined>

    • load: (streamId: StreamID, opts?: LoadOpts | CreateOpts) => Promise<RunningState>

      Repository#load

        • (streamId: StreamID, opts?: LoadOpts | CreateOpts): Promise<RunningState>
        • Parameters

          • streamId: StreamID
          • Optional opts: LoadOpts | CreateOpts

          Returns Promise<RunningState>

    Returns StateManager

Properties

anchorService

anchorService: AnchorService

currently used instance of AnchorService

conflictResolution

conflictResolution: ConflictResolution

currently used instance of ConflictResolution

Methods

anchor

applyCommit

  • applyCommit(streamId: StreamID, commit: any, opts: CreateOpts | UpdateOpts): Promise<RunningState>

atCommit

  • atCommit(state$: RunningStateLike, commitId: CommitID): Promise<SnapshotState>
  • Take the version of a stream state and a specific commit and returns a snapshot of a state at the requested commit. If the requested commit is for a branch of history that conflicts with the known commits, throw an error. If the requested commit is ahead of the currently known state for this stream, emit the new state.

    Parameters

    • state$: RunningStateLike

      Currently known state of the stream.

    • commitId: CommitID

      Requested commit.

    Returns Promise<SnapshotState>

atTime

  • atTime(state$: RunningStateLike, timestamp: number): Promise<SnapshotState>

confirmAnchorResponse

publishTip

sync

  • sync(state$: RunningState, timeoutMillis: number): Promise<void>

verifyLoneGenesis

wasPinnedStreamSynced

  • wasPinnedStreamSynced(streamId: StreamID): boolean
  • Returns whether the given StreamID corresponds to a pinned stream that has been synced at least once during the lifetime of this process. As long as it's been synced once, it's guaranteed to be up to date since we keep streams in the state store up to date when we hear pubsub messages about updates to them.

    Parameters

    • streamId: StreamID

    Returns boolean