Skip to content

Commit

Permalink
Merge branch 'redis:main' into topic/kiryazovi-redis/use-docker-for-t…
Browse files Browse the repository at this point in the history
…ests
  • Loading branch information
kiryazovi-redis authored Feb 10, 2025
2 parents 79c2171 + d33237b commit e79ac3f
Show file tree
Hide file tree
Showing 43 changed files with 1,078 additions and 223 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build-and-deploy:
publish-docs:
concurrency: ci-${{ github.ref }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.9
Expand All @@ -26,11 +26,11 @@ jobs:
run: |
mkdocs build -d docsbuild
- name: Setup Pages
uses: actions/configure-pages@v3
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3
with:
path: 'docsbuild'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
uses: actions/deploy-pages@v4
37 changes: 25 additions & 12 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,35 @@ on:
schedule:
- cron: '0 1 * * *' # nightly build
workflow_dispatch:
inputs:
redis_version:
description: "Redis stack version to use for testing"
required: false
default: "8.0-M02"
type: choice
options:
- "8.0-M02"
- "rs-7.4.0-v1"
- "rs-7.2.0-v13"

jobs:

build:
name: Build and Test
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
redis_version:
- "unstable"
- "8.0"
- "7.4"
- "7.2"

steps:
- name: Test Redis Server Version
id: map-tags
run: |
# Map requested version to github or tag
case "${{ matrix.redis_version }}" in
"unstable") redis_branch="unstable" stack_version="8.0-M04-pre" ;;
"8.0") redis_branch="8.0" stack_version="8.0-M04-pre" ;;
"7.4") redis_branch="7.4" stack_version="rs-7.4.0-v2" ;;
"7.2") redis_branch="7.2" stack_version="rs-7.2.0-v14" ;;
*) echo "Unsupported version: ${{ matrix.redis_version }}" && exit 1 ;;
esac
# Save them as outputs for later use
echo "redis_branch=$redis_branch" >> $GITHUB_OUTPUT
echo "redis_stack_version=$stack_version" >> $GITHUB_OUTPUT
- name: Checkout project
uses: actions/checkout@v4
- name: Set Java up in the runner
Expand Down Expand Up @@ -61,7 +73,8 @@ jobs:
run: |
make test-coverage
env:
REDIS_STACK_VERSION: ${{ inputs.redis_version || '8.0-M02' }}
REDIS: ${{ steps.map-tags.outputs.redis_branch }}
REDIS_STACK_VERSION: ${{ steps.map-tags.outputs.redis_stack_version }}
JVM_OPTS: -Xmx3200m
TERM: dumb
- name: Upload coverage reports to Codecov
Expand Down
48 changes: 37 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
and much more.
</description>

<url>http://github.com/lettuce-io/lettuce-core</url>
<url>https://github.com/redis/lettuce</url>

<organization>
<name>lettuce.io</name>
Expand All @@ -30,7 +30,7 @@

<issueManagement>
<system>Github</system>
<url>https://github.com/lettuce-io/lettuce-core/issues</url>
<url>https://github.com/redis/lettuce/issues</url>
</issueManagement>

<developers>
Expand Down Expand Up @@ -82,10 +82,10 @@
</properties>

<scm>
<connection>scm:git:https://github.com/lettuce-io/lettuce-core.git</connection>
<developerConnection>scm:git:https://github.com/lettuce-io/lettuce-core.git
<connection>scm:git:https://github.com/redis/lettuce.git</connection>
<developerConnection>scm:git:https://github.com/redis/lettuce.git
</developerConnection>
<url>http://github.com/lettuce-io/lettuce-core</url>
<url>https://github.com/redis/lettuce</url>
<tag>HEAD</tag>
</scm>

Expand Down Expand Up @@ -189,12 +189,6 @@
<version>0.1.1-beta1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.github.cdimascio</groupId>
<artifactId>dotenv-java</artifactId>
<version>2.2.0</version>
<scope>test</scope>
</dependency>
<!-- Start of core dependencies -->

