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

Method search

consistent/consistent.go:259–269  ·  view source on GitHub ↗
(key proto.NodeKey)

Source from the content-addressed store, hash-verified

257}
258
259func (c *Consistent) search(key proto.NodeKey) (i int) {
260 f := func(x int) bool {
261 //return c.sortedHashes[x] > key
262 return key.Less(&c.sortedHashes[x])
263 }
264 i = sort.Search(len(c.sortedHashes), f)
265 if i >= len(c.sortedHashes) {
266 i = 0
267 }
268 return
269}
270
271// GetTwoNeighbors returns the two closest distinct nodes to the name input in the circle.
272func (c *Consistent) GetTwoNeighbors(name string) (proto.Node, proto.Node, error) {

Callers 3

GetNeighborMethod · 0.95
GetTwoNeighborsMethod · 0.95
GetNeighborsExMethod · 0.95

Calls 1

LessMethod · 0.45

Tested by

no test coverage detected