Documentation ¶
Index ¶
- Constants
- Variables
- type Client
- func (client *Client) Close()
- func (client *Client) GetBlockChainHeight() (*pb.DownloaderResponse, error)
- func (client *Client) GetBlockHashes(startHash []byte, size uint32, ip, port string) *pb.DownloaderResponse
- func (client *Client) GetBlockHeaders(hashes [][]byte) *pb.DownloaderResponse
- func (client *Client) GetBlocks(hashes [][]byte) *pb.DownloaderResponse
- func (client *Client) GetBlocksAndSigs(hashes [][]byte) *pb.DownloaderResponse
- func (client *Client) PushNewBlock(selfPeerHash [20]byte, blockBytes []byte, timeout bool) (*pb.DownloaderResponse, error)
- func (client *Client) Register(hash []byte, ip, port string) *pb.DownloaderResponse
- type DownloadInterface
- type Server
Constants ¶
const (
DefaultDownloadPort = "6666"
)
Constants for downloader server.
Variables ¶
var (
ErrDownloaderWithNoNode = errors.New("no node attached")
)
Errors for downloader package.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the client model for downloader package.
func ClientSetup ¶
ClientSetup setups a Client given ip and port.
func (*Client) GetBlockChainHeight ¶
func (client *Client) GetBlockChainHeight() (*pb.DownloaderResponse, error)
GetBlockChainHeight gets the blockheight from peer
func (*Client) GetBlockHashes ¶
func (client *Client) GetBlockHashes(startHash []byte, size uint32, ip, port string) *pb.DownloaderResponse
GetBlockHashes gets block hashes from all the peers by calling grpc request.
func (*Client) GetBlockHeaders ¶
func (client *Client) GetBlockHeaders(hashes [][]byte) *pb.DownloaderResponse
GetBlockHeaders gets block headers in serialization byte array by calling a grpc request.
func (*Client) GetBlocks ¶
func (client *Client) GetBlocks(hashes [][]byte) *pb.DownloaderResponse
GetBlocks gets blocks in serialization byte array by calling a grpc request.
func (*Client) GetBlocksAndSigs ¶
func (client *Client) GetBlocksAndSigs(hashes [][]byte) *pb.DownloaderResponse
GetBlocksAndSigs get blockWithSig in serialization byte array by calling a grpc request
func (*Client) PushNewBlock ¶
func (client *Client) PushNewBlock(selfPeerHash [20]byte, blockBytes []byte, timeout bool) (*pb.DownloaderResponse, error)
PushNewBlock will send the lastest verified block to registered nodes
type DownloadInterface ¶
type DownloadInterface interface { // State Syncing server-side interface, responsible for all kinds of state syncing grpc calls // incomingPeer is incoming peer ip:port information CalculateResponse(request *pb.DownloaderRequest, incomingPeer string) (*pb.DownloaderResponse, error) }
DownloadInterface is the interface for downloader package.
type Server ¶
Server is the Server struct for downloader package.
func NewServer ¶
func NewServer(dlInterface DownloadInterface) *Server
NewServer creates new Server which implements DownloadInterface.
func (*Server) Query ¶
func (s *Server) Query(ctx context.Context, request *pb.DownloaderRequest) (*pb.DownloaderResponse, error)
Query returns the feature at the given point.