Helia
    Preparing search index...

    Interface HeliaInit<T>

    Options used to create a Helia node.

    interface HeliaInit<T extends Libp2p = Libp2p> {
        blockBrokers: ((components: any) => BlockBroker)[];
        blockstore: Blockstore;
        codecs?: BlockCodec<any, any>[];
        components?: Record<string, any>;
        datastore: Datastore;
        dns?: DNS;
        hashers?: MultihashHasher<number>[];
        holdGcLock?: boolean;
        keychain?: KeychainInit;
        libp2p?: T | Omit<Libp2pOptions<any>, "start">;
        logger?: ComponentLogger;
        metrics?: Metrics;
        providerLookupConcurrency?: number;
        routers?: Partial<Routing>[];
        start?: boolean;
        loadCodec(code: number): Await<BlockCodec<any, any>>;
        loadHasher(code: number): Await<MultihashHasher<number>>;
    }

    Type Parameters

    Hierarchy (View Summary)

    Index

    Properties

    blockBrokers: ((components: any) => BlockBroker)[]

    A list of strategies used to fetch blocks when they are not present in the local blockstore

    blockstore: Blockstore

    The blockstore is where blocks are stored

    codecs?: BlockCodec<any, any>[]

    In order to pin CIDs that correspond to a DAG, it's necessary to know how to traverse that DAG. DAGWalkers take a block and yield any CIDs encoded within that block.

    components?: Record<string, any>

    Components used by subclasses

    datastore: Datastore

    The datastore is where data is stored

    dns?: DNS

    An optional DNS implementation used to perform queries for DNS records.

    hashers?: MultihashHasher<number>[]

    By default sha256, sha512 and identity hashes are supported for bitswap operations. To bitswap blocks with CIDs using other hashes pass appropriate MultihashHashers here.

    holdGcLock?: boolean

    Garbage collection requires preventing blockstore writes during searches for unpinned blocks as DAGs are typically pinned after they've been imported - without locking this could lead to the deletion of blocks while they are being added to the blockstore.

    By default this lock is held on the current process and other processes will contact this process for access.

    If Helia is being run in multiple processes, one process must hold the GC lock so use this option to control which process that is.

    true
    
    keychain?: KeychainInit

    By default Helia stores the node's PeerId in an encrypted form in a libp2p keystore. These options control how that keystore is configured.

    libp2p?: T | Omit<Libp2pOptions<any>, "start">

    A libp2p node is required to perform network operations. Either a pre-configured node or options to configure a node can be passed here.

    If node options are passed, they will be merged with the default config for the current platform. In this case all passed config keys will replace those from the default config.

    The libp2p start option is not supported, instead please pass start in the root of the HeliaInit object.

    An optional logging component to pass to libp2p. If not specified the default implementation from libp2p will be used.

    metrics?: Metrics

    A metrics object that can be used to collected arbitrary stats about node usage.

    providerLookupConcurrency?: number

    During provider lookups, peers can be returned from routing implementations with no multiaddrs.

    This can happen when they've been retrieved from network peers that only store multiaddrs for a limited amount of time.

    When this happens the peer's info has to be looked up with a further query.

    To not have this query block the yielding of other providers returned with multiaddrs, a separate queue is used to perform this lookup.

    This config value controls the concurrency of that queue.

    5
    
    routers?: Partial<Routing>[]

    Routers perform operations such as looking up content providers, information about network peers or getting/putting records.

    start?: boolean

    Pass false to not start the Helia node

    Methods

    • An optional function that can load a BlockCodec on demand. May return a promise.

      Parameters

      • code: number

      Returns Await<BlockCodec<any, any>>