protected Volume.Factory extendStoreVolumeFactory() { long sizeLimit = propsGetLong(Keys.sizeLimit, 0); String volume = props.getProperty(Keys.volume); if (Keys.volume_heap.equals(volume)) return Volume.memoryFactory(false, sizeLimit); else if (Keys.volume_offheap.equals(volume)) return Volume.memoryFactory(true, sizeLimit); File file = new File(props.getProperty(Keys.file)); return Volume.fileFactory(propsGetBool(Keys.readOnly), propsGetRafMode(), file, sizeLimit); }
@Test public void in_memory_test() { StorageDirect engine = new StorageDirect(Volume.memoryFactory(false)); Map<Long, Integer> recids = new HashMap<Long, Integer>(); for (int i = 0; i < 1000; i++) { long recid = engine.recordPut(i, Serializer.BASIC_SERIALIZER); recids.put(recid, i); } for (Long recid : recids.keySet()) { assertEquals(recids.get(recid), engine.recordGet(recid, Serializer.BASIC_SERIALIZER)); } }