MCPcopy
hub / github.com/dgraph-io/dgraph / containerIdxFromAddr

Function containerIdxFromAddr

dgraphtest/zero_state.go:216–223  ·  view source on GitHub ↗

containerIdxFromAddr extracts the numeric suffix from the "zeroN" segment of a member's address and returns it as the container index used by tests.

(addr string)

Source from the content-addressed store, hash-verified

214// containerIdxFromAddr extracts the numeric suffix from the "zeroN" segment
215// of a member's address and returns it as the container index used by tests.
216func containerIdxFromAddr(addr string) (int, bool) {
217 for i := range maxContainerIdxScan {
218 if strings.Contains(addr, fmt.Sprintf("zero%d", i)) {
219 return i, true
220 }
221 }
222 return -1, false
223}
224
225// maxContainerIdxScan bounds the zero N scan in containerIdxFromAddr. It is
226// larger than any realistic test topology.

Callers 2

GetZeroFollowersMethod · 0.85
findZeroMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected