Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup deprecations for Jedis 5.0 #3391

Merged
merged 5 commits into from
May 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions src/main/java/redis/clients/jedis/CommandArguments.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,6 @@ public CommandArguments addObjects(Collection args) {
return this;
}

@Deprecated
public CommandArguments addObjects(int[] ints) {
for (int i : ints) {
add(i);
}
return this;
}

public CommandArguments key(Object key) {
if (key instanceof Rawable) {
Rawable raw = (Rawable) key;
Expand Down
107 changes: 14 additions & 93 deletions src/main/java/redis/clients/jedis/CommandObjects.java
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,10 @@ public final CommandObject<String> get(String key) {
return new CommandObject<>(commandArguments(Command.GET).key(key), BuilderFactory.STRING);
}

public final CommandObject<String> setGet(String key, String value) {
return new CommandObject<>(commandArguments(Command.SET).key(key).add(value).add(Keyword.GET), BuilderFactory.STRING);
}

public final CommandObject<String> setGet(String key, String value, SetParams params) {
return new CommandObject<>(commandArguments(Command.SET).key(key).add(value).addParams(params)
.add(Keyword.GET), BuilderFactory.STRING);
Expand All @@ -447,6 +451,10 @@ public final CommandObject<byte[]> get(byte[] key) {
return new CommandObject<>(commandArguments(Command.GET).key(key), BuilderFactory.BINARY);
}

public final CommandObject<byte[]> setGet(byte[] key, byte[] value) {
return new CommandObject<>(commandArguments(Command.SET).key(key).add(value).add(Keyword.GET), BuilderFactory.BINARY);
}

public final CommandObject<byte[]> setGet(byte[] key, byte[] value, SetParams params) {
return new CommandObject<>(commandArguments(Command.SET).key(key).add(value).addParams(params)
.add(Keyword.GET), BuilderFactory.BINARY);
Expand Down Expand Up @@ -676,34 +684,6 @@ public final CommandObject<Long> bitop(BitOP op, byte[] destKey, byte[]... srcKe
return new CommandObject<>(commandArguments(BITOP).add(op).key(destKey).keys((Object[]) srcKeys), BuilderFactory.LONG);
}

/**
* @param keyA
* @param keyB
* @param params
* @return
* @deprecated STRALGO LCS command will be removed from Redis 7.
* LCS can be used instead of this method.
*/
@Deprecated
public final CommandObject<LCSMatchResult> strAlgoLCSKeys(String keyA, String keyB, StrAlgoLCSParams params) {
return new CommandObject<>(commandArguments(STRALGO).add(Keyword.LCS).add(Keyword.KEYS)
.key(keyA).key(keyB).addParams(params), BuilderFactory.STR_ALGO_LCS_RESULT_BUILDER);
}

/**
* @param keyA
* @param keyB
* @param params
* @return
* @deprecated STRALGO LCS command will be removed from Redis 7.
* LCS can be used instead of this method.
*/
@Deprecated
public final CommandObject<LCSMatchResult> strAlgoLCSKeys(byte[] keyA, byte[] keyB, StrAlgoLCSParams params) {
return new CommandObject<>(commandArguments(STRALGO).add(Keyword.LCS).add(Keyword.KEYS)
.key(keyA).key(keyB).addParams(params), BuilderFactory.STR_ALGO_LCS_RESULT_BUILDER);
}

public final CommandObject<LCSMatchResult> lcs(String keyA, String keyB, LCSParams params) {
return new CommandObject<>(commandArguments(Command.LCS).key(keyA).key(keyB)
.addParams(params), BuilderFactory.STR_ALGO_LCS_RESULT_BUILDER);
Expand Down Expand Up @@ -2525,25 +2505,6 @@ public final CommandObject<StreamPendingSummary> xpending(String key, String gro
BuilderFactory.STREAM_PENDING_SUMMARY);
}

/**
* @param key
* @param groupName
* @param start
* @param end
* @param count
* @param consumerName
* @return
* @deprecated Use {@link CommandObjects#xpending(java.lang.String, java.lang.String, redis.clients.jedis.params.XPendingParams)}.
*/
@Deprecated
public final CommandObject<List<StreamPendingEntry>> xpending(String key, String groupName,
StreamEntryID start, StreamEntryID end, int count, String consumerName) {
CommandArguments args = commandArguments(XPENDING).key(key).add(groupName)
.add(start == null ? "-" : start).add(end == null ? "+" : end).add(count);
if (consumerName != null) args.add(consumerName);
return new CommandObject<>(args, BuilderFactory.STREAM_PENDING_ENTRY_LIST);
}

public final CommandObject<List<StreamPendingEntry>> xpending(String key, String groupName, XPendingParams params) {
return new CommandObject<>(commandArguments(XPENDING).key(key).add(groupName)
.addParams(params), BuilderFactory.STREAM_PENDING_ENTRY_LIST);
Expand All @@ -2554,18 +2515,6 @@ public final CommandObject<Object> xpending(byte[] key, byte[] groupName) {
BuilderFactory.RAW_OBJECT);
}

/**
* @deprecated Use {@link CommandObjects#xpending(byte[], byte[], redis.clients.jedis.params.XPendingParams)}.
*/
@Deprecated
public final CommandObject<List<Object>> xpending(byte[] key, byte[] groupName,
byte[] start, byte[] end, int count, byte[] consumerName) {
CommandArguments args = commandArguments(XPENDING).key(key).add(groupName)
.add(start == null ? "-" : start).add(end == null ? "+" : end).add(count);
if (consumerName != null) args.add(consumerName);
return new CommandObject<>(args, BuilderFactory.RAW_OBJECT_LIST);
}

public final CommandObject<List<Object>> xpending(byte[] key, byte[] groupName, XPendingParams params) {
return new CommandObject<>(commandArguments(XPENDING).key(key).add(groupName)
.addParams(params), BuilderFactory.RAW_OBJECT_LIST);
Expand Down Expand Up @@ -2653,20 +2602,10 @@ public final CommandObject<Object> xinfoStreamFull(byte[] key) {
return new CommandObject<>(commandArguments(XINFO).add(STREAM).key(key).add(FULL), BuilderFactory.RAW_OBJECT);
}

@Deprecated
public final CommandObject<List<StreamGroupInfo>> xinfoGroup(String key) {
return new CommandObject<>(commandArguments(XINFO).add(GROUPS).key(key), BuilderFactory.STREAM_GROUP_INFO_LIST);
}

public final CommandObject<List<StreamGroupInfo>> xinfoGroups(String key) {
return new CommandObject<>(commandArguments(XINFO).add(GROUPS).key(key), BuilderFactory.STREAM_GROUP_INFO_LIST);
}

@Deprecated
public final CommandObject<List<Object>> xinfoGroup(byte[] key) {
return new CommandObject<>(commandArguments(XINFO).add(GROUPS).key(key), BuilderFactory.RAW_OBJECT_LIST);
}

public final CommandObject<List<Object>> xinfoGroups(byte[] key) {
return new CommandObject<>(commandArguments(XINFO).add(GROUPS).key(key), BuilderFactory.RAW_OBJECT_LIST);
}
Expand Down Expand Up @@ -3048,20 +2987,6 @@ public final CommandObject<String> functionRestore(byte[] serializedValue, Funct
// Scripting commands

// Miscellaneous commands
@Deprecated
public final CommandObject<LCSMatchResult> strAlgoLCSStrings(String strA, String strB, StrAlgoLCSParams params) {
return new CommandObject<>(commandArguments(STRALGO).add(Keyword.LCS).add(STRINGS)
.add(strA).add(strB).addParams(params),
BuilderFactory.STR_ALGO_LCS_RESULT_BUILDER);
}

@Deprecated
public final CommandObject<LCSMatchResult> strAlgoLCSStrings(byte[] strA, byte[] strB, StrAlgoLCSParams params) {
return new CommandObject<>(commandArguments(STRALGO).add(Keyword.LCS).add(STRINGS)
.add(strA).add(strB).addParams(params),
BuilderFactory.STR_ALGO_LCS_RESULT_BUILDER);
}

public final CommandObject<Boolean> copy(String srcKey, String dstKey, int dstDB, boolean replace) {
CommandArguments args = commandArguments(Command.COPY).key(srcKey).key(dstKey).add(DB).add(dstDB);
if (replace) args.add(REPLACE);
Expand Down Expand Up @@ -3237,22 +3162,22 @@ public final CommandObject<String> ftAlter(String indexName, Iterable<SchemaFiel

public final CommandObject<SearchResult> ftSearch(String indexName, String query) {
return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.SEARCH), indexName).add(query),
new SearchResultBuilder(true, false, false, true));
new SearchResultBuilder(true, false, true));
}

public final CommandObject<SearchResult> ftSearch(String indexName, String query, FTSearchParams params) {
return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.SEARCH), indexName)
.add(query).addParams(params), new SearchResultBuilder(!params.getNoContent(), params.getWithScores(), false, true));
.add(query).addParams(params), new SearchResultBuilder(!params.getNoContent(), params.getWithScores(), true));
}

