Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-p2p-kad-dht
Commits
f81ae37f
Commit
f81ae37f
authored
Aug 28, 2014
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rework bitswap to reflect discussion on PR #32
parent
6fc4fe92
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
17 deletions
+14
-17
Message.go
Message.go
+1
-1
messages.pb.go
messages.pb.go
+12
-15
messages.proto
messages.proto
+1
-1
No files found.
Message.go
View file @
f81ae37f
...
...
@@ -11,7 +11,7 @@ type Message struct {
Key
string
Value
[]
byte
Response
bool
ID
uint64
ID
string
Success
bool
Peers
[]
*
peer
.
Peer
}
...
...
messages.pb.go
View file @
f81ae37f
// Code generated by protoc-gen-go
go
.
// 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/
go
goprotobuf/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
{
...
...
messages.proto
View file @
f81ae37f
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment