dht.pb.go 7.36 KB
Newer Older
1 2
// Code generated by protoc-gen-gogo.
// source: dht.proto
3 4 5
// DO NOT EDIT!

/*
6
Package dht_pb is a generated protocol buffer package.
7 8

It is generated from these files:
9
	dht.proto
10 11

It has these top-level messages:
12
	Message
13
	Record
14
*/
15
package dht_pb
16

17
import proto "gx/ipfs/QmZ4Qi3GaRbjcx28Sme5eMH7RQjGkt8wHxt2a65oLaeFEV/gogo-protobuf/proto"
18 19
import math "math"

20
// Reference imports to suppress errors if they are not otherwise used.
21 22 23
var _ = proto.Marshal
var _ = math.Inf

24
type Message_MessageType int32
25 26

const (
27 28 29 30 31 32
	Message_PUT_VALUE     Message_MessageType = 0
	Message_GET_VALUE     Message_MessageType = 1
	Message_ADD_PROVIDER  Message_MessageType = 2
	Message_GET_PROVIDERS Message_MessageType = 3
	Message_FIND_NODE     Message_MessageType = 4
	Message_PING          Message_MessageType = 5
33 34
)

35
var Message_MessageType_name = map[int32]string{
36 37
	0: "PUT_VALUE",
	1: "GET_VALUE",
38 39 40 41
	2: "ADD_PROVIDER",
	3: "GET_PROVIDERS",
	4: "FIND_NODE",
	5: "PING",
42
}
43
var Message_MessageType_value = map[string]int32{
44 45 46 47 48 49
	"PUT_VALUE":     0,
	"GET_VALUE":     1,
	"ADD_PROVIDER":  2,
	"GET_PROVIDERS": 3,
	"FIND_NODE":     4,
	"PING":          5,
50 51
}

52 53
func (x Message_MessageType) Enum() *Message_MessageType {
	p := new(Message_MessageType)
54 55 56
	*p = x
	return p
}
57 58
func (x Message_MessageType) String() string {
	return proto.EnumName(Message_MessageType_name, int32(x))
59
}
60 61
func (x *Message_MessageType) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(Message_MessageType_value, data, "Message_MessageType")
62 63 64
	if err != nil {
		return err
	}
65
	*x = Message_MessageType(value)
66 67 68
	return nil
}

69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
type Message_ConnectionType int32

const (
	// sender does not have a connection to peer, and no extra information (default)
	Message_NOT_CONNECTED Message_ConnectionType = 0
	// sender has a live connection to peer
	Message_CONNECTED Message_ConnectionType = 1
	// sender recently connected to peer
	Message_CAN_CONNECT Message_ConnectionType = 2
	// sender recently tried to connect to peer repeatedly but failed to connect
	// ("try" here is loose, but this should signal "made strong effort, failed")
	Message_CANNOT_CONNECT Message_ConnectionType = 3
)

var Message_ConnectionType_name = map[int32]string{
	0: "NOT_CONNECTED",
	1: "CONNECTED",
	2: "CAN_CONNECT",
	3: "CANNOT_CONNECT",
}
var Message_ConnectionType_value = map[string]int32{
	"NOT_CONNECTED":  0,
	"CONNECTED":      1,
	"CAN_CONNECT":    2,
	"CANNOT_CONNECT": 3,
}

func (x Message_ConnectionType) Enum() *Message_ConnectionType {
	p := new(Message_ConnectionType)
	*p = x
	return p
}
func (x Message_ConnectionType) String() string {
	return proto.EnumName(Message_ConnectionType_name, int32(x))
}
func (x *Message_ConnectionType) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(Message_ConnectionType_value, data, "Message_ConnectionType")
	if err != nil {
		return err
	}
	*x = Message_ConnectionType(value)
	return nil
}

113 114
type Message struct {
	// defines what type of message it is.
115
	Type *Message_MessageType `protobuf:"varint,1,opt,name=type,enum=dht.pb.Message_MessageType" json:"type,omitempty"`
116 117 118 119 120 121 122
	// defines what coral cluster level this query/response belongs to.
	ClusterLevelRaw *int32 `protobuf:"varint,10,opt,name=clusterLevelRaw" json:"clusterLevelRaw,omitempty"`
	// Used to specify the key associated with this message.
	// PUT_VALUE, GET_VALUE, ADD_PROVIDER, GET_PROVIDERS
	Key *string `protobuf:"bytes,2,opt,name=key" json:"key,omitempty"`
	// Used to return a value
	// PUT_VALUE, GET_VALUE
123
	Record *Record `protobuf:"bytes,3,opt,name=record" json:"record,omitempty"`
124 125 126 127 128 129 130 131 132 133 134 135 136 137
	// Used to return peers closer to a key in a query
	// GET_VALUE, GET_PROVIDERS, FIND_NODE
	CloserPeers []*Message_Peer `protobuf:"bytes,8,rep,name=closerPeers" json:"closerPeers,omitempty"`
	// Used to return Providers
	// GET_VALUE, ADD_PROVIDER, GET_PROVIDERS
	ProviderPeers    []*Message_Peer `protobuf:"bytes,9,rep,name=providerPeers" json:"providerPeers,omitempty"`
	XXX_unrecognized []byte          `json:"-"`
}

func (m *Message) Reset()         { *m = Message{} }
func (m *Message) String() string { return proto.CompactTextString(m) }
func (*Message) ProtoMessage()    {}

func (m *Message) GetType() Message_MessageType {
138 139 140
	if m != nil && m.Type != nil {
		return *m.Type
	}
141
	return Message_PUT_VALUE
142 143
}

144 145 146 147 148 149 150 151
func (m *Message) GetClusterLevelRaw() int32 {
	if m != nil && m.ClusterLevelRaw != nil {
		return *m.ClusterLevelRaw
	}
	return 0
}

func (m *Message) GetKey() string {
152 153 154 155 156 157
	if m != nil && m.Key != nil {
		return *m.Key
	}
	return ""
}

158
func (m *Message) GetRecord() *Record {
159
	if m != nil {
160
		return m.Record
161 162 163 164
	}
	return nil
}

165 166 167
func (m *Message) GetCloserPeers() []*Message_Peer {
	if m != nil {
		return m.CloserPeers
168
	}
169
	return nil
170 171
}

172
func (m *Message) GetProviderPeers() []*Message_Peer {
173
	if m != nil {
174
		return m.ProviderPeers
175 176 177 178
	}
	return nil
}

179
type Message_Peer struct {
180 181 182
	// ID of a given peer.
	Id *string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
	// multiaddrs for a given peer
183
	Addrs [][]byte `protobuf:"bytes,2,rep,name=addrs" json:"addrs,omitempty"`
184 185 186
	// used to signal the sender's connection capabilities to the peer
	Connection       *Message_ConnectionType `protobuf:"varint,3,opt,name=connection,enum=dht.pb.Message_ConnectionType" json:"connection,omitempty"`
	XXX_unrecognized []byte                  `json:"-"`
187 188
}

189 190 191
func (m *Message_Peer) Reset()         { *m = Message_Peer{} }
func (m *Message_Peer) String() string { return proto.CompactTextString(m) }
func (*Message_Peer) ProtoMessage()    {}
192

193
func (m *Message_Peer) GetId() string {
194 195 196 197 198 199
	if m != nil && m.Id != nil {
		return *m.Id
	}
	return ""
}

200
func (m *Message_Peer) GetAddrs() [][]byte {
201 202
	if m != nil {
		return m.Addrs
203
	}
204 205 206 207 208 209 210 211
	return nil
}

func (m *Message_Peer) GetConnection() Message_ConnectionType {
	if m != nil && m.Connection != nil {
		return *m.Connection
	}
	return Message_NOT_CONNECTED
212 213
}

214 215 216 217 218 219 220 221 222 223
// Record represents a dht record that contains a value
// for a key value pair
type Record struct {
	// The key that references this record
	Key *string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
	// The actual value this record is storing
	Value []byte `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
	// hash of the authors public key
	Author *string `protobuf:"bytes,3,opt,name=author" json:"author,omitempty"`
	// A PKI signature for the key+value+author
224 225 226 227
	Signature []byte `protobuf:"bytes,4,opt,name=signature" json:"signature,omitempty"`
	// Time the record was received, set by receiver
	TimeReceived     *string `protobuf:"bytes,5,opt,name=timeReceived" json:"timeReceived,omitempty"`
	XXX_unrecognized []byte  `json:"-"`
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
}

func (m *Record) Reset()         { *m = Record{} }
func (m *Record) String() string { return proto.CompactTextString(m) }
func (*Record) ProtoMessage()    {}

func (m *Record) GetKey() string {
	if m != nil && m.Key != nil {
		return *m.Key
	}
	return ""
}

func (m *Record) GetValue() []byte {
	if m != nil {
		return m.Value
	}
	return nil
}

func (m *Record) GetAuthor() string {
	if m != nil && m.Author != nil {
		return *m.Author
	}
	return ""
}

func (m *Record) GetSignature() []byte {
	if m != nil {
		return m.Signature
	}
	return nil
}

262 263 264 265 266 267 268
func (m *Record) GetTimeReceived() string {
	if m != nil && m.TimeReceived != nil {
		return *m.TimeReceived
	}
	return ""
}

269
func init() {
270
	proto.RegisterEnum("dht.pb.Message_MessageType", Message_MessageType_name, Message_MessageType_value)
271
	proto.RegisterEnum("dht.pb.Message_ConnectionType", Message_ConnectionType_name, Message_ConnectionType_value)
272
}