code: func (s *Store) WaitForAppliedIndex(idx uint64, timeout time.Duration) error {
  	tck := time.NewTicker(appliedWaitDelay)
  	defer tck.Stop()
  	tmr := time.NewTimer(timeout)
  	defer tmr.Stop()
  
  	for {
  		select {
  		case <-tck.C:
  			if s.raft.AppliedIndex() >= idx {
  				return nil
  			}
  		case <-tmr.C:
  			return fmt.Errorf("timeout expired")
  		}
  	}
  }
docs: // WaitForAppliedIndex blocks until a given log index has been applied,
  // or the timeout expires.