func()

in ringpop.go [682:706]


func (rp *Ringpop) LookupN(key string, n int) ([]string, error) {
	if !rp.Ready() {
		return nil, ErrNotBootstrapped
	}
	startTime := time.Now()

	destinations := rp.ring.LookupN(key, n)

	duration := time.Now().Sub(startTime)
	rp.statter.RecordTimer(rp.getStatKey(fmt.Sprintf("lookupn.%d", n)), nil, duration)

	rp.EmitEvent(events.LookupNEvent{
		Key:      key,
		N:        n,
		Duration: duration,
	})

	if len(destinations) == 0 {
		err := errors.New("could not find destinations for key")
		rp.logger.WithField("key", key).Warn(err)
		return destinations, err
	}

	return destinations, nil
}