rpc

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChainRPC      = "chain"
	BlockStoreRPC = "block_store"
)

RPC service constants

View Source
const PeerRPCID = "/koinos/peerrpc/1.0.0"

PeerRPCID Identifies the peer rpc service

Variables

This section is empty.

Functions

This section is empty.

Types

type GetAncestorBlockIDRequest added in v0.2.0

type GetAncestorBlockIDRequest struct {
	ParentID    multihash.Multihash
	ChildHeight uint64
}

GetAncestorBlockIDRequest args

type GetAncestorBlockIDResponse added in v0.2.0

type GetAncestorBlockIDResponse struct {
	ID multihash.Multihash
}

GetAncestorBlockIDResponse return

type GetBlocksRequest added in v0.2.0

type GetBlocksRequest struct {
	HeadBlockID      multihash.Multihash
	StartBlockHeight uint64
	NumBlocks        uint32
}

GetBlocksRequest args

type GetBlocksResponse added in v0.2.0

type GetBlocksResponse struct {
	Blocks [][]byte
}

GetBlocksResponse return

type GetChainIDRequest added in v0.2.0

type GetChainIDRequest struct {
}

GetChainIDRequest args

type GetChainIDResponse added in v0.2.0

type GetChainIDResponse struct {
	ID multihash.Multihash
}

GetChainIDResponse return

type GetHeadBlockRequest added in v0.2.0

type GetHeadBlockRequest struct {
}

GetHeadBlockRequest args

type GetHeadBlockResponse added in v0.2.0

type GetHeadBlockResponse struct {
	ID     multihash.Multihash
	Height uint64
}

GetHeadBlockResponse return

type KoinosRPC

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

KoinosRPC implements LocalRPC implementation by communicating with a local Koinos node via AMQP

func NewKoinosRPC

func NewKoinosRPC(mq *koinosmq.Client) *KoinosRPC

NewKoinosRPC factory

func (*KoinosRPC) ApplyBlock

func (k *KoinosRPC) ApplyBlock(ctx context.Context, block *protocol.Block) (*chainrpc.SubmitBlockResponse, error)

ApplyBlock rpc call

func (*KoinosRPC) ApplyTransaction

ApplyTransaction rpc call

func (*KoinosRPC) BroadcastGossipStatus added in v0.3.0

func (k *KoinosRPC) BroadcastGossipStatus(ctx context.Context, enabled bool) error

BroadcastGossipStatus broadcasts the gossip status to the

func (*KoinosRPC) GetBlocksByHeight

func (k *KoinosRPC) GetBlocksByHeight(ctx context.Context, blockID multihash.Multihash, height uint64, numBlocks uint32) (*block_store.GetBlocksByHeightResponse, error)

GetBlocksByHeight rpc call

func (*KoinosRPC) GetBlocksByID

func (k *KoinosRPC) GetBlocksByID(ctx context.Context, blockIDs []multihash.Multihash) (*block_store.GetBlocksByIdResponse, error)

GetBlocksByID rpc call

func (*KoinosRPC) GetChainID

func (k *KoinosRPC) GetChainID(ctx context.Context) (*chainrpc.GetChainIdResponse, error)

GetChainID rpc call

func (*KoinosRPC) GetForkHeads

func (k *KoinosRPC) GetForkHeads(ctx context.Context) (*chainrpc.GetForkHeadsResponse, error)

GetForkHeads rpc call

func (*KoinosRPC) GetHeadBlock

func (k *KoinosRPC) GetHeadBlock(ctx context.Context) (*chainrpc.GetHeadInfoResponse, error)

GetHeadBlock rpc call

func (*KoinosRPC) IsConnectedToBlockStore

func (k *KoinosRPC) IsConnectedToBlockStore(ctx context.Context) (bool, error)

IsConnectedToBlockStore returns if the AMQP connection can currently communicate with the block store microservice.

func (*KoinosRPC) IsConnectedToChain

func (k *KoinosRPC) IsConnectedToChain(ctx context.Context) (bool, error)

IsConnectedToChain returns if the AMQP connection can currently communicate with the chain microservice.

type LocalRPC added in v0.2.0

