code: func (s *Store) deleteServiceCASTxn(tx *memdb.Txn, idx, cidx uint64, nodeName, serviceID string) (bool, error) {
  	// Look up the service.
  	service, err := s.getNodeServiceTxn(tx, nodeName, serviceID)
  	if err != nil {
  		return false, fmt.Errorf("service lookup failed: %s", err)
  	}
  	if service == nil {
  		return false, nil
  	}
  
  	// If the existing index does not match the provided CAS
  	// index arg, then we shouldn't update anything and can safely
  	// return early here.
  	if service.ModifyIndex != cidx {
  		return false, nil
  	}
  
  	// Call the actual deletion if the above passed.
  	if err := s.deleteServiceTxn(tx, idx, nodeName, serviceID); err != nil {
  		return false, err
  	}
  
  	return true, nil
  }
docs: // deleteServiceCASTxn is used to try doing a service delete operation with a given
  // raft index. If the CAS index specified is not equal to the last observed index for
  // the given service, then the call is a noop, otherwise a normal delete is invoked.