Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit c964f08

Browse files
committed
docs: factory instead of generator
1 parent deab67d commit c964f08

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,9 @@ Creates and returns an instance of an IPFS node. Use the `options` argument to s
240240

241241
- `libp2p` (object or function(ipfs, config)) add custom modules to the libp2p stack of your node
242242

243-
The libp2p option allows you to build your libp2p node by configuration, or via a generator. If you are looking to just modify the below options, using the object format is the quickest way to get the default features of libp2p. If you need to create a more customized libp2p node, such as with custom transports or peer/content routers that need some of the ipfs data on startup, a generator is a great way to achieve this.
243+
The libp2p option allows you to build your libp2p node by configuration, or via a factory. If you are looking to just modify the below options, using the object format is the quickest way to get the default features of libp2p. If you need to create a more customized libp2p node, such as with custom transports or peer/content routers that need some of the ipfs data on startup, a factory is a great way to achieve this.
244244

245-
You can see the generator in action in the [custom libp2p example](examples/custom-libp2p).
245+
You can see the factory in action in the [custom libp2p example](examples/custom-libp2p).
246246

247247
- `modules` (object):
248248
- `transport` (Array<[libp2p.Transport](https://github.com/libp2p/interface-transport)>): An array of Libp2p transport classes/instances to use _instead_ of the defaults. See [libp2p/interface-transport](https://github.com/libp2p/interface-transport) for details.

examples/custom-libp2p/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Customizing the libp2p node
22

3-
This example shows you how to make full use of the ipfs configuration to create a libp2p generator function. As IPFS applications become more complex, their needs for a custom libp2p node also grow. Instead of fighting with configuration options, you can use your own libp2p generator to get exactly what you need. This example shows you how.
3+
This example shows you how to make full use of the ipfs configuration to create a libp2p factory function. As IPFS applications become more complex, their needs for a custom libp2p node also grow. Instead of fighting with configuration options, you can use your own libp2p factory to get exactly what you need. This example shows you how.
44

55
## Run this example
66

examples/custom-libp2p/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ const SECIO = require('libp2p-secio')
1313
const assert = require('assert')
1414

1515
/**
16-
* This is the generator we will use to generate our fully customized libp2p node.
16+
* This is the factory we will use to create our fully customized libp2p node.
1717
*
1818
* @param {*} _ipfsNode The ipfs node. This houses the PeerInfo and PeerBook that modules may need
1919
* @param {*} _ipfsConfig The config that is fetched from the ipfs-repo
2020
* @returns {Libp2p} Our new libp2p node
2121
*/
22-
const libp2pGenerator = (_ipfsNode, _ipfsConfig) => {
22+
const libp2pFactory = (_ipfsNode, _ipfsConfig) => {
2323
// Set convenience variables to clearly showcase some of the useful things that are available
2424
const peerInfo = _ipfsNode._peerInfo
2525
const peerBook = _ipfsNode._peerBook
@@ -89,9 +89,9 @@ const libp2pGenerator = (_ipfsNode, _ipfsConfig) => {
8989
})
9090
}
9191

92-
// Now that we have our custom generator, let's start up the ipfs node!
92+
// Now that we have our custom factory, let's start up the ipfs node!
9393
const node = new IPFS({
94-
libp2p: libp2pGenerator
94+
libp2p: libp2pFactory
9595
})
9696

9797
// Listen for the node to start, so we can log out some metrics

0 commit comments

Comments
 (0)