@Test public void testEmtpy() throws IOException, ClassNotFoundException { long createdTime = System.nanoTime(); mapTable = new MMFMapTable(testDir, 1, createdTime, 1000, 4); assertTrue(mapTable.getLevel() == 1); assertTrue(mapTable.getCreatedTime() == createdTime); assertTrue(mapTable.getAppendedSize() == 0); assertTrue(mapTable.isEmpty()); assertFalse(mapTable.isUsable()); try { @SuppressWarnings("unused") GetResult result = mapTable.get("empty".getBytes()); fail(); } catch (IllegalArgumentException iae) { } try { mapTable.getMapEntry(-1); fail(); } catch (IllegalArgumentException iae) { } try { mapTable.getMapEntry(0); fail(); } catch (IllegalArgumentException iae) { } }
@Override public IMapEntry getMapEntry(int index) { ensureNotClosed(); Preconditions.checkArgument(index >= 0, "index (%s) must be equal to or greater than 0", index); Preconditions.checkArgument(!isEmpty(), "Can't get map entry since the map is empty"); return new MMFMapEntryImpl(index, this.indexMappedByteBuffer, this.dataMappedByteBuffer); }
MMFMapTable extends AbstractSortedMapTable { @Override public IMapEntry getMapEntry(int index) { ensureNotClosed(); Preconditions.checkArgument(index >= 0, "index (%s) must be equal to or greater than 0", index); Preconditions.checkArgument(!isEmpty(), "Can't get map entry since the map is empty"); return new MMFMapEntryImpl(index, this.indexMappedByteBuffer, this.dataMappedByteBuffer); } }
MMFMapTable extends AbstractSortedMapTable { @Override public IMapEntry getMapEntry(int index) { ensureNotClosed(); Preconditions.checkArgument(index >= 0, "index (%s) must be equal to or greater than 0", index); Preconditions.checkArgument(!isEmpty(), "Can't get map entry since the map is empty"); return new MMFMapEntryImpl(index, this.indexMappedByteBuffer, this.dataMappedByteBuffer); } MMFMapTable(String dir, int level, long createdTime, int expectedInsertions, int mergeWays);  MMFMapTable(String dir, short shard, int level, long createdTime, int expectedInsertions, int mergeWays);  MMFMapTable(String dir, String fileName); }
MMFMapTable extends AbstractSortedMapTable { @Override public IMapEntry getMapEntry(int index) { ensureNotClosed(); Preconditions.checkArgument(index >= 0, "index (%s) must be equal to or greater than 0", index); Preconditions.checkArgument(!isEmpty(), "Can't get map entry since the map is empty"); return new MMFMapEntryImpl(index, this.indexMappedByteBuffer, this.dataMappedByteBuffer); } MMFMapTable(String dir, int level, long createdTime, int expectedInsertions, int mergeWays);  MMFMapTable(String dir, short shard, int level, long createdTime, int expectedInsertions, int mergeWays);  MMFMapTable(String dir, String fileName); void reMap(); IMapEntry appendNew(byte[] key, byte[] value, long timeToLive); @Override IMapEntry appendNew(byte[] key, int keyHash, byte[] value, long timeToLive, long createdTime, boolean markDelete, boolean compressed); @Override IMapEntry getMapEntry(int index); @Override void close(); }
MMFMapTable extends AbstractSortedMapTable { @Override public IMapEntry getMapEntry(int index) { ensureNotClosed(); Preconditions.checkArgument(index >= 0, "index (%s) must be equal to or greater than 0", index); Preconditions.checkArgument(!isEmpty(), "Can't get map entry since the map is empty"); return new MMFMapEntryImpl(index, this.indexMappedByteBuffer, this.dataMappedByteBuffer); } MMFMapTable(String dir, int level, long createdTime, int expectedInsertions, int mergeWays);  MMFMapTable(String dir, short shard, int level, long createdTime, int expectedInsertions, int mergeWays);  MMFMapTable(String dir, String fileName); void reMap(); IMapEntry appendNew(byte[] key, byte[] value, long timeToLive); @Override IMapEntry appendNew(byte[] key, int keyHash, byte[] value, long timeToLive, long createdTime, boolean markDelete, boolean compressed); @Override IMapEntry getMapEntry(int index); @Override void close();  }