@Test public void remove() { }
public void remove(String key, byte[]... vs) throws KitDBException { DAssert.notEmpty(vs, ErrorType.EMPTY, "vs is empty"); checkTxStart(); LockEntity lockEntity = lock(key); try (CloseLock ignored = checkClose()) { byte[] key_b = getKey(key); start(); try { MetaV metaV = getMeta(key_b); if (metaV == null) { checkTxCommit(); return; } List<byte[]> dels = new ArrayList<>(); for (byte[] v : vs) { SData sData = new SData(key_b.length, key_b, metaV.getVersion(), v); SDataD sDataD = sData.convertBytes(); byte[] scoreD = getDB(sDataD.toBytes(), SstColumnFamily.DEFAULT); if (scoreD != null) { ZDataD zDataD = new ZDataD(sDataD.getMapKeySize(), sDataD.getMapKey(), sDataD.getVersion(), scoreD, sDataD.getValue()); dels.add(zDataD.toBytes()); dels.add(sDataD.toBytes()); metaV.setSize(metaV.getSize() - 1); } } removeDo(key_b, metaV, dels); putDB(key_b, metaV.convertMetaBytes().toBytes(), SstColumnFamily.META); commit(); } finally { unlock(lockEntity); release(); } checkTxCommit(); } catch (KitDBException e) { checkTxRollBack(); throw e; } }
ZSet extends RCollection { public void remove(String key, byte[]... vs) throws KitDBException { DAssert.notEmpty(vs, ErrorType.EMPTY, "vs is empty"); checkTxStart(); LockEntity lockEntity = lock(key); try (CloseLock ignored = checkClose()) { byte[] key_b = getKey(key); start(); try { MetaV metaV = getMeta(key_b); if (metaV == null) { checkTxCommit(); return; } List<byte[]> dels = new ArrayList<>(); for (byte[] v : vs) { SData sData = new SData(key_b.length, key_b, metaV.getVersion(), v); SDataD sDataD = sData.convertBytes(); byte[] scoreD = getDB(sDataD.toBytes(), SstColumnFamily.DEFAULT); if (scoreD != null) { ZDataD zDataD = new ZDataD(sDataD.getMapKeySize(), sDataD.getMapKey(), sDataD.getVersion(), scoreD, sDataD.getValue()); dels.add(zDataD.toBytes()); dels.add(sDataD.toBytes()); metaV.setSize(metaV.getSize() - 1); } } removeDo(key_b, metaV, dels); putDB(key_b, metaV.convertMetaBytes().toBytes(), SstColumnFamily.META); commit(); } finally { unlock(lockEntity); release(); } checkTxCommit(); } catch (KitDBException e) { checkTxRollBack(); throw e; } } }
ZSet extends RCollection { public void remove(String key, byte[]... vs) throws KitDBException { DAssert.notEmpty(vs, ErrorType.EMPTY, "vs is empty"); checkTxStart(); LockEntity lockEntity = lock(key); try (CloseLock ignored = checkClose()) { byte[] key_b = getKey(key); start(); try { MetaV metaV = getMeta(key_b); if (metaV == null) { checkTxCommit(); return; } List<byte[]> dels = new ArrayList<>(); for (byte[] v : vs) { SData sData = new SData(key_b.length, key_b, metaV.getVersion(), v); SDataD sDataD = sData.convertBytes(); byte[] scoreD = getDB(sDataD.toBytes(), SstColumnFamily.DEFAULT); if (scoreD != null) { ZDataD zDataD = new ZDataD(sDataD.getMapKeySize(), sDataD.getMapKey(), sDataD.getVersion(), scoreD, sDataD.getValue()); dels.add(zDataD.toBytes()); dels.add(sDataD.toBytes()); metaV.setSize(metaV.getSize() - 1); } } removeDo(key_b, metaV, dels); putDB(key_b, metaV.convertMetaBytes().toBytes(), SstColumnFamily.META); commit(); } finally { unlock(lockEntity); release(); } checkTxCommit(); } catch (KitDBException e) { checkTxRollBack(); throw e; } } protected  ZSet(DB db); }
ZSet extends RCollection { public void remove(String key, byte[]... vs) throws KitDBException { DAssert.notEmpty(vs, ErrorType.EMPTY, "vs is empty"); checkTxStart(); LockEntity lockEntity = lock(key); try (CloseLock ignored = checkClose()) { byte[] key_b = getKey(key); start(); try { MetaV metaV = getMeta(key_b); if (metaV == null) { checkTxCommit(); return; } List<byte[]> dels = new ArrayList<>(); for (byte[] v : vs) { SData sData = new SData(key_b.length, key_b, metaV.getVersion(), v); SDataD sDataD = sData.convertBytes(); byte[] scoreD = getDB(sDataD.toBytes(), SstColumnFamily.DEFAULT); if (scoreD != null) { ZDataD zDataD = new ZDataD(sDataD.getMapKeySize(), sDataD.getMapKey(), sDataD.getVersion(), scoreD, sDataD.getValue()); dels.add(zDataD.toBytes()); dels.add(sDataD.toBytes()); metaV.setSize(metaV.getSize() - 1); } } removeDo(key_b, metaV, dels); putDB(key_b, metaV.convertMetaBytes().toBytes(), SstColumnFamily.META); commit(); } finally { unlock(lockEntity); release(); } checkTxCommit(); } catch (KitDBException e) { checkTxRollBack(); throw e; } } protected  ZSet(DB db); void add(String key, byte[] v, long score); void add(String key, List<Entry> entryList); void addMayTTL(String key, int ttl, byte[] v, long score); boolean contains(String key, byte[] value); List<Entry> range(String key, long start, long end, int limit); List<Entry> rangeDel(String key, long start, long end, int limit); @Override @SuppressWarnings("unchecked") RIterator<ZSet> iterator(String key); void remove(String key, byte[]... vs); List<Long> score(String key, byte[]... vs); Long score(String key, byte[] v); @Override void delete(String key); @Override KeyIterator getKeyIterator(); void deleteFast(String key); @Override int getTtl(String key); @Override void delTtl(String key); @Override void ttl(String key, int ttl); @Override boolean isExist(String key); @Override int size(String key); @Override Entry getEntry(RocksIterator iterator); }
ZSet extends RCollection { public void remove(String key, byte[]... vs) throws KitDBException { DAssert.notEmpty(vs, ErrorType.EMPTY, "vs is empty"); checkTxStart(); LockEntity lockEntity = lock(key); try (CloseLock ignored = checkClose()) { byte[] key_b = getKey(key); start(); try { MetaV metaV = getMeta(key_b); if (metaV == null) { checkTxCommit(); return; } List<byte[]> dels = new ArrayList<>(); for (byte[] v : vs) { SData sData = new SData(key_b.length, key_b, metaV.getVersion(), v); SDataD sDataD = sData.convertBytes(); byte[] scoreD = getDB(sDataD.toBytes(), SstColumnFamily.DEFAULT); if (scoreD != null) { ZDataD zDataD = new ZDataD(sDataD.getMapKeySize(), sDataD.getMapKey(), sDataD.getVersion(), scoreD, sDataD.getValue()); dels.add(zDataD.toBytes()); dels.add(sDataD.toBytes()); metaV.setSize(metaV.getSize() - 1); } } removeDo(key_b, metaV, dels); putDB(key_b, metaV.convertMetaBytes().toBytes(), SstColumnFamily.META); commit(); } finally { unlock(lockEntity); release(); } checkTxCommit(); } catch (KitDBException e) { checkTxRollBack(); throw e; } } protected  ZSet(DB db); void add(String key, byte[] v, long score); void add(String key, List<Entry> entryList); void addMayTTL(String key, int ttl, byte[] v, long score); boolean contains(String key, byte[] value); List<Entry> range(String key, long start, long end, int limit); List<Entry> rangeDel(String key, long start, long end, int limit); @Override @SuppressWarnings("unchecked") RIterator<ZSet> iterator(String key); void remove(String key, byte[]... vs); List<Long> score(String key, byte[]... vs); Long score(String key, byte[] v); @Override void delete(String key); @Override KeyIterator getKeyIterator(); void deleteFast(String key); @Override int getTtl(String key); @Override void delTtl(String key); @Override void ttl(String key, int ttl); @Override boolean isExist(String key); @Override int size(String key); @Override Entry getEntry(RocksIterator iterator); static String HEAD; static byte[] HEAD_B; static byte[] HEAD_SCORE_B; static byte[] HEAD_V_B; }