CovenantSQL: Index | Files

package route

import ""


Package Files

acl.go dns.go ipv6seed.go service.go


const (
    // ID is node id
    ID  = "id."
    // PUBKEY is public key
    PUBKEY = "pub."
    // NONCE is nonce
    NONCE = "n."
    // ADDR is address
    ADDR = "addr."


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

func GetBPs Uses

func GetBPs() (bpAddrs []proto.NodeID)

GetBPs returns the known BP node id list.

func GetNodeAddrCache Uses

func GetNodeAddrCache(id *proto.RawNodeID) (addr string, err error)

GetNodeAddrCache gets node addr by node id, if cache missed try RPC.

func InitKMS Uses

func InitKMS(PubKeyStoreFile string)

InitKMS inits nasty stuff, only for testing.

func IsBPNodeID Uses

func IsBPNodeID(id *proto.RawNodeID) bool

IsBPNodeID returns if it is Block Producer node id.

func IsPermitted Uses

func IsPermitted(callerEnvelope *proto.Envelope, funcName RemoteFunc) (ok bool)

IsPermitted returns if the node is permitted to call the RPC func.

func SetNodeAddrCache Uses

func SetNodeAddrCache(id *proto.RawNodeID, addr string) (err error)

SetNodeAddrCache sets node id and addr.

type DHTService Uses

type DHTService struct {
    Consistent *consistent.Consistent

DHTService is server side RPC implementation.

func NewDHTService Uses

func NewDHTService(DHTStorePath string, persistImpl consistent.Persistence, initBP bool) (s *DHTService, err error)

NewDHTService will return a new DHTService.

func NewDHTServiceWithRing Uses

func NewDHTServiceWithRing(c *consistent.Consistent) (s *DHTService, err error)

NewDHTServiceWithRing will return a new DHTService and set an existing hash ring.

func (*DHTService) FindNeighbor Uses

func (DHT *DHTService) FindNeighbor(req *proto.FindNeighborReq, resp *proto.FindNeighborResp) (err error)

FindNeighbor RPC returns FindNeighborReq.Count closest node from DHT.

func (*DHTService) FindNode Uses

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 Uses

func (DHT *DHTService) Nil(req *interface{}, resp *interface{}) (err error)

Nil RPC does nothing just for probe.

func (*DHTService) Ping Uses

func (DHT *DHTService) Ping(req *proto.PingReq, resp *proto.PingResp) (err error)

Ping RPC adds PingReq.Node to DHT.

type IDNodeMap Uses

type IDNodeMap map[proto.RawNodeID]proto.Node

IDNodeMap is the map of proto.RawNodeID to node.

type IPv6SeedClient Uses

type IPv6SeedClient struct{}

IPv6SeedClient is IPv6 DNS seed client

func (*IPv6SeedClient) GenBPIPv6 Uses

func (isc *IPv6SeedClient) GenBPIPv6(node *proto.Node, domain string) (out string, err error)

GenBPIPv6 generates the IPv6 addrs contain BP info

func (*IPv6SeedClient) GetBPFromDNSSeed Uses

func (isc *IPv6SeedClient) GetBPFromDNSSeed(BPDomain string) (BPNodes IDNodeMap, err error)

GetBPFromDNSSeed gets BP info from the IPv6 domain

type NodeIDAddressMap Uses

type NodeIDAddressMap map[proto.RawNodeID]string

NodeIDAddressMap is the map of proto.RawNodeID to node address.

type RemoteFunc Uses

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
    // DHTFindNode gets node info
    // DHTGSetNode is used by BP for dht data gossip
    // MetricUploadMetrics uploads node metrics
    // DBSQuery is used by client to read/write database
    // DBSAck is used by client to send acknowledge to the query response
    // DBSDeploy is used by BP to create/drop/update database
    // DBSObserverFetchBlock is used by observer to fetch block.
    // DBCCall is used by Miner for data consistency
    // SQLCAdviseNewBlock is used by sqlchain to advise new block between adjacent node
    // SQLCFetchBlock is used by sqlchain to fetch block from adjacent nodes
    // SQLCSignBilling is used by sqlchain to response billing signature for periodic billing request
    // SQLCLaunchBilling is used by blockproducer to trigger the billing process in sqlchain
    // MCCAdviseNewBlock is used by block producer to push block to adjacent nodes
    // MCCAdviseTxBilling is used by block producer to push billing transaction to adjacent nodes
    // MCCAdviseBillingRequest is used by block producer to push billing request to adjacent nodes
    // MCCFetchBlock is used by nodes to fetch block from block producer
    // MCCFetchBlockByCount is used by nodes to fetch block from block producer by block count since genesis
    // MCCFetchLastIrreversibleBlock is used by nodes to fetch last irreversible block from
    // block producer
    // MCCFetchTxBilling is used by nodes to fetch billing transaction from block producer
    // MCCNextAccountNonce is used by block producer main chain to allocate next nonce for transactions
    // MCCAddTx is used by block producer main chain to upload transaction
    // MCCQuerySQLChainProfile is used by nodes to query SQLChainProfile.
    // MCCQueryAccountTokenBalance is used by block producer to provide account token balance
    // MCCQueryTxState is used by client to query transaction state.
    // MCCQueryAccountSQLChainProfiles is used by client to query account databases.
    // MaxRPCOffset defines max rpc constant.

    // 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 Uses

func (s RemoteFunc) String() string

String returns the RemoteFunc string.

type Resolver Uses

type Resolver struct {
    // contains filtered or unexported fields

Resolver does NodeID translation.

Package route imports 16 packages (graph) and is imported by 22 packages. Updated 2019-08-12. Refresh now. Tools for package owners.