@Test public void addAll() throws Exception { String head = "addAllA"; RList list = db.getList(); int num = 10; List<byte[]> integers = new ArrayList<>(); for (int i = 0; i < num; i++) { integers.add(("hello" + i).getBytes()); } List<List<byte[]>> integers_splits = CollUtil.split(integers, 3000); try { for (List<byte[]> integers_split : integers_splits) { list.addAll(head, integers_split); } Assert.assertEquals(num, list.size(head)); for (int i = 0; i < num; i++) { byte[] bytes = list.get(head, i); Assert.assertEquals(new String(bytes), ("hello" + i)); } } finally { list.delete(head); } try { JoinFuture<String> joinFuture = JoinFuture.build(executorService, String.class); for (List<byte[]> integers_split : integers_splits) { joinFuture.add(args -> { try { list.addAll(head, integers_split); } catch (Exception e) { e.printStackTrace(); } return ""; }); } joinFuture.join(); Assert.assertEquals(num, list.size(head)); Set<String> sets = new HashSet<>(); for (int i = 0; i < num; i++) { byte[] bytes = list.get(head, i); sets.add(new String(bytes)); } for (int i = 0; i < num; i++) { Assert.assertTrue(sets.contains("hello" + i)); } } finally { list.delete(head); } }
public void addAll(String key, List<byte[]> vs) throws KitDBException { addAllMayTTLPrivate(key, vs, -1); }
RList extends RCollection { public void addAll(String key, List<byte[]> vs) throws KitDBException { addAllMayTTLPrivate(key, vs, -1); } }
RList extends RCollection { public void addAll(String key, List<byte[]> vs) throws KitDBException { addAllMayTTLPrivate(key, vs, -1); } protected  RList(DB db); }
RList extends RCollection { public void addAll(String key, List<byte[]> vs) throws KitDBException { addAllMayTTLPrivate(key, vs, -1); } protected  RList(DB db); void add(String key, byte[] v); void addAll(String key, List<byte[]> vs); void addAllMayTTL(String key, List<byte[]> vs, int ttl); void set(String key, long i, byte[] v); byte[] get(String key, long i); List<byte[]> get(String key, List<Long> is); Long left(String key); Long right(String key); int size(String key); void deleteFast(String key); void delete(String key); boolean isExist(String key); List<byte[]> range(String key, long start, long end); @Override @SuppressWarnings("unchecked") RIterator<RList> iterator(String key); Entry getEntry(RocksIterator iterator); List<byte[]> blpop(String key, int num); List<byte[]> brpop(String key, int num); @Override KeyIterator getKeyIterator(); void ttl(String key, int ttl); void delTtl(String key); int getTtl(String key); void addMayTTL(String key, byte[] v, int ttl); }
RList extends RCollection { public void addAll(String key, List<byte[]> vs) throws KitDBException { addAllMayTTLPrivate(key, vs, -1); } protected  RList(DB db); void add(String key, byte[] v); void addAll(String key, List<byte[]> vs); void addAllMayTTL(String key, List<byte[]> vs, int ttl); void set(String key, long i, byte[] v); byte[] get(String key, long i); List<byte[]> get(String key, List<Long> is); Long left(String key); Long right(String key); int size(String key); void deleteFast(String key); void delete(String key); boolean isExist(String key); List<byte[]> range(String key, long start, long end); @Override @SuppressWarnings("unchecked") RIterator<RList> iterator(String key); Entry getEntry(RocksIterator iterator); List<byte[]> blpop(String key, int num); List<byte[]> brpop(String key, int num); @Override KeyIterator getKeyIterator(); void ttl(String key, int ttl); void delTtl(String key); int getTtl(String key); void addMayTTL(String key, byte[] v, int ttl); final static String HEAD; final static byte[] HEAD_VALUE_B; final static byte[] HEAD_B; }