Commit 0d3b0f10 authored by Brian Tiger Chow's avatar Brian Tiger Chow

fix(bs:msg) remove swarm.Message

no longer exists. instead, use net message
parent 68216245
...@@ -3,12 +3,10 @@ package message ...@@ -3,12 +3,10 @@ package message
import ( import (
"errors" "errors"
proto "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/goprotobuf/proto"
netmsg "github.com/jbenet/go-ipfs/net/message" netmsg "github.com/jbenet/go-ipfs/net/message"
blocks "github.com/jbenet/go-ipfs/blocks" blocks "github.com/jbenet/go-ipfs/blocks"
nm "github.com/jbenet/go-ipfs/net/message" nm "github.com/jbenet/go-ipfs/net/message"
swarm "github.com/jbenet/go-ipfs/net/swarm"
peer "github.com/jbenet/go-ipfs/peer" peer "github.com/jbenet/go-ipfs/peer"
u "github.com/jbenet/go-ipfs/util" u "github.com/jbenet/go-ipfs/util"
) )
...@@ -23,7 +21,6 @@ type BitSwapMessage interface { ...@@ -23,7 +21,6 @@ type BitSwapMessage interface {
type Exportable interface { type Exportable interface {
ToProto() *PBMessage ToProto() *PBMessage
ToSwarm(p *peer.Peer) *swarm.Message
ToNet(p *peer.Peer) (nm.NetMessage, error) ToNet(p *peer.Peer) (nm.NetMessage, error)
} }
...@@ -74,24 +71,11 @@ func FromNet(nmsg netmsg.NetMessage) (BitSwapMessage, error) { ...@@ -74,24 +71,11 @@ func FromNet(nmsg netmsg.NetMessage) (BitSwapMessage, error) {
return nil, errors.New("TODO implement") return nil, errors.New("TODO implement")
} }
func FromSwarm(sms swarm.Message) (BitSwapMessage, error) {
var protoMsg PBMessage
err := proto.Unmarshal(sms.Data, &protoMsg)
if err != nil {
return nil, err
}
return newMessageFromProto(protoMsg), nil
}
func (m *message) ToProto() *PBMessage { func (m *message) ToProto() *PBMessage {
cp := m.pb cp := m.pb
return &cp return &cp
} }
func (m *message) ToSwarm(p *peer.Peer) *swarm.Message {
return swarm.NewMessage(p, m.ToProto())
}
func (m *message) ToNet(p *peer.Peer) (nm.NetMessage, error) { func (m *message) ToNet(p *peer.Peer) (nm.NetMessage, error) {
return nm.FromObject(p, m.ToProto()) return nm.FromObject(p, m.ToProto())
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment