Documentation ¶
Overview ¶
Package dht_pb is a generated protocol buffer package.
It is generated from these files:
dht.proto
It has these top-level messages:
Message
Index ¶
- Variables
- func Connectedness(c Message_ConnectionType) inet.Connectedness
- func PBPeerToPeerInfo(pbp *Message_Peer) *pstore.PeerInfo
- func PBPeersToPeerInfos(pbps []*Message_Peer) []*pstore.PeerInfo
- type Message
- func (m *Message) GetCloserPeers() []*Message_Peer
- func (m *Message) GetClusterLevel() int
- func (m *Message) GetClusterLevelRaw() int32
- func (m *Message) GetKey() string
- func (m *Message) GetProviderPeers() []*Message_Peer
- func (m *Message) GetRecord() *record_pb.Record
- func (m *Message) GetType() Message_MessageType
- func (m *Message) Loggable() map[string]interface{}
- func (*Message) ProtoMessage()
- func (m *Message) Reset()
- func (m *Message) SetClusterLevel(level int)
- func (m *Message) String() string
- type Message_ConnectionType
- type Message_MessageType
- type Message_Peer
- type PeerRoutingInfo
Constants ¶
This section is empty.
Variables ¶
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,
}
var Message_MessageType_name = map[int32]string{
0: "PUT_VALUE",
1: "GET_VALUE",
2: "ADD_PROVIDER",
3: "GET_PROVIDERS",
4: "FIND_NODE",
5: "PING",
}
var Message_MessageType_value = map[string]int32{
"PUT_VALUE": 0,
"GET_VALUE": 1,
"ADD_PROVIDER": 2,
"GET_PROVIDERS": 3,
"FIND_NODE": 4,
"PING": 5,
}
Functions ¶
func Connectedness ¶
func Connectedness(c Message_ConnectionType) inet.Connectedness
Connectedness returns an inet.Connectedness associated with the Message_ConnectionType.
func PBPeerToPeerInfo ¶
func PBPeerToPeerInfo(pbp *Message_Peer) *pstore.PeerInfo
PBPeerToPeer turns a *Message_Peer into its pstore.PeerInfo counterpart
func PBPeersToPeerInfos ¶
func PBPeersToPeerInfos(pbps []*Message_Peer) []*pstore.PeerInfo
PBPeersToPeerInfos converts given []*Message_Peer into []pstore.PeerInfo Invalid addresses will be silently omitted.
Types ¶
type Message ¶
type Message struct { // defines what type of message it is. Type *Message_MessageType `protobuf:"varint,1,opt,name=type,enum=dht.pb.Message_MessageType" json:"type,omitempty"` // 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 Record *record_pb.Record `protobuf:"bytes,3,opt,name=record" json:"record,omitempty"` // 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 NewMessage ¶
func NewMessage(typ Message_MessageType, key string, level int) *Message
NewMessage constructs a new dht message with given type, key, and level
func (*Message) GetCloserPeers ¶
func (m *Message) GetCloserPeers() []*Message_Peer
func (*Message) GetClusterLevel ¶
GetClusterLevel gets and adjusts the cluster level on the message. a +/- 1 adjustment is needed to distinguish a valid first level (1) and default "no value" protobuf behavior (0)
func (*Message) GetClusterLevelRaw ¶
func (*Message) GetProviderPeers ¶
func (m *Message) GetProviderPeers() []*Message_Peer
func (*Message) GetType ¶
func (m *Message) GetType() Message_MessageType
func (*Message) ProtoMessage ¶
func (*Message) ProtoMessage()
func (*Message) SetClusterLevel ¶
SetClusterLevel adjusts and sets the cluster level on the message. a +/- 1 adjustment is needed to distinguish a valid first level (1) and default "no value" protobuf behavior (0)
type Message_ConnectionType ¶
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 )
func ConnectionType ¶
func ConnectionType(c inet.Connectedness) Message_ConnectionType
ConnectionType returns a Message_ConnectionType associated with the inet.Connectedness.
func (Message_ConnectionType) Enum ¶
func (x Message_ConnectionType) Enum() *Message_ConnectionType
func (Message_ConnectionType) String ¶
func (x Message_ConnectionType) String() string
func (*Message_ConnectionType) UnmarshalJSON ¶
func (x *Message_ConnectionType) UnmarshalJSON(data []byte) error
type Message_MessageType ¶
type Message_MessageType int32
const ( 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 )
func (Message_MessageType) Enum ¶
func (x Message_MessageType) Enum() *Message_MessageType
func (Message_MessageType) String ¶
func (x Message_MessageType) String() string
func (*Message_MessageType) UnmarshalJSON ¶
func (x *Message_MessageType) UnmarshalJSON(data []byte) error
type Message_Peer ¶
type Message_Peer struct { // ID of a given peer. Id *string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` // multiaddrs for a given peer Addrs [][]byte `protobuf:"bytes,2,rep,name=addrs" json:"addrs,omitempty"` // 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:"-"` }
func PeerInfosToPBPeers ¶
func PeerInfosToPBPeers(n inet.Network, peers []pstore.PeerInfo) []*Message_Peer
PeersToPBPeers converts given []peer.Peer into a set of []*Message_Peer, which can be written to a message and sent out. the key thing this function does (in addition to PeersToPBPeers) is set the ConnectionType with information from the given inet.Network.
func PeerRoutingInfosToPBPeers ¶
func PeerRoutingInfosToPBPeers(peers []PeerRoutingInfo) []*Message_Peer
func RawPeerInfosToPBPeers ¶
func RawPeerInfosToPBPeers(peers []pstore.PeerInfo) []*Message_Peer
RawPeerInfosToPBPeers converts a slice of Peers into a slice of *Message_Peers, ready to go out on the wire.
func (*Message_Peer) Addresses ¶
func (m *Message_Peer) Addresses() []ma.Multiaddr
Addresses returns a multiaddr associated with the Message_Peer entry
func (*Message_Peer) GetAddrs ¶
func (m *Message_Peer) GetAddrs() [][]byte
func (*Message_Peer) GetConnection ¶
func (m *Message_Peer) GetConnection() Message_ConnectionType
func (*Message_Peer) GetId ¶
func (m *Message_Peer) GetId() string
func (*Message_Peer) ProtoMessage ¶
func (*Message_Peer) ProtoMessage()
func (*Message_Peer) Reset ¶
func (m *Message_Peer) Reset()
func (*Message_Peer) String ¶
func (m *Message_Peer) String() string
type PeerRoutingInfo ¶
type PeerRoutingInfo struct { pstore.PeerInfo inet.Connectedness }