CovenantSQL: github.com/CovenantSQL/CovenantSQL/route Index | Files

package route

import "github.com/CovenantSQL/CovenantSQL/route"

Index

Package Files

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

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
)

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

func (s RemoteFunc) String() string

String returns the RemoteFunc string.

type Resolver Uses

type Resolver struct {
    sync.RWMutex
    // 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.