• Public
  • Public/Protected
  • All

Encapsulates logic for pinning streams


  • PinStore




  • new PinStore(stateStore: StateStore, pinning: PinningBackend, retrieve: (cid: CID) => Promise<any | null>, resolve: (path: string) => Promise<CID>): PinStore
  • Parameters

    • stateStore: StateStore
    • pinning: PinningBackend
    • retrieve: (cid: CID) => Promise<any | null>
        • (cid: CID): Promise<any | null>
        • Parameters

          • cid: CID

          Returns Promise<any | null>

    • resolve: (path: string) => Promise<CID>
        • (path: string): Promise<CID>
        • Parameters

          • path: string

          Returns Promise<CID>

    Returns PinStore


Readonly pinning

pinning: PinningBackend

Readonly resolve

resolve: (path: string) => Promise<CID>

Type declaration

    • (path: string): Promise<CID>
    • Parameters

      • path: string

      Returns Promise<CID>

Readonly retrieve

retrieve: (cid: CID) => Promise<any | null>

Type declaration

    • (cid: CID): Promise<any | null>
    • Parameters

      • cid: CID

      Returns Promise<any | null>

Readonly stateStore

stateStore: StateStore



  • add(runningState: RunningState, force?: boolean): Promise<void>
  • Takes a StreamState and finds all the IPFS CIDs that are in any way needed to load data from the stream, pins them against the configured pinning backend, writes the StreamState itself into the state store, and updates the RunningState's pinned commits which prevents the StreamState's commits from being stored again.


    • runningState: RunningState

      object holding the current StreamState for the stream being pinned If the stream was previously pinned, then this will also contain a set of CIDs (in string representation) of the commits that were pinned previously. This means we only need to pin CIDs corresponding to the commits contained in the log of the given StreamState that aren't contained within pinnedCommits

    • Optional force: boolean

      optional boolean that if set to true forces all commits in the stream to pinned, regardless of whether they have been previously pinned

    Returns Promise<void>


  • close(): Promise<void>

Protected getComponentCIDsOfCommits

  • getComponentCIDsOfCommits(commits: Array<CID>): Promise<Array<CID>>
  • Takes an array of CIDs, corresponding to commits in a stream log, and returns all CIDs that would need to be pinned in order to pin all data necessary to keep the corresponding Stream alive and available to the network. This entails expanding each commit out to all the other IPFS CIDs that that commit depends on (for example AnchorCommits depend on the CID of the AnchorProof, and of all the CIDs in the path from the merkle root to the leaf of the merkle tree for that commit).


    • commits: Array<CID>

      CIDs of Ceramic commits to expand

    Returns Promise<Array<CID>>


  • ls(streamId?: StreamID): Promise<string[]>


  • open(networkName: string): void