go_micro_network

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterNetworkHandler

func RegisterNetworkHandler(s server.Server, hdlr NetworkHandler, opts ...server.HandlerOption) error

Types

type Close

type Close struct {
	// network mode
	Node                 *Node    `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Close is sent when the node disconnects from the network

func (*Close) Descriptor

func (*Close) Descriptor() ([]byte, []int)

func (*Close) GetNode

func (m *Close) GetNode() *Node

func (*Close) ProtoMessage

func (*Close) ProtoMessage()

func (*Close) Reset

func (m *Close) Reset()

func (*Close) String

func (m *Close) String() string

func (*Close) XXX_DiscardUnknown

func (m *Close) XXX_DiscardUnknown()

func (*Close) XXX_Marshal

func (m *Close) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Close) XXX_Merge

func (m *Close) XXX_Merge(src proto.Message)

func (*Close) XXX_Size

func (m *Close) XXX_Size() int

func (*Close) XXX_Unmarshal

func (m *Close) XXX_Unmarshal(b []byte) error

type Connect

type Connect struct {
	// network mode
	Node                 *Node    `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Connect is sent when the node connects to the network

func (*Connect) Descriptor

func (*Connect) Descriptor() ([]byte, []int)

func (*Connect) GetNode

func (m *Connect) GetNode() *Node

func (*Connect) ProtoMessage

func (*Connect) ProtoMessage()

func (*Connect) Reset

func (m *Connect) Reset()

func (*Connect) String

func (m *Connect) String() string

func (*Connect) XXX_DiscardUnknown

func (m *Connect) XXX_DiscardUnknown()

func (*Connect) XXX_Marshal

func (m *Connect) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Connect) XXX_Merge

func (m *Connect) XXX_Merge(src proto.Message)

func (*Connect) XXX_Size

func (m *Connect) XXX_Size() int

func (*Connect) XXX_Unmarshal

func (m *Connect) XXX_Unmarshal(b []byte) error

type ListRequest

type ListRequest struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Empty request

func (*ListRequest) Descriptor

func (*ListRequest) Descriptor() ([]byte, []int)

func (*ListRequest) ProtoMessage

func (*ListRequest) ProtoMessage()

func (*ListRequest) Reset

func (m *ListRequest) Reset()

func (*ListRequest) String

func (m *ListRequest) String() string

func (*ListRequest) XXX_DiscardUnknown

func (m *ListRequest) XXX_DiscardUnknown()

func (*ListRequest) XXX_Marshal

func (m *ListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ListRequest) XXX_Merge

func (m *ListRequest) XXX_Merge(src proto.Message)

func (*ListRequest) XXX_Size

func (m *ListRequest) XXX_Size() int

func (*ListRequest) XXX_Unmarshal

func (m *ListRequest) XXX_Unmarshal(b []byte) error

type ListResponse

type ListResponse struct {
	Nodes                []*Node  `protobuf:"bytes,1,rep,name=nodes,proto3" json:"nodes,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

ListResponse is returned by ListNodes and ListNeighbours

func (*ListResponse) Descriptor

func (*ListResponse) Descriptor() ([]byte, []int)

func (*ListResponse) GetNodes

func (m *ListResponse) GetNodes() []*Node

func (*ListResponse) ProtoMessage

func (*ListResponse) ProtoMessage()

func (*ListResponse) Reset

func (m *ListResponse) Reset()

func (*ListResponse) String

func (m *ListResponse) String() string

func (*ListResponse) XXX_DiscardUnknown

func (m *ListResponse) XXX_DiscardUnknown()

func (*ListResponse) XXX_Marshal

func (m *ListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ListResponse) XXX_Merge

func (m *ListResponse) XXX_Merge(src proto.Message)

func (*ListResponse) XXX_Size

func (m *ListResponse) XXX_Size() int

func (*ListResponse) XXX_Unmarshal

func (m *ListResponse) XXX_Unmarshal(b []byte) error

type Neighbour

type Neighbour struct {
	// network mode
	Node *Node `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"`
	// neighbours
	Neighbours           []*Node  `protobuf:"bytes,3,rep,name=neighbours,proto3" json:"neighbours,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Neighbour is used to nnounce node neighbourhood

func (*Neighbour) Descriptor

func (*Neighbour) Descriptor() ([]byte, []int)

func (*Neighbour) GetNeighbours

func (m *Neighbour) GetNeighbours() []*Node

func (*Neighbour) GetNode

func (m *Neighbour) GetNode() *Node

func (*Neighbour) ProtoMessage

func (*Neighbour) ProtoMessage()

func (*Neighbour) Reset

func (m *Neighbour) Reset()

func (*Neighbour) String

func (m *Neighbour) String() string

func (*Neighbour) XXX_DiscardUnknown

func (m *Neighbour) XXX_DiscardUnknown()

func (*Neighbour) XXX_Marshal

func (m *Neighbour) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Neighbour) XXX_Merge

func (m *Neighbour) XXX_Merge(src proto.Message)

func (*Neighbour) XXX_Size

func (m *Neighbour) XXX_Size() int

func (*Neighbour) XXX_Unmarshal

func (m *Neighbour) XXX_Unmarshal(b []byte) error

type NetworkHandler

type NetworkHandler interface {
	ListRoutes(context.Context, *proto1.Request, *proto1.ListResponse) error
	ListNodes(context.Context, *ListRequest, *ListResponse) error
	ListNeighbours(context.Context, *ListRequest, *ListResponse) error
}

type NetworkService

type NetworkService interface {
	ListRoutes(ctx context.Context, in *proto1.Request, opts ...client.CallOption) (*proto1.ListResponse, error)
	ListNodes(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error)
	ListNeighbours(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error)
}

func NewNetworkService

func NewNetworkService(name string, c client.Client) NetworkService

type Node

type Node struct {
	// node ide
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// node address
	Address              string   `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Node is network node

func (*Node) Descriptor

func (*Node) Descriptor() ([]byte, []int)

func (*Node) GetAddress

func (m *Node) GetAddress() string

func (*Node) GetId

func (m *Node) GetId() string

func (*Node) ProtoMessage

func (*Node) ProtoMessage()

func (*Node) Reset

func (m *Node) Reset()

func (*Node) String

func (m *Node) String() string

func (*Node) XXX_DiscardUnknown

func (m *Node) XXX_DiscardUnknown()

func (*Node) XXX_Marshal

func (m *Node) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Node) XXX_Merge

func (m *Node) XXX_Merge(src proto.Message)

func (*Node) XXX_Size

func (m *Node) XXX_Size() int

func (*Node) XXX_Unmarshal

func (m *Node) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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