Commit f81ae37f authored by Jeromy's avatar Jeromy

rework bitswap to reflect discussion on PR #32

parent 6fc4fe92
......@@ -11,7 +11,7 @@ type Message struct {
Key string
Value []byte
Response bool
ID uint64
ID string
Success bool
Peers []*peer.Peer
}
......
// Code generated by protoc-gen-gogo.
// Code generated by protoc-gen-go.
// source: messages.proto
// DO NOT EDIT!
......@@ -13,7 +13,7 @@ It has these top-level messages:
*/
package dht
import proto "code.google.com/p/gogoprotobuf/proto"
import proto "code.google.com/p/goprotobuf/proto"
import math "math"
// Reference imports to suppress errors if they are not otherwise used.
......@@ -69,17 +69,14 @@ func (x *PBDHTMessage_MessageType) UnmarshalJSON(data []byte) error {
}
type PBDHTMessage struct {
Type *PBDHTMessage_MessageType `protobuf:"varint,1,req,name=type,enum=dht.PBDHTMessage_MessageType" json:"type,omitempty"`
Key *string `protobuf:"bytes,2,opt,name=key" json:"key,omitempty"`
Value []byte `protobuf:"bytes,3,opt,name=value" json:"value,omitempty"`
// Unique ID of this message, used to match queries with responses
Id *uint64 `protobuf:"varint,4,req,name=id" json:"id,omitempty"`
// Signals whether or not this message is a response to another message
Response *bool `protobuf:"varint,5,opt,name=response" json:"response,omitempty"`
Success *bool `protobuf:"varint,6,opt,name=success" json:"success,omitempty"`
// Used for returning peers from queries (normally, peers closer to X)
Peers []*PBDHTMessage_PBPeer `protobuf:"bytes,7,rep,name=peers" json:"peers,omitempty"`
XXX_unrecognized []byte `json:"-"`
Type *PBDHTMessage_MessageType `protobuf:"varint,1,req,name=type,enum=dht.PBDHTMessage_MessageType" json:"type,omitempty"`
Key *string `protobuf:"bytes,2,opt,name=key" json:"key,omitempty"`
Value []byte `protobuf:"bytes,3,opt,name=value" json:"value,omitempty"`
Id *string `protobuf:"bytes,4,req,name=id" json:"id,omitempty"`
Response *bool `protobuf:"varint,5,opt,name=response" json:"response,omitempty"`
Success *bool `protobuf:"varint,6,opt,name=success" json:"success,omitempty"`
Peers []*PBDHTMessage_PBPeer `protobuf:"bytes,7,rep,name=peers" json:"peers,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *PBDHTMessage) Reset() { *m = PBDHTMessage{} }
......@@ -107,11 +104,11 @@ func (m *PBDHTMessage) GetValue() []byte {
return nil
}
func (m *PBDHTMessage) GetId() uint64 {
func (m *PBDHTMessage) GetId() string {
if m != nil && m.Id != nil {
return *m.Id
}
return 0
return ""
}
func (m *PBDHTMessage) GetResponse() bool {
......
......@@ -23,7 +23,7 @@ message PBDHTMessage {
optional bytes value = 3;
// Unique ID of this message, used to match queries with responses
required uint64 id = 4;
required string id = 4;
// Signals whether or not this message is a response to another message
optional bool response = 5;
......
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