code: func indexUpdateMaxTxn(tx *memdb.Txn, idx uint64, table string) error {
  	ti, err := tx.First("index", "id", table)
  	if err != nil {
  		return fmt.Errorf("failed to retrieve existing index: %s", err)
  	}
  
  	// Always take the first update, otherwise do the > check.
  	if ti == nil {
  		if err := tx.Insert("index", &IndexEntry{table, idx}); err != nil {
  			return fmt.Errorf("failed updating index %s", err)
  		}
  	} else if cur, ok := ti.(*IndexEntry); ok && idx > cur.Value {
  		if err := tx.Insert("index", &IndexEntry{table, idx}); err != nil {
  			return fmt.Errorf("failed updating index %s", err)
  		}
  	}
  
  	return nil
  }
docs: // indexUpdateMaxTxn is used when restoring entries and sets the table's index to
  // the given idx only if it's greater than the current index.