code: func (a *Agent) updateTTLCheck(checkID types.CheckID, status, output string) error {
  	a.stateLock.Lock()
  	defer a.stateLock.Unlock()
  
  	// Grab the TTL check.
  	check, ok := a.checkTTLs[checkID]
  	if !ok {
  		return fmt.Errorf("CheckID %q does not have associated TTL", checkID)
  	}
  
  	// Set the status through CheckTTL to reset the TTL.
  	check.SetStatus(status, output)
  
  	// We don't write any files in dev mode so bail here.
  	if a.config.DataDir == "" {
  		return nil
  	}
  
  	// Persist the state so the TTL check can come up in a good state after
  	// an agent restart, especially with long TTL values.
  	if err := a.persistCheckState(check, status, output); err != nil {
  		return fmt.Errorf("failed persisting state for check %q: %s", checkID, err)
  	}
  
  	return nil
  }
docs: // updateTTLCheck is used to update the status of a TTL check via the Agent API.