Class CoreIndex

An in-memory index of open cores.

Constructors

Methods

  • NB. Need to pass key here because core.key is not populated until the core is ready, but we know it beforehand.

    Parameters

    • options: {
          core: Hypercore<"binary", Buffer>;
          key: Buffer;
          namespace:
              | "blob"
              | "auth"
              | "config"
              | "data"
              | "blobIndex";
          writer: undefined | boolean;
      }
      • core: Hypercore<"binary", Buffer>

        Hypercore instance

      • key: Buffer

        Buffer containing public key of this core

      • namespace:
            | "blob"
            | "auth"
            | "config"
            | "data"
            | "blobIndex"
      • writer: undefined | boolean

        Is this a writer core?

    Returns void

  • Get a core by its public key

    Parameters

    • coreKey: Buffer

    Returns undefined | CoreRecord

  • Get a core by its discoveryId (discover key as hex string)

    Parameters

    • discoveryId: string

    Returns undefined | CoreRecord

  • Get all known cores in a namespace

    Parameters

    • namespace:
          | "blob"
          | "auth"
          | "config"
          | "data"
          | "blobIndex"

    Returns CoreRecord[]

  • Get the write core for the given namespace

    Parameters

    • namespace:
          | "blob"
          | "auth"
          | "config"
          | "data"
          | "blobIndex"

    Returns CoreRecord