Documentation
¶
Index ¶
- Constants
- Variables
- func FromDomain(domain string, f func(host string) ([]net.IP, error)) (out []byte, err error)
- func FromIPv6(ips []net.IP) (out []byte, err error)
- func GetBPs() (bpAddrs []proto.NodeID)
- func GetNodeAddrCache(id *proto.RawNodeID) (addr string, err error)
- func InitKMS(PubKeyStoreFile string)
- func IsBPNodeID(id *proto.RawNodeID) bool
- func IsPermitted(callerEnvelope *proto.Envelope, funcName RemoteFunc) (ok bool)
- func SetNodeAddrCache(id *proto.RawNodeID, addr string) (err error)
- func ToIPv6(in []byte) (ips []net.IP, err error)
- type DHTService
- func (DHT *DHTService) FindNeighbor(req *proto.FindNeighborReq, resp *proto.FindNeighborResp) (err error)
- func (DHT *DHTService) FindNode(req *proto.FindNodeReq, resp *proto.FindNodeResp) (err error)
- func (DHT *DHTService) Nil(req *interface{}, resp *interface{}) (err error)
- func (DHT *DHTService) Ping(req *proto.PingReq, resp *proto.PingResp) (err error)
- type IDNodeMap
- type IPv6SeedClient
- type NodeIDAddressMap
- type RemoteFunc
- type Resolver
Constants ¶
const ( // ID is node id ID = "id." // PUBKEY is public key PUBKEY = "pub." // NONCE is nonce NONCE = "n." // ADDR is address ADDR = "addr." )
Variables ¶
var ( // ErrUnknownNodeID indicates we got unknown node id ErrUnknownNodeID = errors.New("unknown node id") // ErrNilNodeID indicates we got nil node id ErrNilNodeID = errors.New("nil node id") )
var ( // Once is exported just for unit test Once utils.Once )
Functions ¶
func FromDomain ¶
func GetNodeAddrCache ¶
GetNodeAddrCache gets node addr by node id, if cache missed try RPC.
func IsBPNodeID ¶
IsBPNodeID returns if it is Block Producer node id.
func IsPermitted ¶
func IsPermitted(callerEnvelope *proto.Envelope, funcName RemoteFunc) (ok bool)
IsPermitted returns if the node is permitted to call the RPC func.
func SetNodeAddrCache ¶
SetNodeAddrCache sets node id and addr.
Types ¶
type DHTService ¶
type DHTService struct {
Consistent *consistent.Consistent
}
DHTService is server side RPC implementation.
func NewDHTService ¶
func NewDHTService(DHTStorePath string, persistImpl consistent.Persistence, initBP bool) (s *DHTService, err error)
NewDHTService will return a new DHTService.
func NewDHTServiceWithRing ¶
func NewDHTServiceWithRing(c *consistent.Consistent) (s *DHTService, err error)
NewDHTServiceWithRing will return a new DHTService and set an existing hash ring.
func (*DHTService) FindNeighbor ¶
func (DHT *DHTService) FindNeighbor(req *proto.FindNeighborReq, resp *proto.FindNeighborResp) (err error)
FindNeighbor RPC returns FindNeighborReq.Count closest node from DHT.
func (*DHTService) FindNode ¶
func (DHT *DHTService) FindNode(req *proto.FindNodeReq, resp *proto.FindNodeResp) (err error)
FindNode RPC returns node with requested node id from DHT.
func (*DHTService) Nil ¶
func (DHT *DHTService) Nil(req *interface{}, resp *interface{}) (err error)
Nil RPC does nothing just for probe.
type IPv6SeedClient ¶
type IPv6SeedClient struct{}
IPv6SeedClient is IPv6 DNS seed client
func (*IPv6SeedClient) GetBPFromDNSSeed ¶
func (isc *IPv6SeedClient) GetBPFromDNSSeed(BPDomain string) (BPNodes IDNodeMap, err error)
GetBPFromDNSSeed gets BP info from the IPv6 domain
type NodeIDAddressMap ¶
NodeIDAddressMap is the map of proto.RawNodeID to node address.
type RemoteFunc ¶
type RemoteFunc int
RemoteFunc defines the RPC Call name.
const ( // DHTPing is for node info register to BP DHTPing RemoteFunc = iota // DHTFindNeighbor finds consistent hash neighbors DHTFindNeighbor // DHTFindNode gets node info DHTFindNode // DHTGSetNode is used by BP for dht data gossip DHTGSetNode // MetricUploadMetrics uploads node metrics MetricUploadMetrics // DBSQuery is used by client to read/write database DBSQuery // DBSAck is used by client to send acknowledge to the query response DBSAck // DBSDeploy is used by BP to create/drop/update database DBSDeploy // DBSObserverFetchBlock is used by observer to fetch block. DBSObserverFetchBlock // DBCCall is used by Miner for data consistency DBCCall // SQLCAdviseNewBlock is used by sqlchain to advise new block between adjacent node SQLCAdviseNewBlock // SQLCFetchBlock is used by sqlchain to fetch block from adjacent nodes SQLCFetchBlock // SQLCSignBilling is used by sqlchain to response billing signature for periodic billing request SQLCSignBilling // SQLCLaunchBilling is used by blockproducer to trigger the billing process in sqlchain SQLCLaunchBilling // MCCAdviseNewBlock is used by block producer to push block to adjacent nodes MCCAdviseNewBlock // MCCAdviseTxBilling is used by block producer to push billing transaction to adjacent nodes MCCAdviseTxBilling // MCCAdviseBillingRequest is used by block producer to push billing request to adjacent nodes MCCAdviseBillingRequest // MCCFetchBlock is used by nodes to fetch block from block producer MCCFetchBlock // MCCFetchBlockByCount is used by nodes to fetch block from block producer by block count since genesis MCCFetchBlockByCount // MCCFetchLastIrreversibleBlock is used by nodes to fetch last irreversible block from // block producer MCCFetchLastIrreversibleBlock // MCCFetchTxBilling is used by nodes to fetch billing transaction from block producer MCCFetchTxBilling // MCCNextAccountNonce is used by block producer main chain to allocate next nonce for transactions MCCNextAccountNonce // MCCAddTx is used by block producer main chain to upload transaction MCCAddTx // MCCQuerySQLChainProfile is used by nodes to query SQLChainProfile. MCCQuerySQLChainProfile // MCCQueryAccountTokenBalance is used by block producer to provide account token balance MCCQueryAccountTokenBalance // MCCQueryTxState is used by client to query transaction state. MCCQueryTxState // MCCQueryAccountSQLChainProfiles is used by client to query account databases. MCCQueryAccountSQLChainProfiles // MaxRPCOffset defines max rpc constant. MaxRPCOffset // DHTRPCName defines the block producer dh-rpc service name DHTRPCName = "DHT" // DHTGossipRPCName defines the block producer dh-rpc gossip service name DHTGossipRPCName = "DHTG" // BlockProducerRPCName defines main chain rpc name BlockProducerRPCName = "MCC" // SQLChainRPCName defines the sql chain rpc name SQLChainRPCName = "SQLC" // DBRPCName defines the sql chain db service rpc name DBRPCName = "DBS" )
func (RemoteFunc) String ¶
func (s RemoteFunc) String() string
String returns the RemoteFunc string.