dht_pb

package
v0.0.0-...-c9e5fdf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2014 License: MIT Imports: 6 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
var Message_MessageType_name = map[int32]string{
	0: "PUT_VALUE",
	1: "GET_VALUE",
	2: "ADD_PROVIDER",
	3: "GET_PROVIDERS",
	4: "FIND_NODE",
	5: "PING",
}
View Source
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

This section is empty.

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
	Value []byte `protobuf:"bytes,3,opt,name=value" json:"value,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

func (*Message) GetCloserPeers

func (m *Message) GetCloserPeers() []*Message_Peer

func (*Message) GetClusterLevel

func (m *Message) GetClusterLevel() int

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 (m *Message) GetClusterLevelRaw() int32

func (*Message) GetKey

func (m *Message) GetKey() string

func (*Message) GetProviderPeers

func (m *Message) GetProviderPeers() []*Message_Peer

func (*Message) GetType

func (m *Message) GetType() Message_MessageType

func (*Message) GetValue

func (m *Message) GetValue() []byte

func (*Message) ProtoMessage

func (*Message) ProtoMessage()

func (*Message) Reset

func (m *Message) Reset()

func (*Message) SetClusterLevel

func (m *Message) SetClusterLevel(level int)

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)

func (*Message) String

func (m *Message) String() string

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 (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               *string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
	Addr             *string `protobuf:"bytes,2,opt,name=addr" json:"addr,omitempty"`
	XXX_unrecognized []byte  `json:"-"`
}

func PeersToPBPeers

func PeersToPBPeers(peers []peer.Peer) []*Message_Peer

func (*Message_Peer) Address

func (m *Message_Peer) Address() (ma.Multiaddr, error)

Address returns a multiaddr associated with the Message_Peer entry

func (*Message_Peer) GetAddr

func (m *Message_Peer) GetAddr() string

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL