protobuff

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2018 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Echo

type Echo struct {
	// contains filtered or unexported fields
}

Echo ...

func NewEcho

func NewEcho(node *Node) *Echo

NewEcho ...

func (*Echo) SendEcho

func (e *Echo) SendEcho(peerID peer.ID, resp chan interface{}) error

SendEcho ...

type HeadBlock

type HeadBlock struct {
	// contains filtered or unexported fields
}

HeadBlock ...

func NewHeadBlock

func NewHeadBlock(node *Node, getHeadBlockFN func() (mainchain.Block, error)) *HeadBlock

NewHeadBlock ...

func (*HeadBlock) FetchHeadBlock

func (h *HeadBlock) FetchHeadBlock(peerID peer.ID, resp chan interface{}) error

FetchHeadBlock ...

type Interface

type Interface interface {
	NewMessageData(messageID string, gossip bool) *pb.MessageData
	SendEcho(peerID peer.ID, resp chan interface{}) error
	FetchHeadBlock(peerID peer.ID, resp chan interface{}) error
	SendTransaction(peerID peer.ID, txBytes []byte, resp chan interface{}) error
}

Interface ...

type Node

type Node struct {
	host.Host           // lib-p2p host
	*Echo               // echo protocol impl
	*HeadBlock          // headblock protocol impl
	*ProcessTransaction // process transaction impl

}

Node type - a p2p host implementing one or more p2p protocols

func NewNode

func NewNode(props *Props) (*Node, error)

NewNode creates a new node with its implemented protocols

func (*Node) NewMessageData

func (n *Node) NewMessageData(messageID string, gossip bool) *pb.MessageData

NewMessageData is helper method to generate message data shared between all node's p2p protocols messageId: unique for requests, copied from request for responses

type ProcessTransaction

type ProcessTransaction struct {
	// contains filtered or unexported fields
}

ProcessTransaction ...

func NewProcessTransaction

func NewProcessTransaction(node *Node, broadcastTransactionFN func(tx *statechain.Transaction) (*nodetypes.SendTxResponse, error), addPendingTxFN func(tx *statechain.Transaction) error) *ProcessTransaction

NewProcessTransaction ...

func (*ProcessTransaction) SendTransaction

func (p *ProcessTransaction) SendTransaction(peerID peer.ID, txBytes []byte, resp chan interface{}) error

SendTransaction ...

type Props

type Props struct {
	Host                   host.Host
	GetHeadBlockFN         func() (mainchain.Block, error)
	BroadcastTransactionFN func(tx *statechain.Transaction) (*nodetypes.SendTxResponse, error)
	AddPendingTxFN         func(tx *statechain.Transaction) error
}

Props ...

Directories

Path Synopsis
Package protocols_p2p is a generated protocol buffer package.
Package protocols_p2p is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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