// Path: myeslib-util/src/main/java/org/myeslib/util/hazelcast/HzMapStore.java
// @Slf4j
// public class HzMapStore implements MapStore<UUID, AggregateRootHistory>, PostProcessingMapStore{
// 
// 	private final UnitOfWorkJournalDao<UUID> writer;
// 	private final AggregateRootHistoryReaderDao<UUID> reader;
// 
// 	@Inject
// 	public HzMapStore(UnitOfWorkJournalDao<UUID> writer, AggregateRootHistoryReaderDao<UUID> reader){
// 		this.writer = writer;
// 		this.reader = reader;
// 	}
// 
// 	@Override
// 	public AggregateRootHistory load(UUID key) {
// 		log.info("load {}", key);
// 		return reader.get(key);
// 	}
// 
// 	@Override
// 	public Map<UUID, AggregateRootHistory> loadAll(Collection<UUID> keys) {
// 		log.debug("load all");
// 		Map<UUID, AggregateRootHistory> result = new HashMap<>();
// 		for (UUID id : keys) {
// 			result.put(id, reader.get(id));
// 		}
// 		return result;
// 	}
// 
// 	@Override
// 	public Set<UUID> loadAllKeys() {
// 		// TODO check if is possible to avoid this initial load
// 		log.debug("load all keys -- empty");
// 		Set<UUID> keys = new HashSet<>();
// 		return keys;
// 	}
// 
// 	@Override
// 	public void store(UUID key, AggregateRootHistory value) {
// 		// To set timestamp from db onto it ?
// 		List<UnitOfWork> pending = value.getPendingOfPersistence();
// 		for (UnitOfWork uow : pending){
// 	        log.info("storing id {}, version {}", key, uow.getVersion());
// 	        writer.append(key, uow);
// 	        value.markAsPersisted(uow);
// 		}
// 	}
// 
// 	@Override
// 	public void storeAll(Map<UUID, AggregateRootHistory> map) {
// 		log.debug("store all");
// 		for (Map.Entry<UUID, AggregateRootHistory> entry : map.entrySet()) {
// 			store(entry.getKey(), entry.getValue());
// 		}
// 	}
// 
// 	@Override
// 	public void delete(UUID key) {
// 		// never will delete
// 	}
// 
// 	@Override
// 	public void deleteAll(Collection<UUID> keys) {
// 		// never will delete
// 	}
// 
// }


import org.myeslib.util.hazelcast.HzMapStore;
import com.google.inject.Inject;
import com.google.inject.name.Named;
import com.hazelcast.config.MapConfig;
import com.hazelcast.config.MapStoreConfig;
package org.myeslib.example.hazelcast.infra;



public class InventoryItemMapConfigFactory {
	
    @Inject
// Path: myeslib-util/src/main/java/org/myeslib/util/hazelcast/HzMapStore.java
// @Slf4j
// public class HzMapStore implements MapStore<UUID, AggregateRootHistory>, PostProcessingMapStore{
// 
// 	private final UnitOfWorkJournalDao<UUID> writer;
// 	private final AggregateRootHistoryReaderDao<UUID> reader;
// 
// 	@Inject
// 	public HzMapStore(UnitOfWorkJournalDao<UUID> writer, AggregateRootHistoryReaderDao<UUID> reader){
// 		this.writer = writer;
// 		this.reader = reader;
// 	}
// 
// 	@Override
// 	public AggregateRootHistory load(UUID key) {
// 		log.info("load {}", key);
// 		return reader.get(key);
// 	}
// 
// 	@Override
// 	public Map<UUID, AggregateRootHistory> loadAll(Collection<UUID> keys) {
// 		log.debug("load all");
// 		Map<UUID, AggregateRootHistory> result = new HashMap<>();
// 		for (UUID id : keys) {
// 			result.put(id, reader.get(id));
// 		}
// 		return result;
// 	}
// 
// 	@Override
// 	public Set<UUID> loadAllKeys() {
// 		// TODO check if is possible to avoid this initial load
// 		log.debug("load all keys -- empty");
// 		Set<UUID> keys = new HashSet<>();
// 		return keys;
// 	}
// 
// 	@Override
// 	public void store(UUID key, AggregateRootHistory value) {
// 		// To set timestamp from db onto it ?
// 		List<UnitOfWork> pending = value.getPendingOfPersistence();
// 		for (UnitOfWork uow : pending){
// 	        log.info("storing id {}, version {}", key, uow.getVersion());
// 	        writer.append(key, uow);
// 	        value.markAsPersisted(uow);
// 		}
// 	}
// 
// 	@Override
// 	public void storeAll(Map<UUID, AggregateRootHistory> map) {
// 		log.debug("store all");
// 		for (Map.Entry<UUID, AggregateRootHistory> entry : map.entrySet()) {
// 			store(entry.getKey(), entry.getValue());
// 		}
// 	}
// 
// 	@Override
// 	public void delete(UUID key) {
// 		// never will delete
// 	}
// 
// 	@Override
// 	public void deleteAll(Collection<UUID> keys) {
// 		// never will delete
// 	}
// 
// }


// Path: inventory-hazelcast/src/main/java/org/myeslib/example/hazelcast/infra/InventoryItemMapConfigFactory.java
import org.myeslib.util.hazelcast.HzMapStore;
import com.google.inject.Inject;
import com.google.inject.name.Named;
import com.hazelcast.config.MapConfig;
import com.hazelcast.config.MapStoreConfig;

package org.myeslib.example.hazelcast.infra;



public class InventoryItemMapConfigFactory {
	
    @Inject
	public InventoryItemMapConfigFactory(HzMapStore mapStore, @Named("writeDelaySeconds") int writeDelaySeconds) {