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

Commit 27751cf

Browse files
vasco-santosAlan Shaw
authored andcommitted
feat: enable pubsub via config file and enabled by default (#2427)
As discussed, we will remove the pubsub flags from the js daemon and will use the config as the way to disable it (will be enabled by default now!) Needs: - [x] [ipfs/js-ipfsd-ctl#366](ipfs/js-ipfsd-ctl#366) Reference: - [ipfs/kubo#6621](ipfs/kubo#6621) BREAKING CHANGE: pubsub is now enabled by default and the experimental flag was removed
1 parent 03fc9b3 commit 27751cf

20 files changed

+53
-43
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,6 @@ Configure remote preload nodes. The remote will preload content added on this no
328328
329329
Enable and configure experimental features.
330330
331-
- `pubsub` (boolean): Enable libp2p pub-sub. (Default: `false`)
332331
- `ipnsPubsub` (boolean): Enable pub-sub on IPNS. (Default: `false`)
333332
- `sharding` (boolean): Enable directory sharding. Directories that have many child objects will be represented by multiple DAG nodes instead of just one. It can improve lookup performance when a directory has several thousand files or more. (Default: `false`)
334333

doc/config.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,12 @@ A string value for specifying which pubsub routing protocol to use. You can eith
180180

181181
Default: `gossipsub`
182182

183+
### `Enabled`
184+
185+
A boolean value for wether or not pubsub router should be active.
186+
187+
Default: `true`
188+
183189
## `Swarm`
184190

185191
Options for configuring the swarm.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@
194194
"execa": "^2.0.4",
195195
"form-data": "^2.5.1",
196196
"hat": "0.0.3",
197-
"ipfsd-ctl": "~0.45.0",
198197
"interface-ipfs-core": "^0.111.1",
198+
"ipfsd-ctl": "~0.46.0",
199199
"libp2p-websocket-star": "~0.10.2",
200200
"ncp": "^2.0.0",
201201
"p-event": "^4.1.0",

src/cli/commands/daemon.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ module.exports = {
1616
type: 'boolean',
1717
default: false
1818
})
19-
.option('enable-pubsub', {
20-
alias: 'enable-pubsub-experiment',
21-
type: 'boolean',
22-
default: false
23-
})
2419
.option('offline', {
2520
type: 'boolean',
2621
desc: 'Run offline. Do not connect to the rest of the network but provide local API.',
@@ -54,7 +49,6 @@ module.exports = {
5449
offline: argv.offline,
5550
pass: argv.pass,
5651
preload: { enabled: argv.enablePreload },
57-
pubsub: { enabled: argv.enablePubsub },
5852
EXPERIMENTAL: {
5953
ipnsPubsub: argv.enableNamesysPubsub,
6054
dht: argv.enableDhtExperiment,

src/cli/utils.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,7 @@ exports.getIPFS = (argv, callback) => {
4949
repo: exports.getRepoPath(),
5050
init: false,
5151
start: false,
52-
pass: argv.pass,
53-
pubsub: {
54-
enabled: true
55-
}
52+
pass: argv.pass
5653
})
5754

5855
const cleanup = promisify((cb) => {

src/core/components/libp2p.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function defaultBundle ({ datastore, peerInfo, peerBook, options, config }) {
119119
}
120120
},
121121
pubsub: {
122-
enabled: get(options, 'pubsub.enabled', false)
122+
enabled: get(config, 'Pubsub.Enabled', true)
123123
}
124124
},
125125
connectionManager: get(options, 'connectionManager',

src/core/config.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ const configSchema = s({
3232
addresses: optional(s(['multiaddr'])),
3333
interval: 'number?'
3434
}, { enabled: true, interval: 30 * 1000 }),
35-
pubsub: optional(s({
36-
enabled: 'boolean?'
37-
})),
3835
init: optional(union(['boolean', s({
3936
bits: 'number?',
4037
emptyRepo: 'boolean?',
@@ -72,7 +69,8 @@ const configSchema = s({
7269
})),
7370
Bootstrap: optional(s(['multiaddr-ipfs'])),
7471
Pubsub: optional(s({
75-
Router: 'string?'
72+
Router: 'string?',
73+
Enabled: 'boolean?'
7674
})),
7775
Swarm: optional(s({
7876
ConnMgr: optional(s({

src/core/index.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ const multihashing = require('multihashing-async')
1515
const CID = require('cids')
1616
const debug = require('debug')
1717
const mergeOptions = require('merge-options')
18-
const get = require('dlv')
1918
const EventEmitter = require('events')
2019

2120
const config = require('./config')
@@ -47,9 +46,6 @@ class IPFS extends EventEmitter {
4746
init: true,
4847
start: true,
4948
EXPERIMENTAL: {},
50-
pubsub: {
51-
enabled: false
52-
},
5349
preload: {
5450
enabled: true,
5551
addresses: [
@@ -135,16 +131,7 @@ class IPFS extends EventEmitter {
135131
this.stats = components.stats(this)
136132
this.resolve = components.resolve(this)
137133

138-
if (this._options.pubsub.enabled) {
139-
this.log('pubsub is enabled')
140-
}
141134
if (this._options.EXPERIMENTAL.ipnsPubsub) {
142-
// if (!this._options.pubsub.enabled) {
143-
if (!get(this._options, 'pubsub.enabled', false)) {
144-
this.log('pubsub is enabled to use EXPERIMENTAL IPNS pubsub')
145-
this._options.pubsub.enabled = true
146-
}
147-
148135
this.log('EXPERIMENTAL IPNS pubsub is enabled')
149136
}
150137
if (this._options.EXPERIMENTAL.sharding) {

src/core/runtime/config-browser.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ module.exports = () => ({
2727
'/dns4/node0.preload.ipfs.io/tcp/443/wss/ipfs/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic',
2828
'/dns4/node1.preload.ipfs.io/tcp/443/wss/ipfs/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6'
2929
],
30+
Pubsub: {
31+
Enabled: true
32+
},
3033
Swarm: {
3134
ConnMgr: {
3235
LowWater: 200,

src/core/runtime/config-nodejs.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ module.exports = () => ({
4141
'/dns4/node1.preload.ipfs.io/tcp/443/wss/ipfs/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6'
4242
],
4343
Pubsub: {
44-
Router: 'gossipsub'
44+
Router: 'gossipsub',
45+
Enabled: true
4546
},
4647
Swarm: {
4748
ConnMgr: {

0 commit comments

Comments
 (0)