MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / GetNodeAddrCache

Function GetNodeAddrCache

route/dns.go:91–103  ·  view source on GitHub ↗

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

(id *proto.RawNodeID)

Source from the content-addressed store, hash-verified

89
90// GetNodeAddrCache gets node addr by node id, if cache missed try RPC.
91func GetNodeAddrCache(id *proto.RawNodeID) (addr string, err error) {
92 initResolver()
93 if id == nil {
94 return "", ErrNilNodeID
95 }
96 resolver.RLock()
97 defer resolver.RUnlock()
98 addr, ok := resolver.cache[*id]
99 if !ok {
100 return "", ErrUnknownNodeID
101 }
102 return
103}
104
105// setNodeAddrCache sets node id and addr.
106func setNodeAddrCache(id *proto.RawNodeID, addr string) (err error) {

Callers 2

GetNodeAddrFunction · 0.92
TestResolverFunction · 0.85

Calls 1

initResolverFunction · 0.85

Tested by 1

TestResolverFunction · 0.68