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

Method GetNeighbors

consistent/consistent.go:355–357  ·  view source on GitHub ↗

GetNeighbors returns the N closest distinct nodes to the name input in the circle.

(name string, n int)

Source from the content-addressed store, hash-verified

353
354// GetNeighbors returns the N closest distinct nodes to the name input in the circle.
355func (c *Consistent) GetNeighbors(name string, n int) ([]proto.Node, error) {
356 return c.GetNeighborsEx(name, n, nil)
357}
358
359func hashKey(key string) proto.NodeKey {
360 return proto.NodeKey{Hash: hash.HashH([]byte(key))}

Callers 9

TestGetNFunction · 0.80
TestGetNLessFunction · 0.80
TestGetNMoreFunction · 0.80
TestGetNEmptyFunction · 0.80
TestGetNQuickFunction · 0.80
TestGetNLessQuickFunction · 0.80
TestGetNMoreQuickFunction · 0.80
BenchmarkGetNFunction · 0.80
BenchmarkGetNLargeFunction · 0.80

Calls 1

GetNeighborsExMethod · 0.95

Tested by 9

TestGetNFunction · 0.64
TestGetNLessFunction · 0.64
TestGetNMoreFunction · 0.64
TestGetNEmptyFunction · 0.64
TestGetNQuickFunction · 0.64
TestGetNLessQuickFunction · 0.64
TestGetNMoreQuickFunction · 0.64
BenchmarkGetNFunction · 0.64
BenchmarkGetNLargeFunction · 0.64