Merge branch 'main' into mwolters/sqlite

This commit is contained in:
Mark Wolters 2024-06-06 09:04:34 -04:00
commit dac6c09dd6
6 changed files with 50 additions and 17 deletions

View File

@ -141,7 +141,7 @@ jobs:
# https://github.com/softprops/action-gh-release # https://github.com/softprops/action-gh-release
- name: create github release - name: create github release
uses: softprops/action-gh-release@v2.0.4 uses: softprops/action-gh-release@v2.0.5
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
with: with:
# body: ${{ steps.prepare_summary.outputs.release_summary }} # body: ${{ steps.prepare_summary.outputs.release_summary }}

View File

@ -126,7 +126,7 @@ jobs:
# https://github.com/softprops/action-gh-release # https://github.com/softprops/action-gh-release
- name: create github release - name: create github release
uses: softprops/action-gh-release@v2.0.4 uses: softprops/action-gh-release@v2.0.5
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
with: with:
# body: ${{ steps.prepare_summary.outputs.release_summary }} # body: ${{ steps.prepare_summary.outputs.release_summary }}

View File

@ -392,6 +392,13 @@
<version>1.0-1</version> <version>1.0-1</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.23.1</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
@ -405,15 +412,22 @@
<version>2.23.1</version> <version>2.23.1</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.23.1</version>
</dependency>
<dependency> <dependency>
<groupId>org.apache.logging.log4j</groupId> <groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId> <artifactId>log4j-core</artifactId>
<version>2.23.1</version> <version>2.23.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.logging.log4j</groupId> <groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId> <artifactId>log4j-slf4j-impl</artifactId>
<version>2.23.1</version> <!-- <version>2.23.1</version>-->
</dependency> </dependency>
<dependency> <dependency>

View File

@ -52,11 +52,28 @@
<artifactId>protobuf-java-util</artifactId> <artifactId>protobuf-java-util</artifactId>
<version>3.25.3</version> <version>3.25.3</version>
</dependency> </dependency>
<!-- <dependency>-->
<!-- <groupId>org.apache.logging.log4j</groupId>-->
<!-- <artifactId>log4j-core</artifactId>-->
<!-- <version>2.23.1</version>-->
<!-- </dependency>-->
<dependency> <dependency>
<groupId>io.milvus</groupId> <groupId>io.milvus</groupId>
<artifactId>milvus-sdk-java</artifactId> <artifactId>milvus-sdk-java</artifactId>
<version>2.4.1</version> <version>2.4.1</version>
</dependency> </dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
</dependency>
</dependencies> </dependencies>

View File

@ -31,6 +31,7 @@ import java.nio.file.Paths;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
/** /**
* The MilvusSpace class is a context object which stores all stateful contextual information needed to interact * The MilvusSpace class is a context object which stores all stateful contextual information needed to interact
@ -51,8 +52,10 @@ public class MilvusSpace implements AutoCloseable {
* Create a new MilvusSpace Object which stores all stateful contextual information needed to interact * Create a new MilvusSpace Object which stores all stateful contextual information needed to interact
* with the Milvus/Zilliz database instance. * with the Milvus/Zilliz database instance.
* *
* @param name The name of this space * @param name
* @param cfg The configuration ({@link NBConfiguration}) for this nb run * The name of this space
* @param cfg
* The configuration ({@link NBConfiguration}) for this nb run
*/ */
public MilvusSpace(String name, NBConfiguration cfg) { public MilvusSpace(String name, NBConfiguration cfg) {
this.name = name; this.name = name;
@ -72,7 +75,7 @@ public class MilvusSpace implements AutoCloseable {
cfg.getOptional("database_name").ifPresent(builder::withDatabaseName); cfg.getOptional("database_name").ifPresent(builder::withDatabaseName);
cfg.getOptional("database").ifPresent(builder::withDatabaseName); cfg.getOptional("database").ifPresent(builder::withDatabaseName);
var requiredToken = cfg.getOptional("token_file") cfg.getOptional("token_file")
.map(Paths::get) .map(Paths::get)
.map( .map(
tokenFilePath -> { tokenFilePath -> {
@ -84,16 +87,15 @@ public class MilvusSpace implements AutoCloseable {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
).orElseGet( ).or(() -> cfg.getOptional("token"))
() -> cfg.getOptional("token") .ifPresent(builder::withToken);
.orElseThrow(() -> new RuntimeException("You must provide either a token_file or a token to " + // builder = builder.withToken(optionalToken);
"configure a Milvus/Zilliz client"))
);
builder = builder.withToken(requiredToken);
ConnectParam connectParams = builder.build(); ConnectParam connectParams = builder.build();
String tokenSummary = Optional.ofNullable(builder.getToken())
.map(MilvusAdapterUtils::maskDigits).orElse("[none]");
logger.info("{}: Creating new Milvus/Zilliz Client with (masked) token [{}], uri/endpoint [{}]", logger.info("{}: Creating new Milvus/Zilliz Client with (masked) token [{}], uri/endpoint [{}]",
this.name, MilvusAdapterUtils.maskDigits(builder.getToken()), builder.getUri()); this.name, tokenSummary, builder.getUri());
return new MilvusServiceClient(connectParams); return new MilvusServiceClient(connectParams);
} }
@ -101,11 +103,11 @@ public class MilvusSpace implements AutoCloseable {
return ConfigModel.of(MilvusSpace.class) return ConfigModel.of(MilvusSpace.class)
.add( .add(
Param.optional("token_file", String.class, "the file to load the token from") Param.optional("token_file", String.class, "the file to load the token from (try root:Milvus within)")
) )
.add( .add(
Param.defaultTo("token", "root:Milvus") Param.optional("token")
.setDescription("the Milvus/Zilliz token to use to connect to the database") .setDescription("the Milvus/Zilliz token to use to connect to the database (try root:Milvus)")
) )
.add( .add(
Param.defaultTo("uri", "127.0.0.1:19530") Param.defaultTo("uri", "127.0.0.1:19530")

View File

@ -72,7 +72,7 @@ public class QdrantSpace implements AutoCloseable {
boolean useTls = cfg.getOptional("use_tls").map(Boolean::parseBoolean).orElse(true); boolean useTls = cfg.getOptional("use_tls").map(Boolean::parseBoolean).orElse(true);
var builder = QdrantGrpcClient.newBuilder(uri, grpcPort, useTls); var builder = QdrantGrpcClient.newBuilder(uri, grpcPort, useTls);
var requiredToken = cfg.getOptional("token_file") var Optional<requiredToken> = cfg.getOptional("token_file")
.map(Paths::get) .map(Paths::get)
.map( .map(
tokenFilePath -> { tokenFilePath -> {