@Test public void testAppendAndGet() throws IOException, ClassNotFoundException { long createdTime = System.nanoTime(); mapTable = new FCMapTable(testDir, 1, createdTime, 1000); assertTrue(mapTable.getLevel() == 1); assertTrue(mapTable.getCreatedTime() == createdTime); assertTrue(mapTable.getAppendedSize() == 0); assertTrue(mapTable.isEmpty()); assertTrue(mapTable.getBackFileSize() == HashMapTable.INIT_INDEX_FILE_SIZE + HashMapTable.INIT_DATA_FILE_SIZE + HashMapTable.INDEX_ITEM_LENGTH); mapTable.appendNew("key".getBytes(), "value".getBytes(), 500); assertTrue(mapTable.getLevel() == 1); assertTrue(mapTable.getCreatedTime() == createdTime); assertTrue(mapTable.getAppendedSize() == 1); assertFalse(mapTable.isEmpty()); GetResult result = mapTable.get("key".getBytes()); assertTrue(result.isFound()); assertTrue(!result.isDeleted()); assertTrue(!result.isExpired()); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } result = mapTable.get("key".getBytes()); assertTrue(result.isFound()); assertTrue(!result.isDeleted()); assertTrue(result.isExpired()); result = mapTable.get("key1".getBytes()); assertFalse(result.isFound()); assertFalse(mapTable.isUsable()); }
public IMapEntry appendNew(byte[] key, byte[] value, long timeToLive) throws IOException { return this.appendNew(key, Arrays.hashCode(key), value, timeToLive, System.currentTimeMillis(), false, false); }
FCMapTable extends AbstractSortedMapTable { public IMapEntry appendNew(byte[] key, byte[] value, long timeToLive) throws IOException { return this.appendNew(key, Arrays.hashCode(key), value, timeToLive, System.currentTimeMillis(), false, false); } }
FCMapTable extends AbstractSortedMapTable { public IMapEntry appendNew(byte[] key, byte[] value, long timeToLive) throws IOException { return this.appendNew(key, Arrays.hashCode(key), value, timeToLive, System.currentTimeMillis(), false, false); } FCMapTable(String dir, int level, long createdTime, int expectedInsertions);  FCMapTable(String dir, short shard, int level, long createdTime, int expectedInsertions);  FCMapTable(String dir, String fileName); }
FCMapTable extends AbstractSortedMapTable { public IMapEntry appendNew(byte[] key, byte[] value, long timeToLive) throws IOException { return this.appendNew(key, Arrays.hashCode(key), value, timeToLive, System.currentTimeMillis(), false, false); } FCMapTable(String dir, int level, long createdTime, int expectedInsertions);  FCMapTable(String dir, short shard, int level, long createdTime, int expectedInsertions);  FCMapTable(String dir, String fileName); IMapEntry appendNew(byte[] key, byte[] value, long timeToLive); @Override IMapEntry appendNew(byte[] key, int keyHash, byte[] value, long timeToLive, long createdTime, boolean deleted, boolean compressed); @Override IMapEntry getMapEntry(int index); }
FCMapTable extends AbstractSortedMapTable { public IMapEntry appendNew(byte[] key, byte[] value, long timeToLive) throws IOException { return this.appendNew(key, Arrays.hashCode(key), value, timeToLive, System.currentTimeMillis(), false, false); } FCMapTable(String dir, int level, long createdTime, int expectedInsertions);  FCMapTable(String dir, short shard, int level, long createdTime, int expectedInsertions);  FCMapTable(String dir, String fileName); IMapEntry appendNew(byte[] key, byte[] value, long timeToLive); @Override IMapEntry appendNew(byte[] key, int keyHash, byte[] value, long timeToLive, long createdTime, boolean deleted, boolean compressed); @Override IMapEntry getMapEntry(int index);  }