A class to keep track of what data a given instance (self or peer) has for each chain. So it's kind of like Map<[Medallion, ChainStart], SeenThrough>. This is essentially the same data that's in the Greeting message, so I've included functionality to convert from/to Greeting objects.

Constructors

Methods

  • Returns how far along data is seen for a particular chain.

    Parameters

    • key: [number, number]

      A [Medallion, ChainStart] tuple

    Returns BundleInfo

    SeenThrough (a Timestamp) or undefined if not yet seen

  • Gets a list of chains seen for a particular medallion, or a list of all seen chains

    Parameters

    • OptionalsingleMedallion: number

      The single medallion to get chains for (returns all if undefined)

    Returns [number, number][]

    a list of known chains

  • First, determine if the bundle is novel (represents data not previously marked), then second, mark the data in the data structure (possibly checking that it's a sensible extension). Note that checkValidExtension is used here as a safeguard to make sure we don't send broken chains to the peer; the store should have its own check for receiving.

    Parameters

    • bundleInfo: BundleInfo

      Meta about a particular bundle.

    • OptionalcheckValidExtension: boolean

      If true then barfs if this bundle isn't a valid extension.

    Returns boolean

    true if the bundle represents data not seen before

  • Allows you to wait until an instance has seen a particular bundle.

    Parameters

    • what: Muid | BundleInfo

      either a muid address or a bundle info (indicates what to watch for)

    • OptionaltimeoutMs: number

      how long to wait before giving up, default of undefined doesn't time out

    Returns Promise<void>

    a promise that resolves when the thing has been marked as seen, or rejects at timeout