package eu.dnetlib.enabling.manager.msro;

/**
 * Maps indices with mdstores.
 *
 * Currently this map API is primitive as it supports only one mdstore/index.
 *
 * @author marko
 *
 */
public interface ManagerMap {
	/**
	 * find an index for a given mdstore.
	 *
	 * @param mdId mdstore DS indentifier
	 * @return index DS identifier, of null if none
	 */
	String indexForMDStore(String mdId, String format, String layout, String interpretation);

	/**
	 * Register an index associated with an mdstore.
	 *
	 * @param mdId mdstore identifier
	 * @param indexId index identifier
	 * @param format index format
	 * @param index layout
	 */
	void registerIndexForMDStore(String mdId, String indexId, String format, String layout, String interpretation);

	/**
	 * remove an mdstore from the map and his indices.
	 *
	 * @param mdId mdstore identifier
	 */
	void removeMDStore(String mdId);

	/**
	 * remove an index from the map and his mdstores.
	 * @param indexId index id
	 */
	void removeIndex(String indexId);
	
	/**
	 * returns the id of the master index service.
	 * 
	 * @return master index service id.
	 */
	String getMasterIndexService();
	
	/**
	 * set master index service id.
	 * 
	 * @param id service id
	 */
	void setMasterIndexService(String id);
	
	/**
	 * If no master exists, offer the argument as the new master index service.
	 * 
	 * @param id candidate master index service id.
	 */
	void offerMasterIndexService(String id);
}
