@Override protected ScanIteration<Tuple> doScan(byte[] key, long cursorId, ScanOptions options) { if (isQueueing() || isPipelined()) { throw new UnsupportedOperationException("'ZSCAN' cannot be called in pipeline / transaction mode."); } List<Object> args = new ArrayList<Object>(); args.add(key); args.add(cursorId); if (options.getPattern() != null) { args.add("MATCH"); args.add(options.getPattern()); } if (options.getCount() != null) { args.add("COUNT"); args.add(options.getCount()); } RFuture<ListScanResult<Tuple>> f = executorService.readAsync(client, key, ByteArrayCodec.INSTANCE, ZSCAN, args.toArray()); ListScanResult<Tuple> res = syncFuture(f); client = res.getRedisClient(); return new ScanIteration<Tuple>(res.getPos(), res.getValues()); } }.open();
@Override public ListScanResult<Object> decode(List<Object> parts, State state) { return new ListScanResult<Object>((Long)parts.get(0), (List<Object>)parts.get(1)); }
protected ListScanResult<Object> scanIterator(String name, RedisClient client, long startPos, String pattern, int count) { ListScanResult<Object> res = scanIteratorSource(name, client, startPos, pattern, count); Map<HashValue, Object> newstate = new HashMap<HashValue, Object>(state); for (Iterator<Object> iterator = res.getValues().iterator(); iterator.hasNext();) { Object entry = iterator.next(); Object value = newstate.remove(toHash(entry)); if (value == NULL) { iterator.remove(); } } if (startPos == 0) { for (Entry<HashValue, Object> entry : newstate.entrySet()) { if (entry.getValue() == NULL) { continue; } res.getValues().add(entry.getValue()); } } return res; }
protected ListScanResult<Object> scanIterator(String name, RedisClient client, long startPos, String pattern, int count) { ListScanResult<Object> res = scanIteratorSource(name, client, startPos, pattern, count); Map<HashValue, Object> newstate = new HashMap<HashValue, Object>(state); for (Iterator<Object> iterator = res.getValues().iterator(); iterator.hasNext();) { Object entry = iterator.next(); Object value = newstate.remove(toHash(entry)); if (value == NULL) { iterator.remove(); } } if (startPos == 0) { for (Entry<HashValue, Object> entry : newstate.entrySet()) { if (entry.getValue() == NULL) { continue; } res.getValues().add(entry.getValue()); } } return res; }
@Override protected ScanIteration<Tuple> doScan(byte[] key, long cursorId, ScanOptions options) { if (isQueueing() || isPipelined()) { throw new UnsupportedOperationException("'ZSCAN' cannot be called in pipeline / transaction mode."); } List<Object> args = new ArrayList<Object>(); args.add(key); args.add(cursorId); if (options.getPattern() != null) { args.add("MATCH"); args.add(options.getPattern()); } if (options.getCount() != null) { args.add("COUNT"); args.add(options.getCount()); } RFuture<ListScanResult<Tuple>> f = executorService.readAsync(client, key, ByteArrayCodec.INSTANCE, ZSCAN, args.toArray()); ListScanResult<Tuple> res = syncFuture(f); client = res.getRedisClient(); return new ScanIteration<Tuple>(res.getPos(), res.getValues()); } }.open();
tryHandleReference(((ListScanResult) o).getValues()); return o; } else if (o instanceof MapScanResult) {
@Override public ListScanResult<Object> decode(List<Object> parts, State state) { return new ListScanResult<Object>((Long)parts.get(0), (List<Object>)parts.get(1)); }
@Override protected ScanIteration<byte[]> doScan(byte[] key, long cursorId, ScanOptions options) { if (isQueueing() || isPipelined()) { throw new UnsupportedOperationException("'SSCAN' cannot be called in pipeline / transaction mode."); } List<Object> args = new ArrayList<Object>(); args.add(key); args.add(cursorId); if (options.getPattern() != null) { args.add("MATCH"); args.add(options.getPattern()); } if (options.getCount() != null) { args.add("COUNT"); args.add(options.getCount()); } RFuture<ListScanResult<byte[]>> f = executorService.readAsync(client, key, ByteArrayCodec.INSTANCE, RedisCommands.SSCAN, args.toArray()); ListScanResult<byte[]> res = syncFuture(f); client = res.getRedisClient(); return new ScanIteration<byte[]>(res.getPos(), res.getValues()); } }.open();
tryHandleReference(((ListScanResult) o).getValues()); return o; } else if (o instanceof MapScanResult) {
@Override public ListScanResult<Object> decode(List<Object> parts, State state) { List<Object> values = (List<Object>)parts.get(1); for (int i = 1; i < values.size(); i++) { values.remove(i); } return new ListScanResult<Object>((Long)parts.get(0), values); }
@Override protected ScanIteration<Tuple> doScan(byte[] key, long cursorId, ScanOptions options) { if (isQueueing() || isPipelined()) { throw new UnsupportedOperationException("'ZSCAN' cannot be called in pipeline / transaction mode."); } List<Object> args = new ArrayList<Object>(); args.add(key); args.add(cursorId); if (options.getPattern() != null) { args.add("MATCH"); args.add(options.getPattern()); } if (options.getCount() != null) { args.add("COUNT"); args.add(options.getCount()); } RFuture<ListScanResult<Tuple>> f = executorService.readAsync(client, key, ByteArrayCodec.INSTANCE, ZSCAN, args.toArray()); ListScanResult<Tuple> res = syncFuture(f); client = res.getRedisClient(); return new ScanIteration<Tuple>(res.getPos(), res.getValues()); } }.open();
protected ListScanResult<Object> scanIterator(String name, RedisClient client, long startPos, String pattern, int count) { ListScanResult<Object> res = scanIteratorSource(name, client, startPos, pattern, count); Map<HashValue, Object> newstate = new HashMap<HashValue, Object>(state); for (Iterator<Object> iterator = res.getValues().iterator(); iterator.hasNext();) { Object entry = iterator.next(); Object value = newstate.remove(toHash(entry)); if (value == NULL) { iterator.remove(); } } if (startPos == 0) { for (Entry<HashValue, Object> entry : newstate.entrySet()) { if (entry.getValue() == NULL) { continue; } res.getValues().add(entry.getValue()); } } return res; }
@Override public ListScanResult<Object> decode(List<Object> parts, State state) { List<Object> values = (List<Object>)parts.get(1); for (int i = 1; i < values.size(); i++) { values.remove(i); } return new ListScanResult<Object>((Long)parts.get(0), values); }
@Override protected ScanIteration<byte[]> doScan(byte[] key, long cursorId, ScanOptions options) { if (isQueueing() || isPipelined()) { throw new UnsupportedOperationException("'SSCAN' cannot be called in pipeline / transaction mode."); } List<Object> args = new ArrayList<Object>(); args.add(key); args.add(cursorId); if (options.getPattern() != null) { args.add("MATCH"); args.add(options.getPattern()); } if (options.getCount() != null) { args.add("COUNT"); args.add(options.getCount()); } RFuture<ListScanResult<byte[]>> f = executorService.readAsync(client, key, ByteArrayCodec.INSTANCE, RedisCommands.SSCAN, args.toArray()); ListScanResult<byte[]> res = syncFuture(f); client = res.getRedisClient(); return new ScanIteration<byte[]>(res.getPos(), res.getValues()); } }.open();
tryHandleReference(((ListScanResult) o).getValues()); return o; } else if (o instanceof MapScanResult) {
@Override public ListScanResult<Object> decode(List<Object> parts, State state) { return new ListScanResult<Object>((Long)parts.get(0), (List<Object>)parts.get(1)); }
@Override protected ScanIteration<Tuple> doScan(byte[] key, long cursorId, ScanOptions options) { if (isQueueing() || isPipelined()) { throw new UnsupportedOperationException("'ZSCAN' cannot be called in pipeline / transaction mode."); } List<Object> args = new ArrayList<Object>(); args.add(key); args.add(cursorId); if (options.getPattern() != null) { args.add("MATCH"); args.add(options.getPattern()); } if (options.getCount() != null) { args.add("COUNT"); args.add(options.getCount()); } RFuture<ListScanResult<Tuple>> f = executorService.readAsync(client, key, ByteArrayCodec.INSTANCE, ZSCAN, args.toArray()); ListScanResult<Tuple> res = syncFuture(f); client = res.getRedisClient(); return new ScanIteration<Tuple>(res.getPos(), res.getValues()); } }.open();
@Override public ListScanResult<Object> decode(List<Object> parts, State state) { List<Object> values = (List<Object>)parts.get(1); for (int i = 1; i < values.size(); i++) { values.remove(i); } return new ListScanResult<Object>((Long)parts.get(0), values); }
@Override protected ScanIteration<byte[]> doScan(byte[] key, long cursorId, ScanOptions options) { if (isQueueing() || isPipelined()) { throw new UnsupportedOperationException("'SSCAN' cannot be called in pipeline / transaction mode."); } List<Object> args = new ArrayList<Object>(); args.add(key); args.add(cursorId); if (options.getPattern() != null) { args.add("MATCH"); args.add(options.getPattern()); } if (options.getCount() != null) { args.add("COUNT"); args.add(options.getCount()); } RFuture<ListScanResult<byte[]>> f = executorService.readAsync(client, key, ByteArrayCodec.INSTANCE, RedisCommands.SSCAN, args.toArray()); ListScanResult<byte[]> res = syncFuture(f); client = res.getRedisClient(); return new ScanIteration<byte[]>(res.getPos(), res.getValues()); } }.open();
@Override protected ScanIteration<byte[]> doScan(byte[] key, long cursorId, ScanOptions options) { if (isQueueing() || isPipelined()) { throw new UnsupportedOperationException("'SSCAN' cannot be called in pipeline / transaction mode."); } List<Object> args = new ArrayList<Object>(); args.add(key); args.add(cursorId); if (options.getPattern() != null) { args.add("MATCH"); args.add(options.getPattern()); } if (options.getCount() != null) { args.add("COUNT"); args.add(options.getCount()); } RFuture<ListScanResult<byte[]>> f = executorService.readAsync(client, key, ByteArrayCodec.INSTANCE, RedisCommands.SSCAN, args.toArray()); ListScanResult<byte[]> res = syncFuture(f); client = res.getRedisClient(); return new ScanIteration<byte[]>(res.getPos(), res.getValues()); } }.open();