func (w *WALWatcher) findSegmentForIndex(index int) (int, error) {
	refs, err := w.segments(w.walDir)
	if err != nil {
		return -1, nil
	}

	for _, r := range refs {
		if r >= index {
			return r, nil
		}
	}

	return -1, errors.New("failed to find segment for index")
}
func (w *WALWatcher) findSegmentForIndex(index int) (int, error) {
	refs, err := w.segments(w.walDir)
	if err != nil {
		return -1, nil
	}

	for _, r := range refs {
		if r >= index {
			return r, nil
		}
	}

	return -1, errors.New("failed to find segment for index")
}
func ( w * WALWatcher ) findSegmentForIndex ( index int ) ( int , error ) { refs , err := w . segments ( w . walDir ) if err != nil { return - 1 , nil } for _ , r := range refs { if r >= index { return r , nil } } return - 1 , errors . New ( " " ) }
// findSegmentForIndex finds the first segment greater than or equal to index.
findSegmentForIndex finds the first segment greater than or equal to index .