code: func (s *Store) CoordinateBatchUpdate(idx uint64, updates structs.Coordinates) error {
  	tx := s.db.Txn(true)
  	defer tx.Abort()
  
  	// Upsert the coordinates.
  	for _, update := range updates {
  		// Skip any bad data that may have gotten into the database from
  		// a bad client in the past.
  		if !update.Coord.IsValid() {
  			continue
  		}
  
  		// Since the cleanup of coordinates is tied to deletion of
  		// nodes, we silently drop any updates for nodes that we don't
  		// know about. This might be possible during normal operation
  		// if we happen to get a coordinate update for a node that
  		// hasn't been able to add itself to the catalog yet. Since we
  		// don't carefully sequence this, and since it will fix itself
  		// on the next coordinate update from that node, we don't return
  		// an error or log anything.
  		node, err := tx.First("nodes", "id", update.Node)
  		if err != nil {
  			return fmt.Errorf("failed node lookup: %s", err)
  		}
  		if node == nil {
  			continue
  		}
  
  		if err := tx.Insert("coordinates", update); err != nil {
  			return fmt.Errorf("failed inserting coordinate: %s", err)
  		}
  	}
  
  	// Update the index.
  	if err := tx.Insert("index", &IndexEntry{"coordinates", idx}); err != nil {
  		return fmt.Errorf("failed updating index: %s", err)
  	}
  
  	tx.Commit()
  	return nil
  }
docs: // CoordinateBatchUpdate processes a batch of coordinate updates and applies
  // them in a single transaction.