Interface HeliaInit<T>

Options used to create a Helia node.

interface HeliaInit<T> {
    blockBrokers: ((components) => BlockBroker<ProgressEvent<any, any>, ProgressEvent<any, any>>)[];
    blockstore: Blockstore<{}, {}, {}, {}, {}, {}, {}, {}>;
    components?: Record<string, any>;
    dagWalkers?: DAGWalker[];
    datastore: Datastore<{}, {}, {}, {}, {}, {}, {}, {}, {}, {}>;
    dns?: DNS;
    hashers?: MultihashHasher<number>[];
    holdGcLock?: boolean;
    keychain?: KeychainInit;
    libp2p?: T | Omit<Libp2pOptions, "start">;
    logger?: ComponentLogger;
    providerLookupConcurrency?: number;
    routers?: Partial<Routing>[];
    start?: boolean;
}

Type Parameters

Hierarchy (view full)

Properties

blockBrokers: ((components) => BlockBroker<ProgressEvent<any, any>, ProgressEvent<any, any>>)[]

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

Type declaration

blockstore: Blockstore<{}, {}, {}, {}, {}, {}, {}, {}>

The blockstore is where blocks are stored

Type declaration

    Type declaration

      Type declaration

        Type declaration

          Type declaration

            Type declaration

              Type declaration

                Type declaration

                  components?: Record<string, any>

                  Components used by subclasses

                  dagWalkers?: DAGWalker[]

                  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.

                  datastore: Datastore<{}, {}, {}, {}, {}, {}, {}, {}, {}, {}>

                  The datastore is where data is stored

                  Type declaration

                    Type declaration

                      Type declaration

                        Type declaration

                          Type declaration

                            Type declaration

                              Type declaration

                                Type declaration

                                  Type declaration

                                    Type declaration

                                      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.

                                      Default

                                      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, "start">

                                      A libp2p node is required to perform network operations. Either a preconfigured 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.

                                      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.

                                      Default

                                      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