<dependency>
Expand Down Expand Up @@ -1063,6 +1057,38 @@
<profile>
<id>ci</id>
</profile>
<profile>
<id>entraid-it</id>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<groups>entraid</groups>
<skipITs>false</skipITs>
<includes>
<include>**/*IntegrationTests</include>
</includes>
</configuration>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>

Expand Down
9 changes: 5 additions & 4 deletions src/main/java/io/lettuce/core/AbstractRedisAsyncCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@
import io.lettuce.core.protocol.CommandType;
import io.lettuce.core.protocol.ProtocolKeyword;
import io.lettuce.core.protocol.RedisCommand;
import reactor.core.publisher.Mono;

import java.time.Duration;
import java.time.Instant;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Supplier;

import static io.lettuce.core.ClientOptions.DEFAULT_JSON_PARSER;
import static io.lettuce.core.protocol.CommandType.EXEC;
Expand Down Expand Up @@ -87,7 +87,7 @@ public abstract class AbstractRedisAsyncCommands<K, V> implements RedisAclAsyncC

private final RedisJsonCommandBuilder<K, V> jsonCommandBuilder;

private final Mono<JsonParser> parser;
private final Supplier<JsonParser> parser;

/**
* Initialize a new instance.
Expand All @@ -96,7 +96,8 @@ public abstract class AbstractRedisAsyncCommands<K, V> implements RedisAclAsyncC
* @param codec the codec for command encoding
* @param parser the implementation of the {@link JsonParser} to use
*/
public AbstractRedisAsyncCommands(StatefulConnection<K, V> connection, RedisCodec<K, V> codec, Mono<JsonParser> parser) {
public AbstractRedisAsyncCommands(StatefulConnection<K, V> connection, RedisCodec<K, V> codec,
Supplier<JsonParser> parser) {
this.parser = parser;
this.connection = connection;
this.commandBuilder = new RedisCommandBuilder<>(codec);
Expand Down Expand Up @@ -3396,7 +3397,7 @@ public RedisFuture<List<Map<String, Object>>> clusterLinks() {

@Override
public JsonParser getJsonParser() {
return this.parser.block();
return this.parser.get();
}

private byte[] encodeFunction(String functionCode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public abstract class AbstractRedisReactiveCommands<K, V>

private final RedisJsonCommandBuilder<K, V> jsonCommandBuilder;

private final Mono<JsonParser> parser;
private final Supplier<JsonParser> parser;

private final ClientResources clientResources;

Expand All @@ -112,7 +112,8 @@ public abstract class AbstractRedisReactiveCommands<K, V>
* @param codec the codec for command encoding.
* @param parser the implementation of the {@link JsonParser} to use
*/
public AbstractRedisReactiveCommands(StatefulConnection<K, V> connection, RedisCodec<K, V> codec, Mono<JsonParser> parser) {
public AbstractRedisReactiveCommands(StatefulConnection<K, V> connection, RedisCodec<K, V> codec,
Supplier<JsonParser> parser) {
this.connection = connection;
this.parser = parser;
this.commandBuilder = new RedisCommandBuilder<>(codec);
Expand Down Expand Up @@ -149,7 +150,7 @@ private EventExecutorGroup getScheduler() {

@Override
public JsonParser getJsonParser() {
return parser.block();
return parser.get();
}

@Override
Expand Down
42 changes: 41 additions & 1 deletion src/main/java/io/lettuce/core/AclCategory.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,45 @@ public enum AclCategory {
/**
* scripting command
*/
SCRIPTING
SCRIPTING,

/**
* bloom command
*/
BLOOM,

/**
* cuckoo command
*/
CUCKOO,

/**
* count-min-sketch command
*/
CMS,

/**
* top-k command
*/
TOPK,

/**
* t-digest command
*/
TDIGEST,

/**
* search command
*/
SEARCH,

/**
* timeseries command
*/
TIMESERIES,

/**
* json command
*/
JSON
}
13 changes: 7 additions & 6 deletions src/main/java/io/lettuce/core/ClientOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.Iterator;
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import java.util.function.Supplier;

import io.lettuce.core.api.StatefulConnection;
import io.lettuce.core.internal.LettuceAssert;
Expand Down Expand Up @@ -71,15 +72,15 @@ public class ClientOptions implements Serializable {

public static final SocketOptions DEFAULT_SOCKET_OPTIONS = SocketOptions.create();

public static final Mono<JsonParser> DEFAULT_JSON_PARSER = Mono.defer(() -> Mono.fromCallable(() -> {
public static final Supplier<JsonParser> DEFAULT_JSON_PARSER = () -> {
try {
Iterator<JsonParser> services = ServiceLoader.load(JsonParser.class).iterator();
return services.hasNext() ? services.next() : null;
} catch (ServiceConfigurationError e) {
throw new RedisJsonException("Could not load JsonParser, please consult the guide"
+ "at https://redis.github.io/lettuce/user-guide/redis-json/", e);
}
}));
};

public static final SslOptions DEFAULT_SSL_OPTIONS = SslOptions.create();

Expand Down Expand Up @@ -111,7 +112,7 @@ public class ClientOptions implements Serializable {

private final Charset scriptCharset;

private final Mono<JsonParser> jsonParser;
private final Supplier<JsonParser> jsonParser;

private final SocketOptions socketOptions;

Expand Down Expand Up @@ -216,7 +217,7 @@ public static class Builder {

private Charset scriptCharset = DEFAULT_SCRIPT_CHARSET;

private Mono<JsonParser> jsonParser = DEFAULT_JSON_PARSER;
private Supplier<JsonParser> jsonParser = DEFAULT_JSON_PARSER;

private SocketOptions socketOptions = DEFAULT_SOCKET_OPTIONS;

Expand Down Expand Up @@ -429,7 +430,7 @@ public Builder scriptCharset(Charset scriptCharset) {
* @see JsonParser
* @since 6.5
*/
public Builder jsonParser(Mono<JsonParser> parser) {
public Builder jsonParser(Supplier<JsonParser> parser) {

LettuceAssert.notNull(parser, "JsonParser must not be null");
this.jsonParser = parser;
Expand Down Expand Up @@ -705,7 +706,7 @@ public Charset getScriptCharset() {
* @return the implementation of the {@link JsonParser} to use.
* @since 6.5
*/
public Mono<JsonParser> getJsonParser() {
public Supplier<JsonParser> getJsonParser() {
return jsonParser;
}

Expand Down
5 changes: 3 additions & 2 deletions src/main/java/io/lettuce/core/RedisAsyncCommandsImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import io.lettuce.core.cluster.api.async.RedisClusterAsyncCommands;
import io.lettuce.core.codec.RedisCodec;
import io.lettuce.core.json.JsonParser;
import reactor.core.publisher.Mono;
import java.util.function.Supplier;

/**
* An asynchronous and thread-safe API for a Redis connection.
Expand All @@ -24,7 +24,8 @@ public class RedisAsyncCommandsImpl<K, V> extends AbstractRedisAsyncCommands<K,
* @param codec the codec for command encoding
* @param parser the implementation of the {@link JsonParser} to use
*/
public RedisAsyncCommandsImpl(StatefulRedisConnection<K, V> connection, RedisCodec<K, V> codec, Mono<JsonParser> parser) {
public RedisAsyncCommandsImpl(StatefulRedisConnection<K, V> connection, RedisCodec<K, V> codec,
Supplier<JsonParser> parser) {
super(connection, codec, parser);
}

Expand Down
Loading

0 comments on commit e79ac3f

Please sign in to comment.