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 3, 2025
2 parents fbf085b + 636a503 commit c615ed2
Show file tree
Hide file tree
Showing 44 changed files with 2,733 additions and 161 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 @@ -1044,6 +1038,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
13 changes: 12 additions & 1 deletion src/main/java/io/lettuce/core/AbstractRedisAsyncCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
import io.lettuce.core.protocol.CommandType;
import io.lettuce.core.protocol.ProtocolKeyword;
import io.lettuce.core.protocol.RedisCommand;
import io.lettuce.core.search.Field;
import io.lettuce.core.search.arguments.CreateArgs;
import reactor.core.publisher.Mono;

import java.time.Duration;
Expand Down Expand Up @@ -79,14 +81,17 @@ public abstract class AbstractRedisAsyncCommands<K, V> implements RedisAclAsyncC
RedisKeyAsyncCommands<K, V>, RedisStringAsyncCommands<K, V>, RedisListAsyncCommands<K, V>, RedisSetAsyncCommands<K, V>,
RedisSortedSetAsyncCommands<K, V>, RedisScriptingAsyncCommands<K, V>, RedisServerAsyncCommands<K, V>,
RedisHLLAsyncCommands<K, V>, BaseRedisAsyncCommands<K, V>, RedisTransactionalAsyncCommands<K, V>,
RedisGeoAsyncCommands<K, V>, RedisClusterAsyncCommands<K, V>, RedisJsonAsyncCommands<K, V> {
RedisGeoAsyncCommands<K, V>, RedisClusterAsyncCommands<K, V>, RedisJsonAsyncCommands<K, V>,
RediSearchAsyncCommands<K, V> {

private final StatefulConnection<K, V> connection;

private final RedisCommandBuilder<K, V> commandBuilder;

private final RedisJsonCommandBuilder<K, V> jsonCommandBuilder;

private final RediSearchCommandBuilder<K, V> searchCommandBuilder;

private final Mono<JsonParser> parser;

/**
Expand All @@ -101,6 +106,7 @@ public AbstractRedisAsyncCommands(StatefulConnection<K, V> connection, RedisCode
this.connection = connection;
this.commandBuilder = new RedisCommandBuilder<>(codec);
this.jsonCommandBuilder = new RedisJsonCommandBuilder<>(codec, parser);
this.searchCommandBuilder = new RediSearchCommandBuilder<>(codec);
}

/**
Expand Down Expand Up @@ -1478,6 +1484,11 @@ public boolean isOpen() {
return connection.isOpen();
}

@Override
public RedisFuture<String> ftCreate(K index, CreateArgs<K, V> options, List<Field<K>> fields) {
return dispatch(searchCommandBuilder.ftCreate(index, options, fields));
}

@Override
public RedisFuture<List<Long>> jsonArrappend(K key, JsonPath jsonPath, JsonValue... values) {
return dispatch(jsonCommandBuilder.jsonArrappend(key, jsonPath, values));
Expand Down
22 changes: 16 additions & 6 deletions src/main/java/io/lettuce/core/AbstractRedisReactiveCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
import io.lettuce.core.protocol.RedisCommand;
import io.lettuce.core.protocol.TracedCommand;
import io.lettuce.core.resource.ClientResources;
import io.lettuce.core.search.Field;
import io.lettuce.core.search.arguments.CreateArgs;
import io.lettuce.core.tracing.TraceContext;
import io.lettuce.core.tracing.TraceContextProvider;
import io.lettuce.core.tracing.Tracing;
Expand Down Expand Up @@ -84,19 +86,21 @@
* @author Tihomir Mateev
* @since 4.0
*/
public abstract class AbstractRedisReactiveCommands<K, V>
implements RedisAclReactiveCommands<K, V>, RedisHashReactiveCommands<K, V>, RedisKeyReactiveCommands<K, V>,
RedisStringReactiveCommands<K, V>, RedisListReactiveCommands<K, V>, RedisSetReactiveCommands<K, V>,
RedisSortedSetReactiveCommands<K, V>, RedisScriptingReactiveCommands<K, V>, RedisServerReactiveCommands<K, V>,
RedisHLLReactiveCommands<K, V>, BaseRedisReactiveCommands<K, V>, RedisTransactionalReactiveCommands<K, V>,
RedisGeoReactiveCommands<K, V>, RedisClusterReactiveCommands<K, V>, RedisJsonReactiveCommands<K, V> {
public abstract class AbstractRedisReactiveCommands<K, V> implements RedisAclReactiveCommands<K, V>,
RedisHashReactiveCommands<K, V>, RedisKeyReactiveCommands<K, V>, RedisStringReactiveCommands<K, V>,
RedisListReactiveCommands<K, V>, RedisSetReactiveCommands<K, V>, RedisSortedSetReactiveCommands<K, V>,
RedisScriptingReactiveCommands<K, V>, RedisServerReactiveCommands<K, V>, RedisHLLReactiveCommands<K, V>,
BaseRedisReactiveCommands<K, V>, RedisTransactionalReactiveCommands<K, V>, RedisGeoReactiveCommands<K, V>,
RedisClusterReactiveCommands<K, V>, RedisJsonReactiveCommands<K, V>, RediSearchReactiveCommands<K, V> {

private final StatefulConnection<K, V> connection;

private final RedisCommandBuilder<K, V> commandBuilder;

private final RedisJsonCommandBuilder<K, V> jsonCommandBuilder;

private final RediSearchCommandBuilder<K, V> searchCommandBuilder;

private final Mono<JsonParser> parser;

private final ClientResources clientResources;
Expand All @@ -117,6 +121,7 @@ public AbstractRedisReactiveCommands(StatefulConnection<K, V> connection, RedisC
this.parser = parser;
this.commandBuilder = new RedisCommandBuilder<>(codec);
this.jsonCommandBuilder = new RedisJsonCommandBuilder<>(codec, parser);
this.searchCommandBuilder = new RediSearchCommandBuilder<>(codec);
this.clientResources = connection.getResources();
this.tracingEnabled = clientResources.tracing().isEnabled();
}
Expand Down Expand Up @@ -1543,6 +1548,11 @@ public boolean isOpen() {
return connection.isOpen();
}

@Override
public Mono<String> ftCreate(K index, CreateArgs<K, V> options, List<Field<K>> fields) {
return createMono(() -> searchCommandBuilder.ftCreate(index, options, fields));
}

@Override
public Flux<Long> jsonArrappend(K key, JsonPath jsonPath, JsonValue... values) {
return createDissolvingFlux(() -> jsonCommandBuilder.jsonArrappend(key, jsonPath, values));
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
}
63 changes: 63 additions & 0 deletions src/main/java/io/lettuce/core/RediSearchCommandBuilder.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Copyright 2025, Redis Ltd. and Contributors
* All rights reserved.
*
* Licensed under the MIT License.
*/
package io.lettuce.core;

import io.lettuce.core.codec.RedisCodec;
import io.lettuce.core.output.StatusOutput;
import io.lettuce.core.protocol.BaseRedisCommandBuilder;
import io.lettuce.core.protocol.Command;
import io.lettuce.core.protocol.CommandArgs;
import io.lettuce.core.protocol.CommandKeyword;
import io.lettuce.core.search.arguments.CreateArgs;
import io.lettuce.core.search.Field;

import java.util.List;

import static io.lettuce.core.protocol.CommandType.*;

/**
* Command builder for RediSearch commands.
*
* @param <K> Key type.
* @param <V> Value type.
* @since 6.6
*/
class RediSearchCommandBuilder<K, V> extends BaseRedisCommandBuilder<K, V> {

RediSearchCommandBuilder(RedisCodec<K, V> codec) {
super(codec);
}

/**
* Create a new index with the given name, index options and fields.
*
* @param index the index name
* @param createArgs the index options
* @param fields the fields
* @return the result of the create command
*/
public Command<K, V, String> ftCreate(K index, CreateArgs<K, V> createArgs, List<Field<K>> fields) {
notNullKey(index);
notEmpty(fields.toArray());

CommandArgs<K, V> args = new CommandArgs<>(codec).addKey(index);

if (createArgs != null) {
createArgs.build(args);
}

args.add(CommandKeyword.SCHEMA);

for (Field<K> field : fields) {
field.build(args);
}

return createCommand(FT_CREATE, new StatusOutput<>(codec), args);

}

}
Loading

0 comments on commit c615ed2

Please sign in to comment.