public final CommandObject<SearchResult> ftSearch(String indexName, Query query) {
return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.SEARCH), indexName).addParams(query),
new SearchResultBuilder(!query.getNoContent(), query.getWithScores(), query.getWithPayloads(), true));
new SearchResultBuilder(!query.getNoContent(), query.getWithScores(), true));
}

public final CommandObject<SearchResult> ftSearch(byte[] indexName, Query query) {
return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.SEARCH), indexName).addParams(query),
new SearchResultBuilder(!query.getNoContent(), query.getWithScores(), query.getWithPayloads(), false));
new SearchResultBuilder(!query.getNoContent(), query.getWithScores(), false));
}

public final CommandObject<String> ftExplain(String indexName, Query query) {
Expand Down Expand Up @@ -3296,15 +3221,15 @@ public final CommandObject<Map.Entry<SearchResult, Map<String, Object>>> ftProfi
return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.PROFILE), indexName)
.add(SearchKeyword.SEARCH).addParams(profileParams).add(SearchKeyword.QUERY)
.addParams(query), new SearchProfileResponseBuilder<>(new SearchResultBuilder(
!query.getNoContent(), query.getWithScores(), query.getWithPayloads(), true)));
!query.getNoContent(), query.getWithScores(), true)));
}

public final CommandObject<Map.Entry<SearchResult, Map<String, Object>>> ftProfileSearch(
String indexName, FTProfileParams profileParams, String query, FTSearchParams searchParams) {
return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.PROFILE), indexName)
.add(SearchKeyword.SEARCH).addParams(profileParams).add(SearchKeyword.QUERY).add(query)
.addParams(searchParams), new SearchProfileResponseBuilder<>(new SearchResultBuilder(
!searchParams.getNoContent(), searchParams.getWithScores(), false, true)));
!searchParams.getNoContent(), searchParams.getWithScores(), true)));
}

