Sequentially iterate over keys in the keyspace. This method uses {@code SCAN} to perform an iterative scan.

@param commands the commands interface, must not be {@literal null}.
@param <K> Key type.
@param <V> Value type.
@return a new {@link Flux}.
960186
public static <K, V> Flux<K> scan(RedisKeyReactiveCommands<K, V> commands) {
        return scan(commands, Optional.empty());
    }
855582
public void runPendingCommands() {
        List<Runnable> commandsToRun = commands;
        commands = new ArrayList<Runnable>();
    
        for (Runnable command: commandsToRun) {
            command.run();
        }
    }
862357
public void put(final ValueType value, final KeyType... keys) {

        if (ArrayUtils.isEmpty(keys)) {
            return;
        }
        int keysLength = keys.length;
        if (keysLength == 1) {
            put(value, keys[0]);
        } else {
            StorageComponent<KeyType, ValueType> childStorageComponent = getStorageComponent(keys[0]);
            int lastKeyIndex = keysLength - 1;
            for (int i = 1; i < lastKeyIndex; i++) {
                childStorageComponent = childStorageComponent.getStorageComponent(keys[i]);
            }
            childStorageComponent.put(value, keys[lastKeyIndex]);
        }
    }
1366831
protected void buildCommandLine(final StringBuilder out, final List<NodeOc> depth, final List<NodeOc> line,
            final String value)
    {
        for (int n = 0; n < line.size(); n++)
        {
            if (depth.size() <= n)
            {
                /*
                 * This is a new command
                 */
                depth.add(line.get(n));
                /*
                 * an empty keyword means a positional parameter
                 */
                if (line.get(n).key.length() > 0)
                    out.append("--" + line.get(n).key);
                /*
                 * if the depth so far is shorter than the namespace then it is
                 * necessary to start a group
                 */
                if (n < line.size() - 1)
                    out.append(OPEN_GROUP);
            } else if (depth.get(n).key.equalsIgnoreCase(line.get(n).key))
            {
                /*
                 * This is a subsequent command for the same namespace at this
                 * level. Check the occurrence to see if a new multiple group )(
                 * should be started. If the occurrence is the same then the
                 * subsequent namespace will make it unique and this specific
                 * node in the namespace can be safely ignored. In essence we
                 * are within a sub-structure and only change instance
                 * variables.
                 */
                if (depth.get(n).occurrance == line.get(n).occurrance)
                    continue;
                /*
                 * A new occurrence of the same namespace node. So we close off
                 * deeper groups.
                 */
                for (int d = depth.size() - 1; d > n; d--)
                {
                    depth.remove(d);
                    out.append(CLOSE_GROUP);
                }
                depth.get(n).occurrance = line.get(n).occurrance;
                if (n < line.size() - 1)
                    out.append(OPEN_GROUP);
                continue;
            } else
            {
                for (int d = depth.size() - 1; d > n; d--)
                {
                    depth.remove(d);
                    out.append(CLOSE_GROUP);
                }
                depth.get(n).key = line.get(n).key;
                depth.get(n).occurrance = line.get(n).occurrance;
                /*
                 * an empty keyword means a positional parameter
                 */
                if (line.get(n).key.length() > 0)
                    out.append("--" + line.get(n).key);
                if (n < line.size() - 1)
                    out.append(OPEN_GROUP);
                continue;
            }
        }
        /*
         * booleans have no value
         */
        if (value.length() > 0)
            out.append(quote(value));
    }
777388
public static void exec_command(String command) throws IOException {
        launchProcess(command, new HashMap<String, String>(), false);
    }
389078
public static <K, V> ImmutableSet<K> allKeys(final Iterable<? extends Map<K, V>> maps) {
    final ImmutableSet.Builder<K> builder = ImmutableSet.builder();

    for (final Map<K, V> map : maps) {
      builder.addAll(map.keySet());
    }

    return builder.build();
  }
406940
private CommandOutput<?, ?> executePreparedSql(List<Command> cmds) {
    String query = null;
    List<String> queryParameters = null;
    int fetchSize = 0;

    for (Command cmd : cmds) {
      if (cmd instanceof JdbcCommand) {
        JdbcCommandType type = (JdbcCommandType) cmd.getCommandType();
        switch (type) {
          case QUERY:
            query = cmd.getParams().get(0);
            break;
          case QUERYPARAMS:
            queryParameters = cmd.getParams();
            break;
          case FETCHSIZE:
            fetchSize = Integer.parseInt(cmd.getParams().get(0));
            break;
          default:
            this.log.error("Command " + type.toString() + " not recognized");
            break;
        }
      }
    }

    this.log.info("Executing query:" + query);
    ResultSet resultSet = null;
    try {
      this.jdbcSource = createJdbcSource();
      if (this.dataConnection == null) {
        this.dataConnection = this.jdbcSource.getConnection();
      }

      PreparedStatement statement =
          this.dataConnection.prepareStatement(query, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);

      int parameterPosition = 1;
      if (queryParameters != null && queryParameters.size() > 0) {
        for (String parameter : queryParameters) {
          statement.setString(parameterPosition, parameter);
          parameterPosition++;
        }
      }
      if (fetchSize != 0) {
        statement.setFetchSize(fetchSize);
      }
      final boolean status = statement.execute();
      if (status == false) {
        this.log.error("Failed to execute sql:" + query);
      }
      resultSet = statement.getResultSet();

    } catch (Exception e) {
      this.log.error("Failed to execute sql:" + query + " ;error-" + e.getMessage(), e);
    }

    CommandOutput<JdbcCommand, ResultSet> output = new JdbcCommandOutput();
    output.put((JdbcCommand) cmds.get(0), resultSet);
    return output;
  }
