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:
              | "auth"
              | "config"
              | "data"
              | "blobIndex"
              | "blob";
          writer: undefined | boolean;
      }
      • core: Hypercore<"binary", Buffer>

        Hypercore instance

      • key: Buffer

        Buffer containing public key of this core

      • namespace:
            | "auth"
            | "config"
            | "data"
            | "blobIndex"
            | "blob"
      • 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:
          | "auth"
          | "config"
          | "data"
          | "blobIndex"
          | "blob"

    Returns CoreRecord[]

  • Get the write core for the given namespace

    Parameters

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

    Returns CoreRecord