public final CommandObject<String> ftDropIndex(String indexName) {
Expand Down Expand Up @@ -4076,10 +4001,6 @@ public final CommandObject<List<Boolean>> topkQuery(String key, String... items)
return new CommandObject<>(commandArguments(TopKCommand.QUERY).key(key).addObjects((Object[]) items), BuilderFactory.BOOLEAN_LIST);
}

public final CommandObject<List<Long>> topkCount(String key, String... items) {
return new CommandObject<>(commandArguments(TopKCommand.COUNT).key(key).addObjects((Object[]) items), BuilderFactory.LONG_LIST);
}

public final CommandObject<List<String>> topkList(String key) {
return new CommandObject<>(commandArguments(TopKCommand.LIST).key(key), BuilderFactory.STRING_LIST);
}
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/redis/clients/jedis/ConnectionFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,6 @@ public ConnectionFactory(final JedisSocketFactory jedisSocketFactory, final Jedi
this.jedisSocketFactory = jedisSocketFactory;
}

/**
* @deprecated Use {@link RedisCredentialsProvider} through
* {@link JedisClientConfig#getCredentialsProvider()}.
*/
@Deprecated
public void setPassword(final String password) {
this.clientConfig.updatePassword(password);
}

@Override
public void activateObject(PooledObject<Connection> pooledConnection) throws Exception {
// what to do ??
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,6 @@ public Supplier<RedisCredentials> getCredentialsProvider() {
return credentialsProvider;
}

@Override
@Deprecated
public synchronized void updatePassword(String password) {
((DefaultRedisCredentialsProvider) this.credentialsProvider)
.setCredentials(new DefaultRedisCredentials(getUser(), password));
}

@Override
public int getDatabase() {
return database;
Expand Down
Loading