923801
private Operation createOperation(List<Data> keyValueSequence) {
        NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
        MapOperationProvider operationProvider = mapServiceContext.getMapOperationProvider(name);
        MapOperation operation = operationProvider.createPutFromLoadAllOperation(name, keyValueSequence);
        operation.setNodeEngine(nodeEngine);
        operation.setPartitionId(partitionId);
        OperationAccessor.setCallerAddress(operation, nodeEngine.getThisAddress());
        operation.setCallerUuid(nodeEngine.getLocalMember().getUuid());
        operation.setServiceName(MapService.SERVICE_NAME);
        return operation;
    }
961124
public static KubernetesMessage request(KubernetesCommand<?> command) {
        KubernetesRequest request = new KubernetesRequest();
        request.setCommand(command.getName());

        for (Map.Entry<String, Object> entry : command.getParameters().entrySet()) {
            if (entry.getKey().equals(KubernetesMessageHeaders.NAME)) {
                request.setName(entry.getValue().toString());
            }

            if (entry.getKey().equals(KubernetesMessageHeaders.NAMESPACE)) {
                request.setNamespace(entry.getValue().toString());
            }

            if (entry.getKey().equals(KubernetesMessageHeaders.LABEL)) {
                request.setLabel(entry.getValue().toString());
            }
        }

        return new KubernetesMessage(request);
    }
1347949
public Map<String, String> getMulti(String columnName, String... keys) {
    MultigetSliceQuery<String, String,String> q = createMultigetSliceQuery(keyspace, serializer, serializer, serializer);
    q.setColumnFamily(columnFamilyName);
    q.setKeys(keys);
    q.setColumnNames(columnName);

    QueryResult<Rows<String,String,String>> r = q.execute();
    Rows<String,String,String> rows = r.get();
    Map<String, String> ret = new HashMap<String, String>(keys.length);
    for (String k: keys) {
      HColumn<String, String> c = rows.getByKey(k).getColumnSlice().getColumnByName(columnName);
      if (c != null && c.getValue() != null) {
        ret.put(k, c.getValue());
      }
    }
    return ret;
  }
386776
public void defer(ICommandData command, ICommandData... commands) {
        deferredCommands.add(command);
        deferInternal(command);

        if (commands != null && commands.length > 0)
            defer(commands);
    }
615784
public static <K, V> ImmutableMap<K, V> mapFromPairedKeyValueSequences(
      final Iterable<K> keys, final Iterable<V> values) {
    final ImmutableMap.Builder<K, V> builder = ImmutableMap.builder();
    for (final ZipPair<K, V> pair : zip(keys, values)) {
      builder.put(pair.first(), pair.second());
    }
    return builder.build();
  }
357471
public Response<List<byte[]>> hmget(final byte[] key, final byte[]... fields) {
		return new PipelineOperation<List<byte[]>>() {

			@Override
			Response<List<byte[]>> execute(Pipeline jedisPipeline) throws DynoException {
				long startTime = System.nanoTime() / 1000;
				try {
					return jedisPipeline.hmget(key, fields);
				} finally {
					long duration = System.nanoTime() / 1000 - startTime;
					opMonitor.recordSendLatency(OpName.HMGET.name(), duration, TimeUnit.MICROSECONDS);
				}
			}
		}.execute(key, OpName.HMGET);
	}
787117
@Override
	public Response<String> set(final byte[] key, final byte[] value) {
		return new PipelineOperation<String>() {
			@Override
			Response<String> execute(Pipeline jedisPipeline) throws DynoException {
				long startTime = System.nanoTime() / 1000;
				try {
					return jedisPipeline.set(key, value);
				} finally {
					long duration = System.nanoTime() / 1000 - startTime;
					opMonitor.recordSendLatency(OpName.SET.name(), duration, TimeUnit.MICROSECONDS);
				}
			}

		}.execute(key, OpName.SET);
	}
972528
public ExecInspection execStartVerbose(String containerId, String... commands) {
        this.readWriteLock.readLock().lock();
        try {
            String id = execCreate(containerId, commands);
            CubeOutput output = execStartOutput(id);

            return new ExecInspection(output, inspectExec(id));
        } finally {
            this.readWriteLock.readLock().unlock();
        }
    }
787021
public <S, L> MapReduceOutput<S, L> mapReduce(MapReduce.MapReduceCommand<S, L> command) throws MongoException {
        return new MapReduceOutput<S, L>(this, dbCollection.mapReduce(command.build(this)), command.getResultType(),
                command.getKeyType());
    }
910966
public void setKeys(java.util.Collection<Key> keys) {
        if (keys == null) {
            this.keys = null;
            return;
        }

        java.util.List<Key> keysCopy = new java.util.ArrayList<Key>(keys.size());
        keysCopy.addAll(keys);
        this.keys = keysCopy;
    }