type LocalRPC interface {
	GetHeadBlock(ctx context.Context) (*chain.GetHeadInfoResponse, error)
	ApplyBlock(ctx context.Context, block *protocol.Block) (*chain.SubmitBlockResponse, error)
	ApplyTransaction(ctx context.Context, block *protocol.Transaction) (*chain.SubmitTransactionResponse, error)
	GetBlocksByHeight(ctx context.Context, blockIDs multihash.Multihash, height uint64, numBlocks uint32) (*block_store.GetBlocksByHeightResponse, error)
	GetChainID(ctx context.Context) (*chain.GetChainIdResponse, error)
	GetForkHeads(ctx context.Context) (*chain.GetForkHeadsResponse, error)
	GetBlocksByID(ctx context.Context, blockIDs []multihash.Multihash) (*block_store.GetBlocksByIdResponse, error)
	BroadcastGossipStatus(ctx context.Context, enabled bool) error

	IsConnectedToBlockStore(ctx context.Context) (bool, error)
	IsConnectedToChain(ctx context.Context) (bool, error)
}

LocalRPC interface for local node RPC methods required for koinos-p2p to function

type PeerRPC added in v0.2.0

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

PeerRPC implements RemoteRPC interface by communicating via libp2p's gorpc

func NewPeerRPC added in v0.2.0

func NewPeerRPC(client *gorpc.Client, peerID peer.ID) *PeerRPC

NewPeerRPC creates a PeerRPC

func (*PeerRPC) GetAncestorBlockID added in v0.2.0

func (p *PeerRPC) GetAncestorBlockID(ctx context.Context, parentID multihash.Multihash, childHeight uint64) (id multihash.Multihash, err error)

GetAncestorBlockID rpc call

func (*PeerRPC) GetBlocks added in v0.2.0

func (p *PeerRPC) GetBlocks(ctx context.Context, headBlockID multihash.Multihash, startBlockHeight uint64, numBlocks uint32) (blocks []protocol.Block, err error)

GetBlocks rpc call

func (*PeerRPC) GetChainID added in v0.2.0

func (p *PeerRPC) GetChainID(ctx context.Context) (id multihash.Multihash, err error)

GetChainID rpc call

func (*PeerRPC) GetHeadBlock added in v0.2.0

func (p *PeerRPC) GetHeadBlock(ctx context.Context) (id multihash.Multihash, height uint64, err error)

GetHeadBlock rpc call

type PeerRPCService added in v0.2.0

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

PeerRPCService implements a libp2p_rpc service

func NewPeerRPCService added in v0.2.0

func NewPeerRPCService(local LocalRPC) *PeerRPCService

NewPeerRPCService creates a PeerRPCService

func (*PeerRPCService) GetAncestorBlockID added in v0.2.0

func (p *PeerRPCService) GetAncestorBlockID(ctx context.Context, request *GetAncestorBlockIDRequest, response *GetAncestorBlockIDResponse) error

GetAncestorBlockID peer rpc implementation

func (*PeerRPCService) GetBlocks added in v0.2.0

func (p *PeerRPCService) GetBlocks(ctx context.Context, request *GetBlocksRequest, response *GetBlocksResponse) error

GetBlocks peer rpc implementation

func (*PeerRPCService) GetChainID added in v0.2.0

func (p *PeerRPCService) GetChainID(ctx context.Context, request *GetChainIDRequest, response *GetChainIDResponse) error

GetChainID peer rpc implementation

func (*PeerRPCService) GetHeadBlock added in v0.2.0

func (p *PeerRPCService) GetHeadBlock(ctx context.Context, request *GetHeadBlockRequest, response *GetHeadBlockResponse) error

GetHeadBlock peer rpc implementation

type RemoteRPC added in v0.2.0

type RemoteRPC interface {
	GetChainID(ctx context.Context) (id multihash.Multihash, err error)
	GetHeadBlock(ctx context.Context) (id multihash.Multihash, height uint64, err error)
	GetAncestorBlockID(ctx context.Context, parentID multihash.Multihash, childHeight uint64) (id multihash.Multihash, err error)
	GetBlocks(ctx context.Context, headBlockID multihash.Multihash, startBlockHeight uint64, batchSize uint32) (blocks []protocol.Block, err error)
}

RemoteRPC interface for remote node RPC methods required for koinos-p2p to function

Jump to

Keyboard shortcuts

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