Skip to content
This repository has been archived by the owner on Jul 11, 2019. It is now read-only.

Commit

Permalink
remove schema.proto in favor of multiline; removes fs dep
Browse files Browse the repository at this point in the history
  • Loading branch information
Flet committed May 20, 2015
1 parent 35e66cf commit 121c07d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
11 changes: 0 additions & 11 deletions schema.proto

This file was deleted.

17 changes: 15 additions & 2 deletions swarm.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,22 @@ var signalhub = require('signalhub')
var hyperlog = require('hyperlog')
var through = require('through2')
var protobuf = require('protocol-buffers')
var fs = require('fs')
var multiline = require('multiline')

This comment has been minimized.

Copy link
@ungoldman

ungoldman May 23, 2015

Member

@Flet Hmm.. removing fs (a core module) in favor of multiline (an external dependency) seems weird to me (if removing dependencies is the goal of this commit). Would be nice to keep the buffer protocol schemas as a separate file (could be consumed more easily elsewhere).

This comment has been minimized.

Copy link
@ungoldman

ungoldman May 23, 2015

Member

Oh! I see it's for the sake of it making it work on the web too. moose-team/friends#112 (comment) Understood now. Carry on. 👍

This comment has been minimized.

Copy link
@Flet

Flet May 26, 2015

Author Member

Yeah, sorry I should have probably sent this subjective change as a PR for feedback instead.

Removing the fs dependency means the brfs browserify transform is not necessary for friends-swarm, which makes browser usage a little more straightforward.

Using multiline is just a small convenience that could be removed if others feel its confusing.

We can switch back to fs + schema.proto if folks feel like it offers more clarity.


var messages = protobuf(fs.readFileSync(__dirname + '/../schema.proto'))
var messages = protobuf(multiline(function () {/*
message SignedMessage {
optional bytes signature = 1;
required bytes message = 2;
}
message Message {
optional string username = 1;
optional string channel = 2;
optional uint64 timestamp = 3;
optional string text = 4;
}
*/}))

module.exports = createSwarm

Expand Down

0 comments on commit 121c07d

Please sign in to comment.