Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Commit

Permalink
feat: remove fs as a dependency + update aegir
Browse files Browse the repository at this point in the history
  • Loading branch information
haadcode authored and daviddias committed Nov 17, 2016
1 parent d509b48 commit e6ae36b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 20 deletions.
17 changes: 8 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@
"name": "libp2p-floodsub",
"version": "0.3.0",
"description": "libp2p-floodsub, also known as pubsub-flood or just dumbsub, this implementation of pubsub focused on delivering an API for Publish/Subscribe, but with no CastTree Forming (it just floods the network).",
"main": "lib/index.js",
"jsnext:main": "src/index.js",
"main": "src/index.js",
"scripts": {
"lint": "aegir-lint",
"coverage": "gulp coverage",
"test": "PHANTOM=off gulp test",
"test": "gulp test",
"test:node": "gulp test:node",
"test:node:core": "TEST=core npm run test:node",
"test:node:http": "TEST=http npm run test:node",
"test:node:cli": "TEST=cli npm run test:node",
"test:browser": "PHANTOM=off gulp test:browser",
"test:browser": "gulp test:browser",
"build": "gulp build",
"release": "PHANTOM=off gulp release",
"release-minor": "PHANTOM=off gulp release --type minor",
"release-major": "PHANTOM=off gulp release --type major",
"release": "gulp release",
"release-minor": "gulp release --type minor",
"release-major": "gulp release --type major",
"coverage-publish": "aegir-coverage publish"
},
"pre-commit": [
Expand All @@ -42,7 +41,7 @@
},
"homepage": "https://github.com/libp2p/js-libp2p-floodsub#readme",
"devDependencies": {
"aegir": "^8.0.1",
"aegir": "^9.1.2",
"chai": "^3.5.0",
"libp2p-ipfs": "^0.14.1",
"lodash.times": "^4.3.2",
Expand All @@ -65,4 +64,4 @@
"contributors": [
"David Dias <daviddias.p@gmail.com>"
]
}
}
13 changes: 4 additions & 9 deletions src/message/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
'use strict'

const fs = require('fs')
const path = require('path')
const protobuf = require('protocol-buffers')

const rpcSchema = fs.readFileSync(
path.join(__dirname, 'rpc.proto'))

const topicDescriptorSchema = fs.readFileSync(
path.join(__dirname, 'topic-descriptor.proto'))
const rpcProto = protobuf(require('./rpc.proto.js'))
const topicDescriptorProto = protobuf(require('./topic-descriptor.proto.js'))

exports = module.exports
exports.rpc = protobuf(rpcSchema)
exports.td = protobuf(topicDescriptorSchema)
exports.rpc = rpcProto
exports.td = topicDescriptorProto
4 changes: 3 additions & 1 deletion src/message/rpc.proto → src/message/rpc.proto.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'
module.exports = `
message RPC {
repeated SubOpts subscriptions = 1;
repeated Message msgs = 2;
Expand All @@ -13,4 +15,4 @@ message RPC {
optional bytes seqno = 3;
repeated string topicCIDs = 4; // CID of topic descriptor object
}
}
}`
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'
module.exports = `
// topicCID = cid(merkledag_protobuf(topicDescriptor)); (not the topic.name)
message TopicDescriptor {
optional string name = 1;
Expand Down Expand Up @@ -25,4 +27,5 @@ message TopicDescriptor {
WOT = 2; // web of trust, certificates can allow publisher set to grow
}
}
}
}`

2 comments on commit e6ae36b

@gavinmcdermott
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@haadcode - a huge "thank you" for landing this! Now my tests actually pass on the libp2p-floodsub implementation into js-ipfs core.

@haadcode
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gavinmcdermott my pleasure. I'm also working on pubsub (js-ipfs-api side), so we should try and stay in sync as to what's happening. I'm currently refactoring the pubsub integration in js-ipfs-api and that work is here: https://github.com/haadcode/js-ipfs-api/blob/fix/pubsub/src/api/pubsub.js. I added some more tests too, so you might want to pull those in at some point for js-ipfs.

Please sign in to comment.