mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
initial implementation of all milvus ops
This commit is contained in:
parent
e31c2f02b1
commit
66fab172e2
@ -26,14 +26,14 @@ import io.nosqlbench.nb.api.labels.NBLabels;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public class MilvusDriverAdapter extends BaseDriverAdapter<MilvusBaseOp, MilvusSpace> {
|
||||
public class MilvusDriverAdapter extends BaseDriverAdapter<MilvusBaseOp<?>, MilvusSpace> {
|
||||
|
||||
public MilvusDriverAdapter(NBComponent parentComponent, NBLabels labels) {
|
||||
super(parentComponent, labels);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OpMapper<MilvusBaseOp> getOpMapper() {
|
||||
public OpMapper<MilvusBaseOp<?>> getOpMapper() {
|
||||
return new MilvusOpMapper(this);
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ import io.nosqlbench.engine.api.templating.TypeAndTarget;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
public class MilvusOpMapper implements OpMapper<MilvusBaseOp> {
|
||||
public class MilvusOpMapper implements OpMapper<MilvusBaseOp<?>> {
|
||||
private static final Logger logger = LogManager.getLogger(MilvusOpMapper.class);
|
||||
private final MilvusDriverAdapter adapter;
|
||||
|
||||
@ -40,13 +40,13 @@ public class MilvusOpMapper implements OpMapper<MilvusBaseOp> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an instance of a {@link ParsedOp} returns the appropriate {@link MilvusOpDispenser} subclass
|
||||
* Given an instance of a {@link ParsedOp} returns the appropriate {@link MilvusBaseOpDispenser} subclass
|
||||
*
|
||||
* @param op The {@link ParsedOp} to be evaluated
|
||||
* @return The correct {@link MilvusOpDispenser} subclass based on the op type
|
||||
* @return The correct {@link MilvusBaseOpDispenser} subclass based on the op type
|
||||
*/
|
||||
@Override
|
||||
public OpDispenser<? extends MilvusBaseOp> apply(ParsedOp op) {
|
||||
public OpDispenser<? extends MilvusBaseOp<?>> apply(ParsedOp op) {
|
||||
TypeAndTarget<MilvusOpType, String> typeAndTarget = op.getTypeAndTarget(
|
||||
MilvusOpType.class,
|
||||
String.class,
|
||||
@ -63,8 +63,65 @@ public class MilvusOpMapper implements OpMapper<MilvusBaseOp> {
|
||||
case insert -> new MilvusInsertOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case delete -> new MilvusDeleteOpDispenser(adapter,op,typeAndTarget.targetFunction);
|
||||
case search -> new MilvusSearchOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
default -> throw new RuntimeException("Unrecognized op type '" + typeAndTarget.enumId.name() + "' while " +
|
||||
"mapping parsed op " + op);
|
||||
case alter_alias -> new MilvusAlterAliasOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case alter_collection -> new MilvusAlterCollectionOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case flush -> new MilvusFlushOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case bulk_insert -> new MilvusBulkInsertOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case create_alias -> new MilvusCreateAliasOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case get -> new MilvusGetOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case create_partition -> new MilvusCreatePartitionOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case create_credential -> new MilvusCreateCredentialOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case create_database -> new MilvusCreateDatabaseOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case query -> new MilvusQueryOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case delete_credential -> new MilvusDeleteCredentialOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case describe_collection -> new MilvusDescribeCollectionOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case describe_index -> new MilvusDescribeIndexOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case drop_alias -> new MilvusDropAliasOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case get_metrics -> new MilvusGetMetricsOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case drop_database -> new MilvusDropDatabaseOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case get_replicas -> new MilvusGetReplicasOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case load_balance -> new MilvusLoadBalanceOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case has_partition -> new MilvusHasPartitionOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case drop_partition -> new MilvusDropPartitionOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case get_load_state -> new MilvusGetLoadStateOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case list_databases -> new MilvusListDatabasesOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case manual_compact -> new MilvusManualCompactOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case get_index_state -> new MilvusGetIndexStateOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case list_cred_users -> new MilvusListCredUsersOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case load_collection -> new MilvusLoadCollectionOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case show_partitions -> new MilvusShowPartitionsOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case load_partitions -> new MilvusLoadPartitionsOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case list_collections -> new MilvusListCollectionsOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case show_collections -> new MilvusShowCollectionsOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case update_credential -> new MilvusUpdateCredentialOpDispenser(adapter, op, typeAndTarget.targetFunction);
|
||||
case release_collection -> new MilvusReleaseCollectionOpDispenser(adapter, op,
|
||||
typeAndTarget.targetFunction);
|
||||
case get_bulk_insert_state -> new MilvusGetBulkInsertStateOpDispenser(adapter, op,
|
||||
typeAndTarget.targetFunction);
|
||||
case release_partitions -> new MilvusReleasePartitionsOpDispenser(adapter, op,
|
||||
typeAndTarget.targetFunction);
|
||||
case get_flush_all_state -> new MilvusGetFlushAllStateOpDispenser(adapter, op,
|
||||
typeAndTarget.targetFunction);
|
||||
case get_compaction_state -> new MilvusGetCompactionStateOpDispenser(adapter, op,
|
||||
typeAndTarget.targetFunction);
|
||||
case get_loading_progress -> new MilvusGetLoadingProgressOpDispenser(adapter, op,
|
||||
typeAndTarget.targetFunction);
|
||||
case get_persistent_segment_info -> new MilvusGetPersistentSegmentInfoOpDispenser(adapter, op,
|
||||
typeAndTarget.targetFunction);
|
||||
case get_query_segment_info -> new MilvusGetQuerySegmentInfoOpDispenser(adapter, op,
|
||||
typeAndTarget.targetFunction);
|
||||
case list_bulk_insert_tasks -> new MilvusListBulkInsertTasksOpDispenser(adapter, op,
|
||||
typeAndTarget.targetFunction);
|
||||
case get_index_build_progress -> new MilvusGetIndexBuildProgressOpDispenser(adapter, op,
|
||||
typeAndTarget.targetFunction);
|
||||
case get_partition_statistics -> new MilvusGetPartitionStatisticsOpDispenser(adapter, op,
|
||||
typeAndTarget.targetFunction);
|
||||
case get_collection_statistics -> new MilvusGetCollectionStatisticsOpDispenser(adapter, op,
|
||||
typeAndTarget.targetFunction);
|
||||
case get_compaction_state_with_plans -> new MilvusGetCompactionStateWithPlansOpDispenser(adapter, op,
|
||||
typeAndTarget.targetFunction);
|
||||
// default -> throw new RuntimeException("Unrecognized op type '" + typeAndTarget.enumId.name() + "' while " +
|
||||
// "mapping parsed op " + op);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ public class MilvusSpace implements AutoCloseable {
|
||||
.withToken(token)
|
||||
.withDatabaseName(databaseName)
|
||||
.build();
|
||||
logger.info(this.name + ": Creating new Milvus/Zilliz Client with (masked) token [" + Utils.maskDigits(token) + "], uri/endpoint ["
|
||||
logger.info(this.name + ": Creating new Milvus/Zilliz Client with (masked) token [" + MilvusUtils.maskDigits(token) + "], uri/endpoint ["
|
||||
+ uri + "]");
|
||||
this.client = new MilvusServiceClient(connectParam);
|
||||
return this.client;
|
||||
|
@ -16,7 +16,22 @@
|
||||
|
||||
package io.nosqlbench.adapter.milvus;
|
||||
|
||||
public class Utils {
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class MilvusUtils {
|
||||
|
||||
public static List<String> splitNames(String input) {
|
||||
Objects.requireNonNull(input);
|
||||
return Arrays.asList(input.split("( +| *, *)"));
|
||||
}
|
||||
|
||||
public static List<Long> splitLongs(String input) {
|
||||
Objects.requireNonNull(input);
|
||||
return Arrays.stream(input.split("( +| *, *)")).map(Long::parseLong).toList();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Mask the digits in the given string with '*'
|
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.common.clientenum.ConsistencyLevelEnum;
|
||||
import io.milvus.param.alias.AlterAliasParam;
|
||||
import io.milvus.param.collection.CreateCollectionParam;
|
||||
import io.milvus.param.collection.FieldType;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusAlterAliasOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusCreateCollectionOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusAlterAliasOpDispenser extends MilvusBaseOpDispenser<AlterAliasParam> {
|
||||
private static final Logger logger = LogManager.getLogger(MilvusAlterAliasOpDispenser.class);
|
||||
|
||||
public MilvusAlterAliasOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<AlterAliasParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<AlterAliasParam.Builder> ebF =
|
||||
l -> AlterAliasParam.newBuilder().withAlias(targetF.apply(l));
|
||||
// Add enhancement functions here
|
||||
|
||||
ebF = op.enhanceFuncOptionally(ebF,"collection_name",String.class,AlterAliasParam.Builder::withCollectionName);
|
||||
|
||||
final LongFunction<AlterAliasParam.Builder> lastF = ebF;
|
||||
final LongFunction<AlterAliasParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<AlterAliasParam>> createOpFunc(
|
||||
LongFunction<AlterAliasParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusAlterAliasOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.collection.AlterCollectionParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusAlterCollectionOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusAlterCollectionOpDispenser extends MilvusBaseOpDispenser<AlterCollectionParam> {
|
||||
|
||||
public MilvusAlterCollectionOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<AlterCollectionParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<AlterCollectionParam.Builder> ebF =
|
||||
l -> AlterCollectionParam.newBuilder().withCollectionName(targetF.apply(l));
|
||||
|
||||
ebF = op.enhanceFuncOptionally(ebF,"ttl", Integer.class, AlterCollectionParam.Builder::withTTL);
|
||||
|
||||
final LongFunction<AlterCollectionParam.Builder> lastF = ebF;
|
||||
final LongFunction<AlterCollectionParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<AlterCollectionParam>> createOpFunc(
|
||||
LongFunction<AlterCollectionParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusAlterCollectionOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -21,31 +21,44 @@ import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.MilvusSpace;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapters.api.activityimpl.BaseOpDispenser;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public abstract class MilvusOpDispenser extends BaseOpDispenser<MilvusBaseOp, MilvusSpace> {
|
||||
public abstract class MilvusBaseOpDispenser<T> extends BaseOpDispenser<MilvusBaseOp<T>, MilvusSpace> {
|
||||
|
||||
protected final LongFunction<MilvusSpace> mzSpaceFunction;
|
||||
protected final LongFunction<MilvusServiceClient> clientFunction;
|
||||
private final LongFunction<? extends MilvusBaseOp> opF;
|
||||
private final LongFunction<? extends MilvusBaseOp<T>> opF;
|
||||
private final LongFunction<T> paramF;
|
||||
|
||||
protected MilvusOpDispenser(MilvusDriverAdapter adapter, ParsedOp op, LongFunction<String> targetF) {
|
||||
super(adapter, op);
|
||||
protected MilvusBaseOpDispenser(MilvusDriverAdapter adapter, ParsedOp op, LongFunction<String> targetF) {
|
||||
super((DriverAdapter)adapter, op);
|
||||
this.mzSpaceFunction = adapter.getSpaceFunc(op);
|
||||
this.clientFunction = (long l) -> this.mzSpaceFunction.apply(l).getClient();
|
||||
this.opF = createOpFunc(this.clientFunction, op, targetF);
|
||||
this.paramF = getParamFunc(this.clientFunction,op,targetF);
|
||||
this.opF = createOpFunc(paramF, this.clientFunction, op, targetF);
|
||||
}
|
||||
protected MilvusDriverAdapter getDriverAdapter() {
|
||||
return (MilvusDriverAdapter) adapter;
|
||||
}
|
||||
|
||||
public abstract LongFunction<? extends MilvusBaseOp> createOpFunc(
|
||||
public abstract LongFunction<T> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
);
|
||||
|
||||
public abstract LongFunction<MilvusBaseOp<T>> createOpFunc(
|
||||
LongFunction<T> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
);
|
||||
|
||||
@Override
|
||||
public MilvusBaseOp apply(long value) {
|
||||
public MilvusBaseOp<T> apply(long value) {
|
||||
return opF.apply(value);
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.bulkinsert.BulkInsertParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBulkInsertOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusBulkInsertOpDispenser extends MilvusBaseOpDispenser<BulkInsertParam> {
|
||||
|
||||
public MilvusBulkInsertOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<BulkInsertParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<BulkInsertParam.Builder> ebF =
|
||||
l -> BulkInsertParam.newBuilder().withCollectionName(targetF.apply(l));
|
||||
// Add enhancement functions here
|
||||
throw new RuntimeException("implement me");
|
||||
|
||||
|
||||
|
||||
// And remove test function
|
||||
// BulkInsertParam.Builder test = ebF.apply(0);
|
||||
|
||||
// final LongFunction<BulkInsertParam.Builder> lastF = ebF;
|
||||
// final LongFunction<BulkInsertParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
// return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<BulkInsertParam>> createOpFunc(
|
||||
LongFunction<BulkInsertParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusBulkInsertOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.alias.CreateAliasParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusCreateAliasOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusCreateAliasOpDispenser extends MilvusBaseOpDispenser<CreateAliasParam> {
|
||||
|
||||
public MilvusCreateAliasOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<CreateAliasParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<CreateAliasParam.Builder> ebF =
|
||||
l -> CreateAliasParam.newBuilder().withAlias(targetF.apply(l));
|
||||
ebF = op.enhanceFuncOptionally(ebF, "collection_name",String.class,
|
||||
CreateAliasParam.Builder::withCollectionName);
|
||||
|
||||
final LongFunction<CreateAliasParam.Builder> lastF = ebF;
|
||||
final LongFunction<CreateAliasParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<CreateAliasParam>> createOpFunc(
|
||||
LongFunction<CreateAliasParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusCreateAliasOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -19,9 +19,11 @@ package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.common.clientenum.ConsistencyLevelEnum;
|
||||
import io.milvus.grpc.DataType;
|
||||
import io.milvus.param.alias.CreateAliasParam;
|
||||
import io.milvus.param.collection.CreateCollectionParam;
|
||||
import io.milvus.param.collection.FieldType;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusCreateCollectionOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@ -32,11 +34,11 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusCreateCollectionOpDispenser extends MilvusOpDispenser {
|
||||
public class MilvusCreateCollectionOpDispenser extends MilvusBaseOpDispenser<CreateCollectionParam> {
|
||||
private static final Logger logger = LogManager.getLogger(MilvusCreateCollectionOpDispenser.class);
|
||||
|
||||
/**
|
||||
* Create a new MilvusCreateCollectionOpDispenser subclassed from {@link MilvusOpDispenser}.
|
||||
* Create a new MilvusCreateCollectionOpDispenser subclassed from {@link MilvusBaseOpDispenser}.
|
||||
*
|
||||
* @param adapter
|
||||
* The associated {@link MilvusDriverAdapter}
|
||||
@ -51,14 +53,12 @@ public class MilvusCreateCollectionOpDispenser extends MilvusOpDispenser {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
// https://milvus.io/docs/create_collection.md
|
||||
@Override
|
||||
public LongFunction<MilvusCreateCollectionOp> createOpFunc(
|
||||
public LongFunction<CreateCollectionParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
|
||||
LongFunction<CreateCollectionParam.Builder> ebF =
|
||||
l -> CreateCollectionParam.newBuilder().withCollectionName(targetF.apply(l));
|
||||
|
||||
@ -74,9 +74,18 @@ public class MilvusCreateCollectionOpDispenser extends MilvusOpDispenser {
|
||||
final LongFunction<CreateCollectionParam.Builder> f = ebF;
|
||||
ebF = l -> f.apply(l).withFieldTypes(fieldTypes);
|
||||
final LongFunction<CreateCollectionParam.Builder> lastF = ebF;
|
||||
final LongFunction<CreateCollectionParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return l -> lastF.apply(l).build();
|
||||
}
|
||||
|
||||
return l -> new MilvusCreateCollectionOp(clientF.apply(l), collectionParamF.apply(l));
|
||||
// https://milvus.io/docs/create_collection.md
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<CreateCollectionParam>> createOpFunc(
|
||||
LongFunction<CreateCollectionParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusCreateCollectionOp(clientF.apply(l), paramF.apply(l));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.credential.CreateCredentialParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusCreateCredentialOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusCreateCredentialOpDispenser extends MilvusBaseOpDispenser<CreateCredentialParam> {
|
||||
|
||||
public MilvusCreateCredentialOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<CreateCredentialParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<CreateCredentialParam.Builder> ebF =
|
||||
l -> CreateCredentialParam.newBuilder().withUsername(targetF.apply(l));
|
||||
|
||||
ebF = op.enhanceFunc(ebF,"password",String.class,CreateCredentialParam.Builder::withPassword);
|
||||
|
||||
final LongFunction<CreateCredentialParam.Builder> lastF = ebF;
|
||||
final LongFunction<CreateCredentialParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<CreateCredentialParam>> createOpFunc(
|
||||
LongFunction<CreateCredentialParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusCreateCredentialOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.collection.CreateDatabaseParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusCreateDatabaseOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusCreateDatabaseOpDispenser extends MilvusBaseOpDispenser<CreateDatabaseParam> {
|
||||
|
||||
public MilvusCreateDatabaseOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<CreateDatabaseParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l1 -> CreateDatabaseParam.newBuilder().withDatabaseName(targetF.apply(l1)).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<CreateDatabaseParam>> createOpFunc(
|
||||
LongFunction<CreateDatabaseParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusCreateDatabaseOp(clientF.apply(l), paramF.apply(l));
|
||||
}
|
||||
}
|
@ -17,29 +17,21 @@
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.common.clientenum.ConsistencyLevelEnum;
|
||||
import io.milvus.grpc.CreateIndexRequest;
|
||||
import io.milvus.grpc.DataType;
|
||||
import io.milvus.param.collection.CreateCollectionParam;
|
||||
import io.milvus.param.collection.FieldType;
|
||||
import io.milvus.param.index.CreateIndexParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusCreateCollectionOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusCreateIndexOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusCreateIndexOpDispenser extends MilvusOpDispenser {
|
||||
public class MilvusCreateIndexOpDispenser extends MilvusBaseOpDispenser<CreateIndexParam> {
|
||||
private static final Logger logger = LogManager.getLogger(MilvusCreateIndexOpDispenser.class);
|
||||
|
||||
/**
|
||||
* Create a new MilvusCreateIndexOpDispenser subclassed from {@link MilvusOpDispenser}.
|
||||
* Create a new MilvusCreateIndexOpDispenser subclassed from {@link MilvusBaseOpDispenser}.
|
||||
*
|
||||
* @param adapter
|
||||
* The associated {@link MilvusDriverAdapter}
|
||||
@ -56,14 +48,8 @@ public class MilvusCreateIndexOpDispenser extends MilvusOpDispenser {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
// https://milvus.io/api-reference/java/v2.3.x/Index/createIndex().md
|
||||
@Override
|
||||
public LongFunction<MilvusCreateIndexOp> createOpFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
|
||||
public LongFunction<CreateIndexParam> getParamFunc(LongFunction<MilvusServiceClient> clientF, ParsedOp op, LongFunction<String> targetF) {
|
||||
LongFunction<CreateIndexParam.Builder> bF =
|
||||
l -> CreateIndexParam.newBuilder().withIndexName(targetF.apply(l));
|
||||
|
||||
@ -75,9 +61,12 @@ public class MilvusCreateIndexOpDispenser extends MilvusOpDispenser {
|
||||
bF = op.enhanceFuncOptionally(bF, "sync_mode", Boolean.class, CreateIndexParam.Builder::withSyncMode);
|
||||
bF = op.enhanceFuncOptionally(bF, "sync_waiting_interval", Long.class, CreateIndexParam.Builder::withSyncWaitingInterval);
|
||||
bF = op.enhanceFuncOptionally(bF, "sync_waiting_timeout", Long.class, CreateIndexParam.Builder::withSyncWaitingTimeout);
|
||||
|
||||
LongFunction<CreateIndexParam.Builder> finalBF = bF;
|
||||
return l -> new MilvusCreateIndexOp(clientF.apply(l), finalBF.apply(l).build());
|
||||
LongFunction<CreateIndexParam.Builder> finalBF1 = bF;
|
||||
return l -> finalBF1.apply(l).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<CreateIndexParam>> createOpFunc(LongFunction<CreateIndexParam> paramF, LongFunction<MilvusServiceClient> clientF, ParsedOp op, LongFunction<String> targetF) {
|
||||
return l -> new MilvusCreateIndexOp(clientF.apply(l), paramF.apply(l));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.partition.CreatePartitionParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusCreatePartitionOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusCreatePartitionOpDispenser extends MilvusBaseOpDispenser<CreatePartitionParam> {
|
||||
|
||||
public MilvusCreatePartitionOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<CreatePartitionParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<CreatePartitionParam.Builder> ebF =
|
||||
l -> CreatePartitionParam.newBuilder().withCollectionName(targetF.apply(l));
|
||||
// Add enhancement functions here
|
||||
ebF = op.enhanceFunc(ebF,"collection_name",String.class,CreatePartitionParam.Builder::withCollectionName);
|
||||
|
||||
final LongFunction<CreatePartitionParam.Builder> lastF = ebF;
|
||||
final LongFunction<CreatePartitionParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<CreatePartitionParam>> createOpFunc(
|
||||
LongFunction<CreatePartitionParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusCreatePartitionOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.credential.DeleteCredentialParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusDeleteCredentialOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusDeleteCredentialOpDispenser extends MilvusBaseOpDispenser<DeleteCredentialParam> {
|
||||
|
||||
public MilvusDeleteCredentialOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<DeleteCredentialParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> DeleteCredentialParam.newBuilder().withUsername(targetF.apply(l)).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<DeleteCredentialParam>> createOpFunc(
|
||||
LongFunction<DeleteCredentialParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusDeleteCredentialOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -21,23 +21,14 @@ package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.dml.DeleteParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusDeleteOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusDeleteParamOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import io.milvus.param.dml.DeleteParam.Builder;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusDeleteOpDispenser extends MilvusOpDispenser {
|
||||
private static final Logger logger = LogManager.getLogger(MilvusDeleteOpDispenser.class);
|
||||
|
||||
/**
|
||||
* Create a new MilvusDeleteOpDispenser subclassed from {@link MilvusOpDispenser}.
|
||||
*
|
||||
* @param adapter The associated {@link MilvusDriverAdapter}
|
||||
* @param op The {@link ParsedOp} encapsulating the activity for this cycle
|
||||
* @param targetFunction A LongFunction that returns the specified Milvus Index for this Op
|
||||
*/
|
||||
public class MilvusDeleteOpDispenser extends MilvusBaseOpDispenser<DeleteParam> {
|
||||
public MilvusDeleteOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
@ -45,21 +36,19 @@ public class MilvusDeleteOpDispenser extends MilvusOpDispenser {
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusDeleteOp> createOpFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
|
||||
public LongFunction<DeleteParam> getParamFunc(LongFunction<MilvusServiceClient> clientF, ParsedOp op, LongFunction<String> targetF) {
|
||||
LongFunction<DeleteParam.Builder> f =
|
||||
l -> DeleteParam.newBuilder().withCollectionName(targetF.apply(l));
|
||||
f = op.enhanceFuncOptionally(f, "partition", String.class, DeleteParam.Builder::withPartitionName);
|
||||
f = op.enhanceFuncOptionally(f, "expression", String.class, DeleteParam.Builder::withExpr);
|
||||
f = op.enhanceFuncOptionally(f, "expr", String.class, DeleteParam.Builder::withExpr);
|
||||
|
||||
f = op.enhanceFuncOptionally(f, "expr", String.class, Builder::withExpr);
|
||||
LongFunction<DeleteParam.Builder> finalF = f;
|
||||
LongFunction<MilvusDeleteOp> opF = l -> new MilvusDeleteOp(clientF.apply(l), finalF.apply(l).build());
|
||||
return opF;
|
||||
return l -> finalF.apply(l).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<DeleteParam>> createOpFunc(LongFunction<DeleteParam> paramF, LongFunction<MilvusServiceClient> clientF, ParsedOp op, LongFunction<String> targetF) {
|
||||
return l -> new MilvusDeleteParamOp(clientF.apply(l), paramF.apply(l));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.collection.DescribeCollectionParam;
|
||||
import io.milvus.param.partition.CreatePartitionParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusDescribeCollectionOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusDescribeCollectionOpDispenser extends MilvusBaseOpDispenser<DescribeCollectionParam> {
|
||||
|
||||
public MilvusDescribeCollectionOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<DescribeCollectionParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<DescribeCollectionParam.Builder> ebF =
|
||||
l -> DescribeCollectionParam.newBuilder().withCollectionName(targetF.apply(l));
|
||||
|
||||
ebF = op.enhanceFuncOptionally(ebF,"database_name",String.class, DescribeCollectionParam.Builder::withDatabaseName);
|
||||
|
||||
final LongFunction<DescribeCollectionParam.Builder> lastF = ebF;
|
||||
final LongFunction<DescribeCollectionParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<DescribeCollectionParam>> createOpFunc(
|
||||
LongFunction<DescribeCollectionParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusDescribeCollectionOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.index.DescribeIndexParam;
|
||||
import io.milvus.param.partition.CreatePartitionParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusDescribeIndexOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusDescribeIndexOpDispenser extends MilvusBaseOpDispenser<DescribeIndexParam> {
|
||||
|
||||
public MilvusDescribeIndexOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<DescribeIndexParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<DescribeIndexParam.Builder> ebF =
|
||||
l -> DescribeIndexParam.newBuilder().withIndexName(targetF.apply(l));
|
||||
ebF = op.enhanceFunc(ebF,"collection_name",String.class, DescribeIndexParam.Builder::withCollectionName);
|
||||
ebF = op.enhanceFunc(ebF,"database_name",String.class,DescribeIndexParam.Builder::withDatabaseName);
|
||||
|
||||
final LongFunction<DescribeIndexParam.Builder> lastF = ebF;
|
||||
final LongFunction<DescribeIndexParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<DescribeIndexParam>> createOpFunc(
|
||||
LongFunction<DescribeIndexParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusDescribeIndexOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.alias.DropAliasParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusDropAliasOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusDropAliasOpDispenser extends MilvusBaseOpDispenser<DropAliasParam> {
|
||||
|
||||
public MilvusDropAliasOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<DropAliasParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<DropAliasParam.Builder> ebF =
|
||||
l -> DropAliasParam.newBuilder().withAlias(targetF.apply(l));
|
||||
final LongFunction<DropAliasParam.Builder> lastF = ebF;
|
||||
final LongFunction<DropAliasParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<DropAliasParam>> createOpFunc(
|
||||
LongFunction<DropAliasParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusDropAliasOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -21,6 +21,7 @@ package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.collection.DropCollectionParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusDropCollectionOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@ -28,15 +29,23 @@ import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusDropCollectionOpDispenser extends MilvusOpDispenser {
|
||||
import static org.matheclipse.core.expression.S.l;
|
||||
|
||||
public class MilvusDropCollectionOpDispenser extends MilvusBaseOpDispenser<DropCollectionParam> {
|
||||
private static final Logger logger = LogManager.getLogger(MilvusDropCollectionOpDispenser.class);
|
||||
|
||||
/**
|
||||
* Create a new MilvusDeleteOpDispenser subclassed from {@link MilvusOpDispenser}.
|
||||
* <P>Create a new MilvusDeleteOpDispenser subclassed from {@link MilvusBaseOpDispenser}.</P>
|
||||
*
|
||||
* <P>{@see <A HREF="https://milvus.io/docs/drop_collection.md">Drop Collection</A>}</P>
|
||||
*
|
||||
* @param adapter
|
||||
* The associated {@link MilvusDriverAdapter}
|
||||
* @param op
|
||||
* The {@link ParsedOp} encapsulating the activity for this cycle
|
||||
* @param targetFunction
|
||||
* A LongFunction that returns the specified Milvus Index for this Op
|
||||
*
|
||||
* @param adapter The associated {@link MilvusDriverAdapter}
|
||||
* @param op The {@link ParsedOp} encapsulating the activity for this cycle
|
||||
* @param targetFunction A LongFunction that returns the specified Milvus Index for this Op
|
||||
*/
|
||||
public MilvusDropCollectionOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
@ -44,12 +53,19 @@ public class MilvusDropCollectionOpDispenser extends MilvusOpDispenser {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
// https://milvus.io/docs/drop_collection.md
|
||||
@Override
|
||||
public LongFunction<MilvusDropCollectionOp> createOpFunc(LongFunction<MilvusServiceClient> clientF, ParsedOp op, LongFunction<String> targetF) {
|
||||
DropCollectionParam.Builder eb = DropCollectionParam.newBuilder();
|
||||
public LongFunction<DropCollectionParam> getParamFunc(LongFunction<MilvusServiceClient> clientF, ParsedOp op, LongFunction<String> targetF) {
|
||||
LongFunction<DropCollectionParam.Builder> f =
|
||||
l -> DropCollectionParam.newBuilder().withCollectionName(targetF.apply(l));
|
||||
return l -> new MilvusDropCollectionOp(clientF.apply(l), f.apply(1).build());
|
||||
f = op.enhanceFuncOptionally(f,"database_name",String.class,DropCollectionParam.Builder::withDatabaseName);
|
||||
LongFunction<DropCollectionParam.Builder> finalF = f;
|
||||
return l -> finalF.apply(l).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<DropCollectionParam>> createOpFunc(LongFunction<DropCollectionParam> paramF, LongFunction<MilvusServiceClient> clientF, ParsedOp op, LongFunction<String> targetF) {
|
||||
|
||||
return l -> new MilvusDropCollectionOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.collection.DropDatabaseParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusDropDatabaseOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusDropDatabaseOpDispenser extends MilvusBaseOpDispenser<DropDatabaseParam> {
|
||||
|
||||
public MilvusDropDatabaseOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<DropDatabaseParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> DropDatabaseParam.newBuilder().withDatabaseName(targetF.apply(l)).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<DropDatabaseParam>> createOpFunc(
|
||||
LongFunction<DropDatabaseParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusDropDatabaseOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -19,10 +19,9 @@ package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.collection.DropCollectionParam;
|
||||
import io.milvus.param.index.DropIndexParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusDropCollectionOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusDropIndexOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@ -30,11 +29,11 @@ import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusDropIndexOpDispenser extends MilvusOpDispenser {
|
||||
private static final Logger logger = LogManager.getLogger(MilvusDropIndexOpDispenser.class);
|
||||
|
||||
public class MilvusDropIndexOpDispenser extends MilvusBaseOpDispenser<DropIndexParam> {
|
||||
/**
|
||||
* Create a new MilvusDeleteOpDispenser subclassed from {@link MilvusOpDispenser}.
|
||||
* <P>Create a new MilvusDeleteOpDispenser subclassed from {@link MilvusBaseOpDispenser}.</P>
|
||||
* <P>{@see <a href="https://milvus.io/docs/drop_collection.md">Drop Index</a>}</P>
|
||||
*
|
||||
*
|
||||
* @param adapter
|
||||
* The associated {@link MilvusDriverAdapter}
|
||||
@ -49,18 +48,18 @@ public class MilvusDropIndexOpDispenser extends MilvusOpDispenser {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
// https://milvus.io/docs/drop_collection.md
|
||||
@Override
|
||||
public LongFunction<MilvusDropIndexOp> createOpFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
public LongFunction<DropIndexParam> getParamFunc(LongFunction<MilvusServiceClient> clientF, ParsedOp op, LongFunction<String> targetF) {
|
||||
LongFunction<DropIndexParam.Builder> f =
|
||||
l -> DropIndexParam.newBuilder().withIndexName(targetF.apply(l));
|
||||
f = op.enhanceFunc(f,"collection_name",String.class, DropIndexParam.Builder::withCollectionName);
|
||||
|
||||
LongFunction<DropIndexParam.Builder> finalF = f;
|
||||
return l -> new MilvusDropIndexOp(clientF.apply(l), finalF.apply(1).build());
|
||||
return l -> finalF.apply(1).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<DropIndexParam>> createOpFunc(LongFunction<DropIndexParam> paramF, LongFunction<MilvusServiceClient> clientF, ParsedOp op, LongFunction<String> targetF) {
|
||||
return l -> new MilvusDropIndexOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.partition.CreatePartitionParam;
|
||||
import io.milvus.param.partition.DropPartitionParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusDropPartitionOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusDropPartitionOpDispenser extends MilvusBaseOpDispenser<DropPartitionParam> {
|
||||
|
||||
public MilvusDropPartitionOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<DropPartitionParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<DropPartitionParam.Builder> ebF =
|
||||
l -> DropPartitionParam.newBuilder().withPartitionName(targetF.apply(l));
|
||||
ebF = op.enhanceFunc(ebF,"collection_name",String.class, DropPartitionParam.Builder::withCollectionName);
|
||||
|
||||
final LongFunction<DropPartitionParam.Builder> lastF = ebF;
|
||||
final LongFunction<DropPartitionParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<DropPartitionParam>> createOpFunc(
|
||||
LongFunction<DropPartitionParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusDropPartitionOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.collection.FlushParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusFlushOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusFlushOpDispenser extends MilvusBaseOpDispenser<FlushParam> {
|
||||
|
||||
public MilvusFlushOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<FlushParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
|
||||
LongFunction<FlushParam.Builder> ebF =
|
||||
l -> FlushParam.newBuilder();
|
||||
|
||||
LongFunction<List<String>> cnames = l -> {
|
||||
List<String> collectionNames = Arrays.asList(targetF.apply(l).split("[\\s,]"));
|
||||
return collectionNames;
|
||||
};
|
||||
LongFunction<FlushParam.Builder> finalEbF = ebF;
|
||||
ebF = l -> finalEbF.apply(l).withCollectionNames(cnames.apply(l));
|
||||
ebF = op.enhanceFuncOptionally(ebF, "database_name",String.class,FlushParam.Builder::withDatabaseName);
|
||||
ebF = op.enhanceFuncOptionally(ebF, "sync_flush_waiting_interval",Long.class,
|
||||
FlushParam.Builder::withSyncFlushWaitingInterval);
|
||||
ebF = op.enhanceFuncOptionally(ebF, "sync_flush_waiting_timeout",Long.class,
|
||||
FlushParam.Builder::withSyncFlushWaitingTimeout);
|
||||
|
||||
final LongFunction<FlushParam.Builder> lastF = ebF;
|
||||
final LongFunction<FlushParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<FlushParam>> createOpFunc(
|
||||
LongFunction<FlushParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusFlushOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.bulkinsert.GetBulkInsertStateParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusGetBulkInsertStateOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusGetCollectionStatisticsOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusGetBulkInsertStateOpDispenser extends MilvusBaseOpDispenser<GetBulkInsertStateParam> {
|
||||
|
||||
public MilvusGetBulkInsertStateOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<GetBulkInsertStateParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<GetBulkInsertStateParam.Builder> ebF =
|
||||
l -> GetBulkInsertStateParam.newBuilder().withTask(Long.parseLong(targetF.apply(l)));
|
||||
|
||||
final LongFunction<GetBulkInsertStateParam.Builder> lastF = ebF;
|
||||
final LongFunction<GetBulkInsertStateParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<GetBulkInsertStateParam>> createOpFunc(
|
||||
LongFunction<GetBulkInsertStateParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusGetBulkInsertStateOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.collection.GetCollectionStatisticsParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusGetCollectionStatisticsOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusGetCollectionStatisticsOpDispenser extends MilvusBaseOpDispenser<GetCollectionStatisticsParam> {
|
||||
|
||||
public MilvusGetCollectionStatisticsOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<GetCollectionStatisticsParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<GetCollectionStatisticsParam.Builder> ebF =
|
||||
l -> GetCollectionStatisticsParam.newBuilder().withCollectionName(targetF.apply(l));
|
||||
// Add enhancement functions here
|
||||
ebF = op.enhanceFuncOptionally(ebF,"database_name", String.class,
|
||||
GetCollectionStatisticsParam.Builder::withDatabaseName);
|
||||
ebF = op.enhanceFuncOptionally(ebF,"flush",Boolean.class,GetCollectionStatisticsParam.Builder::withFlush);
|
||||
|
||||
final LongFunction<GetCollectionStatisticsParam.Builder> lastF = ebF;
|
||||
final LongFunction<GetCollectionStatisticsParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<GetCollectionStatisticsParam>> createOpFunc(
|
||||
LongFunction<GetCollectionStatisticsParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusGetCollectionStatisticsOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.control.GetCompactionStateParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusGetCompactionStateOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusGetCompactionStateOpDispenser extends MilvusBaseOpDispenser<GetCompactionStateParam> {
|
||||
|
||||
public MilvusGetCompactionStateOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<GetCompactionStateParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<GetCompactionStateParam.Builder> ebF =
|
||||
l -> GetCompactionStateParam.newBuilder().withCompactionID(Long.parseLong(targetF.apply(l)));
|
||||
|
||||
final LongFunction<GetCompactionStateParam.Builder> lastF = ebF;
|
||||
final LongFunction<GetCompactionStateParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<GetCompactionStateParam>> createOpFunc(
|
||||
LongFunction<GetCompactionStateParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusGetCompactionStateOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.control.GetCompactionPlansParam;
|
||||
import io.milvus.param.control.GetCompactionPlansParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusGetCompactionStateWithPlansOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusGetCompactionStateWithPlansOpDispenser extends MilvusBaseOpDispenser<GetCompactionPlansParam> {
|
||||
|
||||
public MilvusGetCompactionStateWithPlansOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<GetCompactionPlansParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<GetCompactionPlansParam.Builder> ebF =
|
||||
l -> GetCompactionPlansParam.newBuilder().withCompactionID(Long.parseLong(targetF.apply(l)));
|
||||
|
||||
final LongFunction<GetCompactionPlansParam.Builder> lastF = ebF;
|
||||
final LongFunction<GetCompactionPlansParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<GetCompactionPlansParam>> createOpFunc(
|
||||
LongFunction<GetCompactionPlansParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusGetCompactionStateWithPlansOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.control.GetFlushAllStateParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusGetFlushAllStateOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusGetFlushAllStateOpDispenser extends MilvusBaseOpDispenser<GetFlushAllStateParam> {
|
||||
|
||||
public MilvusGetFlushAllStateOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<GetFlushAllStateParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<GetFlushAllStateParam.Builder> ebF =
|
||||
l -> GetFlushAllStateParam.newBuilder().withFlushAllTs(Long.parseLong(targetF.apply(l)));
|
||||
final LongFunction<GetFlushAllStateParam.Builder> lastF = ebF;
|
||||
final LongFunction<GetFlushAllStateParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<GetFlushAllStateParam>> createOpFunc(
|
||||
LongFunction<GetFlushAllStateParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusGetFlushAllStateOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.control.GetFlushStateParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusGetFlushStateOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusGetFlushStateOpDispenser extends MilvusBaseOpDispenser<GetFlushStateParam> {
|
||||
|
||||
public MilvusGetFlushStateOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<GetFlushStateParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<GetFlushStateParam.Builder> ebF =
|
||||
l -> GetFlushStateParam.newBuilder();
|
||||
|
||||
// Add enhancement functions here
|
||||
LongFunction<List<Long>> idsF = l -> {
|
||||
List<Long> ids = Arrays.stream(targetF.apply(l).split("( +| *, *)"))
|
||||
.map(Long::valueOf).toList();
|
||||
return ids;
|
||||
};
|
||||
LongFunction<GetFlushStateParam.Builder> finalEbF = ebF;
|
||||
ebF = l -> finalEbF.apply(l).withSegmentIDs(idsF.apply(l));
|
||||
ebF = op.enhanceFuncOptionally(ebF,"collection_name",String.class,GetFlushStateParam.Builder::withCollectionName);
|
||||
ebF = op.enhanceFuncOptionally(ebF,"flush_ts",Long.class,GetFlushStateParam.Builder::withFlushTs);
|
||||
|
||||
final LongFunction<GetFlushStateParam.Builder> lastF = ebF;
|
||||
final LongFunction<GetFlushStateParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<GetFlushStateParam>> createOpFunc(
|
||||
LongFunction<GetFlushStateParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusGetFlushStateOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.index.GetIndexBuildProgressParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusGetIndexBuildProgressOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusGetIndexBuildProgressOpDispenser extends MilvusBaseOpDispenser<GetIndexBuildProgressParam> {
|
||||
|
||||
public MilvusGetIndexBuildProgressOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<GetIndexBuildProgressParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<GetIndexBuildProgressParam.Builder> ebF =
|
||||
l -> GetIndexBuildProgressParam.newBuilder().withIndexName(targetF.apply(l));
|
||||
ebF = op.enhanceFuncOptionally(ebF,"collection_name",String.class,GetIndexBuildProgressParam.Builder::withCollectionName);
|
||||
|
||||
final LongFunction<GetIndexBuildProgressParam.Builder> lastF = ebF;
|
||||
final LongFunction<GetIndexBuildProgressParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<GetIndexBuildProgressParam>> createOpFunc(
|
||||
LongFunction<GetIndexBuildProgressParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusGetIndexBuildProgressOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.index.GetIndexStateParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusGetIndexStateOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusGetIndexStateOpDispenser extends MilvusBaseOpDispenser<GetIndexStateParam> {
|
||||
|
||||
public MilvusGetIndexStateOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<GetIndexStateParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<GetIndexStateParam.Builder> ebF =
|
||||
l -> GetIndexStateParam.newBuilder().withIndexName(targetF.apply(l));
|
||||
ebF = op.enhanceFuncOptionally(ebF,"collection_name",String.class,GetIndexStateParam.Builder::withCollectionName);
|
||||
final LongFunction<GetIndexStateParam.Builder> lastF = ebF;
|
||||
final LongFunction<GetIndexStateParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<GetIndexStateParam>> createOpFunc(
|
||||
LongFunction<GetIndexStateParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusGetIndexStateOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.collection.GetLoadStateParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.MilvusUtils;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusGetLoadStateOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusGetLoadStateOpDispenser extends MilvusBaseOpDispenser<GetLoadStateParam> {
|
||||
|
||||
public MilvusGetLoadStateOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<GetLoadStateParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<GetLoadStateParam.Builder> ebF =
|
||||
l -> GetLoadStateParam.newBuilder().withCollectionName(targetF.apply(l));
|
||||
ebF = op.enhanceFuncOptionally(ebF,"database_name",String.class,GetLoadStateParam.Builder::withDatabaseName);
|
||||
|
||||
Optional<LongFunction<String>> partitionsF = op.getAsOptionalFunction("partition_name", String.class);
|
||||
if (partitionsF.isPresent()) {
|
||||
LongFunction<String> pfunc = partitionsF.get();
|
||||
LongFunction<GetLoadStateParam.Builder> finalEbF = ebF;
|
||||
ebF = l -> finalEbF.apply(l).withPartitionNames(MilvusUtils.splitNames(pfunc.apply(l)));
|
||||
}
|
||||
|
||||
final LongFunction<GetLoadStateParam.Builder> lastF = ebF;
|
||||
return l -> lastF.apply(l).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<GetLoadStateParam>> createOpFunc(
|
||||
LongFunction<GetLoadStateParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusGetLoadStateOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.collection.GetLoadingProgressParam;
|
||||
import io.milvus.param.collection.GetLoadingProgressParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.MilvusUtils;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusGetLoadStateOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusGetLoadingProgressOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusGetLoadingProgressOpDispenser extends MilvusBaseOpDispenser<GetLoadingProgressParam> {
|
||||
|
||||
public MilvusGetLoadingProgressOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<GetLoadingProgressParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<GetLoadingProgressParam.Builder> ebF =
|
||||
l -> GetLoadingProgressParam.newBuilder().withCollectionName(targetF.apply(l));
|
||||
ebF = op.enhanceFuncOptionally(ebF,"partition_names", List.class,GetLoadingProgressParam.Builder::withPartitionNames);
|
||||
final LongFunction<GetLoadingProgressParam.Builder> lastF = ebF;
|
||||
return l -> lastF.apply(l).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<GetLoadingProgressParam>> createOpFunc(
|
||||
LongFunction<GetLoadingProgressParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusGetLoadingProgressOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.control.GetMetricsParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusGetMetricsOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusGetMetricsOpDispenser extends MilvusBaseOpDispenser<GetMetricsParam> {
|
||||
|
||||
public MilvusGetMetricsOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<GetMetricsParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<GetMetricsParam.Builder> ebF =
|
||||
l -> GetMetricsParam.newBuilder().withRequest(targetF.apply(l));
|
||||
final LongFunction<GetMetricsParam.Builder> lastF = ebF;
|
||||
final LongFunction<GetMetricsParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<GetMetricsParam>> createOpFunc(
|
||||
LongFunction<GetMetricsParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusGetMetricsOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.common.clientenum.ConsistencyLevelEnum;
|
||||
import io.milvus.param.highlevel.dml.GetIdsParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.MilvusUtils;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusGetOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
import static org.matheclipse.core.expression.S.l;
|
||||
|
||||
/**
|
||||
* Because we are using type-and-target logic to identify the op variant,
|
||||
* we are limited to a string target value. In this particular op type, the
|
||||
* IDs are key target elements. Unfortunately, this creates a type incompatibility
|
||||
* where the target values should be determined at runtime based on the binding
|
||||
* in the most dynamic case. This is because the data model in use should determine
|
||||
* the type needed, and users would generally use bindings for this.
|
||||
*
|
||||
* <P>The target is expected to be nominal (naming the operation's noun), and thus is
|
||||
* historically limited to string forms. This op will need to be refactored around
|
||||
* a slightly more flexible API which can allow the target value to be type-variant,
|
||||
* and maybe even structure variant such that all nouns can be passed as named parameters
|
||||
* underneath the type designator.
|
||||
*/
|
||||
public class MilvusGetOpDispenser extends MilvusBaseOpDispenser<GetIdsParam> {
|
||||
|
||||
public MilvusGetOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<GetIdsParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<GetIdsParam.Builder> ebF =
|
||||
l -> GetIdsParam.newBuilder();
|
||||
|
||||
// ebF = l -> ebF.apply(l).withPrimaryIds(MilvusUtils.splitNames(targetF.apply(l)));
|
||||
LongFunction<Object> valueFunc = op.getAsRequiredFunction("primary_ids", Object.class);
|
||||
Object testValue = valueFunc.apply(0L);
|
||||
LongFunction<List<Object>> pidsF;
|
||||
if (testValue instanceof String string) {
|
||||
pidsF = l -> MilvusUtils.splitNames((String) valueFunc.apply(l))
|
||||
.stream().map(s -> (Object) s).toList();
|
||||
} else if (testValue instanceof List) {
|
||||
pidsF = l -> (List<Object>) valueFunc.apply(l);
|
||||
} else {
|
||||
throw new RuntimeException("Invalid type for primary_ids: " + testValue.getClass().getCanonicalName());
|
||||
}
|
||||
|
||||
LongFunction<GetIdsParam.Builder> finalEbF2 = ebF;
|
||||
ebF = l -> finalEbF2.apply(l).withPrimaryIds(pidsF.apply(l));
|
||||
|
||||
ebF = op.enhanceFuncOptionally(ebF, "collection_name", String.class, GetIdsParam.Builder::withCollectionName);
|
||||
ebF = op.enhanceEnumOptionally(ebF, "consistency_level", ConsistencyLevelEnum.class,
|
||||
GetIdsParam.Builder::withConsistencyLevel);
|
||||
|
||||
if (op.isDefined("output_fields")) {
|
||||
LongFunction<Object> outputFieldsF = op.getAsRequiredFunction("output_fields", Object.class);
|
||||
Object oftv = outputFieldsF.apply(0L);
|
||||
LongFunction<List> ofF;
|
||||
if (oftv instanceof List) {
|
||||
ofF = op.getAsRequiredFunction("output_fields", List.class);
|
||||
LongFunction<GetIdsParam.Builder> finalEbF = ebF;
|
||||
ebF = l -> finalEbF.apply(l).withOutputFields((List<String>) ofF.apply(l));
|
||||
} else if (oftv instanceof String) {
|
||||
var sF = op.getAsRequiredFunction("output_fields", String.class);
|
||||
LongFunction<GetIdsParam.Builder> finalEbF1 = ebF;
|
||||
ebF = l -> finalEbF1.apply(l).withOutputFields(MilvusUtils.splitNames(sF.apply(l)));
|
||||
} else throw new RuntimeException("Invalid type for output fields:" + oftv.getClass().getCanonicalName());
|
||||
}
|
||||
|
||||
final LongFunction<GetIdsParam.Builder> lastF = ebF;
|
||||
final LongFunction<GetIdsParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<GetIdsParam>> createOpFunc(
|
||||
LongFunction<GetIdsParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusGetOp(clientF.apply(l), paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.partition.GetPartitionStatisticsParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusGetPartitionStatisticsOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusGetPartitionStatisticsOpDispenser extends MilvusBaseOpDispenser<GetPartitionStatisticsParam> {
|
||||
|
||||
public MilvusGetPartitionStatisticsOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<GetPartitionStatisticsParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<GetPartitionStatisticsParam.Builder> ebF =
|
||||
l -> GetPartitionStatisticsParam.newBuilder().withPartitionName(targetF.apply(l));
|
||||
ebF = op.enhanceFuncOptionally(ebF,"collection_name",String.class,GetPartitionStatisticsParam.Builder::withCollectionName);
|
||||
ebF = op.enhanceFuncOptionally(ebF, "flush",Boolean.class, GetPartitionStatisticsParam.Builder::withFlush);
|
||||
|
||||
final LongFunction<GetPartitionStatisticsParam.Builder> lastF = ebF;
|
||||
final LongFunction<GetPartitionStatisticsParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<GetPartitionStatisticsParam>> createOpFunc(
|
||||
LongFunction<GetPartitionStatisticsParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusGetPartitionStatisticsOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.partition.GetPartitionStatisticsParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusGetPartitionStatisticsOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusGetPersistentSegmentInfoOpDispenser extends MilvusBaseOpDispenser<GetPartitionStatisticsParam> {
|
||||
|
||||
public MilvusGetPersistentSegmentInfoOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<GetPartitionStatisticsParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<GetPartitionStatisticsParam.Builder> ebF =
|
||||
l -> GetPartitionStatisticsParam.newBuilder().withPartitionName(targetF.apply(l));
|
||||
|
||||
ebF = op.enhanceFuncOptionally(ebF,"flush",Boolean.class,GetPartitionStatisticsParam.Builder::withFlush);
|
||||
ebF = op.enhanceFuncOptionally(ebF,"collection_name",String.class,GetPartitionStatisticsParam.Builder::withCollectionName);
|
||||
|
||||
final LongFunction<GetPartitionStatisticsParam.Builder> lastF = ebF;
|
||||
final LongFunction<GetPartitionStatisticsParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<GetPartitionStatisticsParam>> createOpFunc(
|
||||
LongFunction<GetPartitionStatisticsParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusGetPartitionStatisticsOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.control.GetQuerySegmentInfoParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusGetQuerySegmentInfoOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusGetQuerySegmentInfoOpDispenser extends MilvusBaseOpDispenser<GetQuerySegmentInfoParam> {
|
||||
|
||||
public MilvusGetQuerySegmentInfoOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<GetQuerySegmentInfoParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<GetQuerySegmentInfoParam.Builder> ebF =
|
||||
l -> GetQuerySegmentInfoParam.newBuilder().withCollectionName(targetF.apply(l));
|
||||
|
||||
final LongFunction<GetQuerySegmentInfoParam.Builder> lastF = ebF;
|
||||
final LongFunction<GetQuerySegmentInfoParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<GetQuerySegmentInfoParam>> createOpFunc(
|
||||
LongFunction<GetQuerySegmentInfoParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusGetQuerySegmentInfoOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.control.GetReplicasParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusGetReplicasOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusGetReplicasOpDispenser extends MilvusBaseOpDispenser<GetReplicasParam> {
|
||||
|
||||
public MilvusGetReplicasOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<GetReplicasParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<GetReplicasParam.Builder> ebF =
|
||||
l -> GetReplicasParam.newBuilder().withCollectionName(targetF.apply(l));
|
||||
final LongFunction<GetReplicasParam.Builder> lastF = ebF;
|
||||
final LongFunction<GetReplicasParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<GetReplicasParam>> createOpFunc(
|
||||
LongFunction<GetReplicasParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusGetReplicasOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.partition.HasPartitionParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusHasPartitionOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusHasPartitionOpDispenser extends MilvusBaseOpDispenser<HasPartitionParam> {
|
||||
|
||||
public MilvusHasPartitionOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<HasPartitionParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<HasPartitionParam.Builder> ebF =
|
||||
l -> HasPartitionParam.newBuilder().withPartitionName(targetF.apply(l));
|
||||
ebF = op.enhanceFuncOptionally(ebF,"collection_name",String.class,HasPartitionParam.Builder::withCollectionName);
|
||||
|
||||
final LongFunction<HasPartitionParam.Builder> lastF = ebF;
|
||||
final LongFunction<HasPartitionParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<HasPartitionParam>> createOpFunc(
|
||||
LongFunction<HasPartitionParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusHasPartitionOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.dml.InsertParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusInsertOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@ -32,11 +33,11 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusInsertOpDispenser extends MilvusOpDispenser {
|
||||
public class MilvusInsertOpDispenser extends MilvusBaseOpDispenser<InsertParam> {
|
||||
private static final Logger logger = LogManager.getLogger(MilvusInsertOpDispenser.class);
|
||||
|
||||
/**
|
||||
* Create a new MilvusDeleteOpDispenser subclassed from {@link MilvusOpDispenser}.
|
||||
* Create a new MilvusDeleteOpDispenser subclassed from {@link MilvusBaseOpDispenser}.
|
||||
*
|
||||
* @param adapter The associated {@link MilvusDriverAdapter}
|
||||
* @param op The {@link ParsedOp} encapsulating the activity for this cycle
|
||||
@ -49,12 +50,7 @@ public class MilvusInsertOpDispenser extends MilvusOpDispenser {
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusInsertOp> createOpFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
|
||||
public LongFunction<InsertParam> getParamFunc(LongFunction<MilvusServiceClient> clientF, ParsedOp op, LongFunction<String> targetF) {
|
||||
LongFunction<InsertParam.Builder> f =
|
||||
l -> InsertParam.newBuilder().withCollectionName(targetF.apply(l));
|
||||
f = op.enhanceFuncOptionally(f, "partition", String.class, InsertParam.Builder::withPartitionName);
|
||||
@ -68,11 +64,19 @@ public class MilvusInsertOpDispenser extends MilvusOpDispenser {
|
||||
LongFunction<InsertParam.Builder> finalF1 = f;
|
||||
LongFunction<List<InsertParam.Field>> fieldsF = createFieldsF(op);
|
||||
LongFunction<InsertParam> insertParamsF = l -> finalF1.apply(l).withFields(fieldsF.apply(l)).build();
|
||||
LongFunction<MilvusInsertOp> insertOpF = l -> new MilvusInsertOp(clientF.apply(l), insertParamsF.apply(l));
|
||||
return insertOpF;
|
||||
|
||||
return insertParamsF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<InsertParam>> createOpFunc(
|
||||
LongFunction<InsertParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op, LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusInsertOp(clientF.apply(l), paramF.apply(l));
|
||||
}
|
||||
|
||||
|
||||
private LongFunction<List<InsertParam.Field>> createFieldsF(ParsedOp op) {
|
||||
LongFunction<Map> fieldDataF = op.getAsRequiredFunction("fields", Map.class);
|
||||
LongFunction<List<InsertParam.Field>> fieldsF = l -> {
|
||||
|
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.bulkinsert.ListBulkInsertTasksParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusListBulkInsertTasksOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusListBulkInsertTasksOpDispenser extends MilvusBaseOpDispenser<ListBulkInsertTasksParam> {
|
||||
|
||||
public MilvusListBulkInsertTasksOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<ListBulkInsertTasksParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<ListBulkInsertTasksParam.Builder> ebF =
|
||||
l -> ListBulkInsertTasksParam.newBuilder().withCollectionName(targetF.apply(l));
|
||||
ebF = op.enhanceFuncOptionally(ebF,"limit",Integer.class,ListBulkInsertTasksParam.Builder::withLimit);
|
||||
|
||||
final LongFunction<ListBulkInsertTasksParam.Builder> lastF = ebF;
|
||||
final LongFunction<ListBulkInsertTasksParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<ListBulkInsertTasksParam>> createOpFunc(
|
||||
LongFunction<ListBulkInsertTasksParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusListBulkInsertTasksOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.highlevel.collection.ListCollectionsParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusListCollectionsOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusListCollectionsOpDispenser extends MilvusBaseOpDispenser<ListCollectionsParam> {
|
||||
|
||||
public MilvusListCollectionsOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<ListCollectionsParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> ListCollectionsParam.newBuilder().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<ListCollectionsParam>> createOpFunc(
|
||||
LongFunction<ListCollectionsParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusListCollectionsOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.credential.ListCredUsersParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusListCredUsersOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusListCredUsersOpDispenser extends MilvusBaseOpDispenser<ListCredUsersParam> {
|
||||
|
||||
public MilvusListCredUsersOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<ListCredUsersParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> ListCredUsersParam.newBuilder().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<ListCredUsersParam>> createOpFunc(
|
||||
LongFunction<ListCredUsersParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusListCredUsersOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusListDatabasesOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusListDatabasesOpDispenser extends MilvusBaseOpDispenser<Object> {
|
||||
|
||||
public MilvusListDatabasesOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<Object> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<Object>> createOpFunc(LongFunction<Object> paramF, LongFunction<MilvusServiceClient> clientF, ParsedOp op, LongFunction<String> targetF) {
|
||||
return l -> new MilvusListDatabasesOp(clientF.apply(l),null);
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.control.LoadBalanceParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.MilvusUtils;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusLoadBalanceOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusLoadBalanceOpDispenser extends MilvusBaseOpDispenser<LoadBalanceParam> {
|
||||
|
||||
public MilvusLoadBalanceOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<LoadBalanceParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<LoadBalanceParam.Builder> ebF =
|
||||
l -> LoadBalanceParam.newBuilder();
|
||||
LongFunction<String> segmentsStringF = op.getAsRequiredFunction("segment_ids");
|
||||
// ebF = l -> ebF.apply(l).withSegmentIDs(MilvusUtils.splitLongs(segmentsStringF.apply(l)));
|
||||
|
||||
throw new RuntimeException("implement me");
|
||||
// todo: implement me
|
||||
|
||||
// final LongFunction<LoadBalanceParam.Builder> lastF = ebF;
|
||||
// final LongFunction<LoadBalanceParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
// return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<LoadBalanceParam>> createOpFunc(
|
||||
LongFunction<LoadBalanceParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusLoadBalanceOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.collection.LoadCollectionParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusLoadCollectionOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusLoadCollectionOpDispenser extends MilvusBaseOpDispenser<LoadCollectionParam> {
|
||||
|
||||
public MilvusLoadCollectionOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<LoadCollectionParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<LoadCollectionParam.Builder> ebF =
|
||||
l -> LoadCollectionParam.newBuilder().withCollectionName(targetF.apply(l));
|
||||
|
||||
ebF = op.enhanceFuncOptionally(ebF,"database_name",String.class,LoadCollectionParam.Builder::withDatabaseName);
|
||||
|
||||
ebF = op.enhanceFuncOptionally(ebF,"refresh",Boolean.class,LoadCollectionParam.Builder::withRefresh);
|
||||
ebF = op.enhanceFuncOptionally(ebF,"sync_load",Boolean.class,LoadCollectionParam.Builder::withSyncLoad);
|
||||
ebF = op.enhanceFuncOptionally(ebF,"replica_number",Integer.class,LoadCollectionParam.Builder::withReplicaNumber);
|
||||
ebF = op.enhanceFuncOptionally(ebF,"resource_groups", List.class,LoadCollectionParam.Builder::withResourceGroups);
|
||||
ebF = op.enhanceFuncOptionally(ebF,"sync_load_waiting_interval",Long.class,LoadCollectionParam.Builder::withSyncLoadWaitingInterval);
|
||||
ebF = op.enhanceFuncOptionally(ebF,"sync_load_waiting_timeout",Long.class,
|
||||
LoadCollectionParam.Builder::withSyncLoadWaitingTimeout);
|
||||
|
||||
final LongFunction<LoadCollectionParam.Builder> lastF = ebF;
|
||||
final LongFunction<LoadCollectionParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<LoadCollectionParam>> createOpFunc(
|
||||
LongFunction<LoadCollectionParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusLoadCollectionOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.partition.LoadPartitionsParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusLoadPartitionsOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusLoadPartitionsOpDispenser extends MilvusBaseOpDispenser<LoadPartitionsParam> {
|
||||
|
||||
/**
|
||||
* TODO: Refactor this class after API refinements for more type and target variation
|
||||
*
|
||||
* @param adapter
|
||||
* @param op
|
||||
* @param targetFunction
|
||||
*/
|
||||
public MilvusLoadPartitionsOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<LoadPartitionsParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<LoadPartitionsParam.Builder> ebF =
|
||||
l -> LoadPartitionsParam.newBuilder().withCollectionName(targetF.apply(l));
|
||||
|
||||
ebF = op.enhanceFunc(ebF, "partition_names", List.class, LoadPartitionsParam.Builder::withPartitionNames);
|
||||
ebF = op.enhanceFuncOptionally(ebF, "resource_groups", List.class, LoadPartitionsParam.Builder::withResourceGroups);
|
||||
ebF = op.enhanceFuncOptionally(ebF, "database_name", String.class, LoadPartitionsParam.Builder::withDatabaseName);
|
||||
ebF = op.enhanceFuncOptionally(ebF, "refresh", Boolean.class, LoadPartitionsParam.Builder::withRefresh);
|
||||
ebF = op.enhanceFuncOptionally(ebF, "database_name", String.class, LoadPartitionsParam.Builder::withDatabaseName);
|
||||
ebF = op.enhanceFuncOptionally(ebF, "replica_number", Integer.class, LoadPartitionsParam.Builder::withReplicaNumber);
|
||||
ebF = op.enhanceFuncOptionally(ebF,"sync_load",Boolean.class,LoadPartitionsParam.Builder::withSyncLoad);
|
||||
ebF = op.enhanceFuncOptionally(ebF,"sync_load_waiting_interval",Long.class,LoadPartitionsParam.Builder::withSyncLoadWaitingInterval);
|
||||
ebF = op.enhanceFuncOptionally(ebF,"sync_load_waiting_timeout",Long.class,
|
||||
LoadPartitionsParam.Builder::withSyncLoadWaitingTimeout);
|
||||
|
||||
final LongFunction<LoadPartitionsParam.Builder> lastF = ebF;
|
||||
final LongFunction<LoadPartitionsParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<LoadPartitionsParam>> createOpFunc(
|
||||
LongFunction<LoadPartitionsParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusLoadPartitionsOp(clientF.apply(l), paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.collection.GetLoadingProgressParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusGetLoadingProgressOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusLoadingProgressOpDispenser extends MilvusBaseOpDispenser<GetLoadingProgressParam> {
|
||||
|
||||
public MilvusLoadingProgressOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<GetLoadingProgressParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<GetLoadingProgressParam.Builder> ebF =
|
||||
l -> GetLoadingProgressParam.newBuilder().withCollectionName(targetF.apply(l));
|
||||
ebF = op.enhanceFuncOptionally(ebF,"partition_names", List.class,GetLoadingProgressParam.Builder::withPartitionNames);
|
||||
|
||||
final LongFunction<GetLoadingProgressParam.Builder> lastF = ebF;
|
||||
final LongFunction<GetLoadingProgressParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<GetLoadingProgressParam>> createOpFunc(
|
||||
LongFunction<GetLoadingProgressParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusGetLoadingProgressOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.control.ManualCompactParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusManualCompactOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusManualCompactOpDispenser extends MilvusBaseOpDispenser<ManualCompactParam> {
|
||||
|
||||
public MilvusManualCompactOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<ManualCompactParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<ManualCompactParam.Builder> ebF =
|
||||
l -> ManualCompactParam.newBuilder().withCollectionName(targetF.apply(l));
|
||||
final LongFunction<ManualCompactParam.Builder> lastF = ebF;
|
||||
final LongFunction<ManualCompactParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<ManualCompactParam>> createOpFunc(
|
||||
LongFunction<ManualCompactParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusManualCompactOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.common.clientenum.ConsistencyLevelEnum;
|
||||
import io.milvus.param.dml.QueryParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusQueryOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusQueryOpDispenser extends MilvusBaseOpDispenser<QueryParam> {
|
||||
|
||||
public MilvusQueryOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<QueryParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<QueryParam.Builder> ebF =
|
||||
l -> QueryParam.newBuilder().withCollectionName(targetF.apply(l));
|
||||
|
||||
ebF = op.enhanceFuncOptionally(ebF,"partition_names", List.class,QueryParam.Builder::withPartitionNames);
|
||||
ebF = op.enhanceEnumOptionally(ebF,"consistency_level", ConsistencyLevelEnum.class, QueryParam.Builder::withConsistencyLevel);
|
||||
ebF = op.enhanceFuncOptionally(ebF,"expr",String.class,QueryParam.Builder::withExpr);
|
||||
ebF = op.enhanceFuncOptionally(ebF,"limit",Long.class,QueryParam.Builder::withLimit);
|
||||
ebF = op.enhanceFuncOptionally(ebF,"offset",Long.class,QueryParam.Builder::withOffset);
|
||||
ebF = op.enhanceFuncOptionally(ebF,"ignore_growing",Boolean.class,QueryParam.Builder::withIgnoreGrowing);
|
||||
ebF = op.enhanceFuncOptionally(ebF,"out_fields",List.class,QueryParam.Builder::withOutFields);
|
||||
|
||||
final LongFunction<QueryParam.Builder> lastF = ebF;
|
||||
final LongFunction<QueryParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<QueryParam>> createOpFunc(
|
||||
LongFunction<QueryParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusQueryOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.collection.ReleaseCollectionParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusReleaseCollectionOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusReleaseCollectionOpDispenser extends MilvusBaseOpDispenser<ReleaseCollectionParam> {
|
||||
|
||||
public MilvusReleaseCollectionOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<ReleaseCollectionParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<ReleaseCollectionParam.Builder> ebF =
|
||||
l -> ReleaseCollectionParam.newBuilder().withCollectionName(targetF.apply(l));
|
||||
|
||||
final LongFunction<ReleaseCollectionParam.Builder> lastF = ebF;
|
||||
final LongFunction<ReleaseCollectionParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<ReleaseCollectionParam>> createOpFunc(
|
||||
LongFunction<ReleaseCollectionParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusReleaseCollectionOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.partition.ReleasePartitionsParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.MilvusUtils;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusReleasePartitionsOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusReleasePartitionsOpDispenser extends MilvusBaseOpDispenser<ReleasePartitionsParam> {
|
||||
|
||||
public MilvusReleasePartitionsOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<ReleasePartitionsParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<ReleasePartitionsParam.Builder> ebF =
|
||||
l -> ReleasePartitionsParam.newBuilder();
|
||||
LongFunction<List<String>> partNamesF = l -> MilvusUtils.splitNames(targetF.apply(l));
|
||||
|
||||
LongFunction<ReleasePartitionsParam.Builder> finalEbF = ebF;
|
||||
ebF = l -> finalEbF.apply(l).withPartitionNames(partNamesF.apply(l));
|
||||
ebF = op.enhanceFuncOptionally(ebF,"collection_name",String.class,ReleasePartitionsParam.Builder::withCollectionName);
|
||||
|
||||
final LongFunction<ReleasePartitionsParam.Builder> lastF = ebF;
|
||||
final LongFunction<ReleasePartitionsParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<ReleasePartitionsParam>> createOpFunc(
|
||||
LongFunction<ReleasePartitionsParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusReleasePartitionsOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -21,6 +21,7 @@ import io.milvus.common.clientenum.ConsistencyLevelEnum;
|
||||
import io.milvus.param.MetricType;
|
||||
import io.milvus.param.dml.SearchParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusSearchOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@ -31,16 +32,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusSearchOpDispenser extends MilvusOpDispenser {
|
||||
private static final Logger logger = LogManager.getLogger(MilvusSearchOpDispenser.class);
|
||||
|
||||
/**
|
||||
* Create a new {@ link MilvusSearchOpDispenser} subclassed from {@link MilvusOpDispenser}.
|
||||
*
|
||||
* @param adapter The associated {@link MilvusDriverAdapter}
|
||||
* @param op The {@link ParsedOp} encapsulating the activity for this cycle
|
||||
* @param targetFunction A LongFunction that returns the specified Milvus Index for this Op
|
||||
*/
|
||||
public class MilvusSearchOpDispenser extends MilvusBaseOpDispenser<SearchParam> {
|
||||
public MilvusSearchOpDispenser(
|
||||
MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
@ -49,104 +41,37 @@ public class MilvusSearchOpDispenser extends MilvusOpDispenser {
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusSearchOp> createOpFunc(
|
||||
public LongFunction<SearchParam> getParamFunc(LongFunction<MilvusServiceClient> clientF, ParsedOp op, LongFunction<String> targetF) {
|
||||
|
||||
|
||||
LongFunction<SearchParam.Builder> ebF =
|
||||
l -> SearchParam.newBuilder().withCollectionName(targetF.apply(l));
|
||||
|
||||
ebF = op.enhanceFuncOptionally(ebF,"partition_names",List.class,SearchParam.Builder::withPartitionNames);
|
||||
ebF = op.enhanceFuncOptionally(ebF,"out_fields",List.class,SearchParam.Builder::withOutFields);
|
||||
|
||||
|
||||
ebF = op.enhanceEnumOptionally(ebF, "consistency_level", ConsistencyLevelEnum.class, SearchParam.Builder::withConsistencyLevel);
|
||||
ebF = op.enhanceFuncOptionally(ebF, "expr", String.class, SearchParam.Builder::withExpr);
|
||||
ebF = op.enhanceDefaultFunc(ebF, "top_k", Integer.class, 100, SearchParam.Builder::withTopK);
|
||||
ebF = op.enhanceEnumOptionally(ebF, "metric_type", MetricType.class, SearchParam.Builder::withMetricType);
|
||||
ebF = op.enhanceFuncOptionally(ebF, "round_decimal", Integer.class, SearchParam.Builder::withRoundDecimal);
|
||||
ebF = op.enhanceFuncOptionally(ebF, "ignore_growing", Boolean.class, SearchParam.Builder::withIgnoreGrowing);
|
||||
ebF = op.enhanceFuncOptionally(ebF, "params", String.class, SearchParam.Builder::withParams);
|
||||
ebF = op.enhanceFunc(ebF, "vector_field_name", String.class, SearchParam.Builder::withVectorFieldName);
|
||||
ebF = op.enhanceFuncOptionally(ebF,"vectors",List.class,SearchParam.Builder::withVectors);
|
||||
LongFunction<SearchParam.Builder> finalEbF = ebF;
|
||||
return l -> finalEbF.apply(l).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<SearchParam>> createOpFunc(
|
||||
LongFunction<SearchParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF) {
|
||||
LongFunction<SearchParam.Builder> f =
|
||||
l -> SearchParam.newBuilder().withCollectionName(targetF.apply(l));
|
||||
f = op.enhanceFuncOptionally(f, "partition_name", String.class, SearchParam.Builder::addPartitionName);
|
||||
if(op.isDefined("partition_names", List.class)) {
|
||||
LongFunction<List<String>> partitionNamesF = createPartitionNamesF(op);
|
||||
LongFunction<SearchParam.Builder> finalF = f;
|
||||
f = l -> finalF.apply(l).withPartitionNames(partitionNamesF.apply(l));
|
||||
f = op.enhanceFuncOptionally(f, "partition_names", List.class, SearchParam.Builder::withPartitionNames);
|
||||
}
|
||||
f = op.enhanceFuncOptionally(f, "out_field", String.class, SearchParam.Builder::addOutField);
|
||||
if(op.isDefined("out_fields", List.class)) {
|
||||
LongFunction<List<String>> outFieldsF = createOutFieldsF(op);
|
||||
LongFunction<SearchParam.Builder> finalF1 = f;
|
||||
f = l -> finalF1.apply(l).withOutFields(outFieldsF.apply(l));
|
||||
}
|
||||
|
||||
f = op.enhanceEnumOptionally(f, "consistency_level", ConsistencyLevelEnum.class, SearchParam.Builder::withConsistencyLevel);
|
||||
f = op.enhanceFuncOptionally(f, "expr", String.class, SearchParam.Builder::withExpr);
|
||||
f = op.enhanceDefaultFunc(f, "top_k", Integer.class, 100, SearchParam.Builder::withTopK);
|
||||
f = op.enhanceDefaultFunc(f, "metric_type", MetricType.class, MetricType.COSINE, SearchParam.Builder::withMetricType);
|
||||
f = op.enhanceFuncOptionally(f, "round_decimal", Integer.class, SearchParam.Builder::withRoundDecimal);
|
||||
f = op.enhanceFuncOptionally(f, "ignore_growing", Boolean.class, SearchParam.Builder::withIgnoreGrowing);
|
||||
f = op.enhanceFuncOptionally(f, "params", String.class, SearchParam.Builder::withParams);
|
||||
|
||||
f = op.enhanceFunc(f, "vector_field_name", String.class, SearchParam.Builder::withVectorFieldName);
|
||||
LongFunction<List<?>> queryVectorsF = createQueryVectorsF(op);
|
||||
LongFunction<SearchParam.Builder> finalF2 = f;
|
||||
f = l -> finalF2.apply(l).withVectors(queryVectorsF.apply(l));
|
||||
|
||||
LongFunction<SearchParam.Builder> searchParamsF = f;
|
||||
LongFunction<MilvusSearchOp> searchOpF = l -> new MilvusSearchOp(clientF.apply(l), searchParamsF.apply(l).build());
|
||||
return searchOpF;
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusSearchOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the {@code query_vectors} parameter list for the search operation.
|
||||
* @param op {@link ParsedOp}
|
||||
* @return {@link LongFunction<List<?>>}
|
||||
*/
|
||||
private LongFunction<List<?>> createQueryVectorsF(ParsedOp op) {
|
||||
LongFunction<Map> outVectorF = op.getAsRequiredFunction("vectors", Map.class);
|
||||
LongFunction<List<?>> outFieldsListF = l -> {
|
||||
Map<String, Object> fieldmap = outVectorF.apply(l);
|
||||
//List<?> floatVectorList = new ArrayList<Float>();
|
||||
//List<?> byteBufferVectorList = new ArrayList<>();
|
||||
List<Object> finalVectorList = new ArrayList<>();
|
||||
fieldmap.forEach((name, value) -> {
|
||||
// TODO - validate if we really need to do these type checking here or let the DB barf at us if we
|
||||
// use it otherwise https://milvus.io/api-reference/java/v2.3.x/Query%20and%20Search/search().md
|
||||
// if(value instanceof Float) {
|
||||
// floatVectorList.add((Float) value);
|
||||
// } else {
|
||||
// byteBufferVectorList.add((ByteBuffer) value);
|
||||
// }
|
||||
finalVectorList.add(value);
|
||||
});
|
||||
return finalVectorList;
|
||||
};
|
||||
return outFieldsListF;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the {@code out_fields} parameter list for the search operation.
|
||||
* @param op {@link ParsedOp}
|
||||
* @return {@link LongFunction<List<String>>}
|
||||
*/
|
||||
private LongFunction<List<String>> createOutFieldsF(ParsedOp op) {
|
||||
LongFunction<Map> outFieldDataF = op.getAsRequiredFunction("out_fields", Map.class);
|
||||
LongFunction<List<String>> outFieldsListF = l -> {
|
||||
Map<String, Object> fieldmap = outFieldDataF.apply(l);
|
||||
List<String> fields = new ArrayList<>();
|
||||
fieldmap.forEach((name, value) -> {
|
||||
fields.add(String.valueOf(value));
|
||||
});
|
||||
return fields;
|
||||
};
|
||||
return outFieldsListF;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the {@code partition_names} parameter list for the search operation.
|
||||
* @param op {@link ParsedOp}
|
||||
* @return {@link LongFunction<List<String>>}
|
||||
*/
|
||||
private LongFunction<List<String>> createPartitionNamesF(ParsedOp op) {
|
||||
LongFunction<Map> partitionNamesDataF = op.getAsRequiredFunction("partition_names", Map.class);
|
||||
LongFunction<List<String>> partitionNamesListF = l -> {
|
||||
Map<String, Object> fieldmap = partitionNamesDataF.apply(l);
|
||||
List<String> fields = new ArrayList<>();
|
||||
fieldmap.forEach((name, value) -> {
|
||||
fields.add(String.valueOf(value));
|
||||
});
|
||||
return fields;
|
||||
};
|
||||
return partitionNamesListF;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.grpc.ShowType;
|
||||
import io.milvus.param.collection.ShowCollectionsParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.MilvusUtils;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusShowCollectionsOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusShowCollectionsOpDispenser extends MilvusBaseOpDispenser<ShowCollectionsParam> {
|
||||
|
||||
public MilvusShowCollectionsOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<ShowCollectionsParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<ShowCollectionsParam.Builder> ebF =
|
||||
l -> ShowCollectionsParam.newBuilder();
|
||||
LongFunction<List<String>> collectionsF = l -> MilvusUtils.splitNames(targetF.apply(l));
|
||||
LongFunction<ShowCollectionsParam.Builder> finalEbF = ebF;
|
||||
ebF = l -> finalEbF.apply(l).withCollectionNames(collectionsF.apply(l));
|
||||
ebF = op.enhanceFuncOptionally(ebF,"database_name",String.class,ShowCollectionsParam.Builder::withDatabaseName);
|
||||
ebF = op.enhanceEnumOptionally(ebF,"show_type", ShowType.class,ShowCollectionsParam.Builder::withShowType);
|
||||
logger.warn(this.getClass().getSimpleName() + " is deprecated, use get_loading_progress instead");
|
||||
|
||||
final LongFunction<ShowCollectionsParam.Builder> lastF = ebF;
|
||||
final LongFunction<ShowCollectionsParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<ShowCollectionsParam>> createOpFunc(
|
||||
LongFunction<ShowCollectionsParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusShowCollectionsOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.collection.ShowCollectionsParam;
|
||||
import io.milvus.param.partition.ShowPartitionsParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.MilvusUtils;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusShowPartitionsOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusShowPartitionsOpDispenser extends MilvusBaseOpDispenser<ShowPartitionsParam> {
|
||||
|
||||
public MilvusShowPartitionsOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<ShowPartitionsParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<ShowPartitionsParam.Builder> ebF =
|
||||
l -> ShowPartitionsParam.newBuilder();
|
||||
|
||||
LongFunction<List<String>> partitionsF = l -> MilvusUtils.splitNames(targetF.apply(l));
|
||||
LongFunction<ShowPartitionsParam.Builder> finalEbF = ebF;
|
||||
ebF = l -> finalEbF.apply(l).withPartitionNames(partitionsF.apply(l));
|
||||
ebF = op.enhanceFuncOptionally(ebF,"collection_name",String.class,ShowPartitionsParam.Builder::withCollectionName);
|
||||
final LongFunction<ShowPartitionsParam.Builder> lastF = ebF;
|
||||
final LongFunction<ShowPartitionsParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<ShowPartitionsParam>> createOpFunc(
|
||||
LongFunction<ShowPartitionsParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusShowPartitionsOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.opdispensers;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.credential.UpdateCredentialParam;
|
||||
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
|
||||
import io.nosqlbench.adapter.milvus.ops.MilvusUpdateCredentialOp;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class MilvusUpdateCredentialOpDispenser extends MilvusBaseOpDispenser<UpdateCredentialParam> {
|
||||
|
||||
public MilvusUpdateCredentialOpDispenser(MilvusDriverAdapter adapter,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetFunction) {
|
||||
super(adapter, op, targetFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<UpdateCredentialParam> getParamFunc(
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
LongFunction<UpdateCredentialParam.Builder> ebF =
|
||||
l -> UpdateCredentialParam.newBuilder().withUsername(targetF.apply(l));
|
||||
ebF = op.enhanceFuncOptionally(ebF,"old_password",String.class,UpdateCredentialParam.Builder::withOldPassword);
|
||||
ebF = op.enhanceFuncOptionally(ebF,"nwe_password",String.class,UpdateCredentialParam.Builder::withNewPassword);
|
||||
|
||||
final LongFunction<UpdateCredentialParam.Builder> lastF = ebF;
|
||||
final LongFunction<UpdateCredentialParam> collectionParamF = l -> lastF.apply(l).build();
|
||||
return collectionParamF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LongFunction<MilvusBaseOp<UpdateCredentialParam>> createOpFunc(
|
||||
LongFunction<UpdateCredentialParam> paramF,
|
||||
LongFunction<MilvusServiceClient> clientF,
|
||||
ParsedOp op,
|
||||
LongFunction<String> targetF
|
||||
) {
|
||||
return l -> new MilvusUpdateCredentialOp(clientF.apply(l),paramF.apply(l));
|
||||
}
|
||||
}
|
@ -19,8 +19,8 @@ package io.nosqlbench.adapter.milvus.ops;
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.alias.AlterAliasParam;
|
||||
|
||||
public class MilvusAlterliasOp extends MilvusBaseOp<AlterAliasParam> {
|
||||
public MilvusAlterliasOp(MilvusServiceClient client, AlterAliasParam request) {
|
||||
public class MilvusAlterAliasOp extends MilvusBaseOp<AlterAliasParam> {
|
||||
public MilvusAlterAliasOp(MilvusServiceClient client, AlterAliasParam request) {
|
||||
super(client, request);
|
||||
}
|
||||
|
@ -17,11 +17,10 @@
|
||||
package io.nosqlbench.adapter.milvus.ops;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.dml.DeleteParam;
|
||||
|
||||
public class MilvusDeleteOp extends MilvusBaseOp<DeleteParam> {
|
||||
public class MilvusDeleteParamOp extends MilvusBaseOp<io.milvus.param.dml.DeleteParam> {
|
||||
|
||||
public MilvusDeleteOp(MilvusServiceClient client, DeleteParam request) {
|
||||
public MilvusDeleteParamOp(MilvusServiceClient client, io.milvus.param.dml.DeleteParam request) {
|
||||
super(client,request);
|
||||
}
|
||||
|
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.ops;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.param.bulkinsert.GetBulkInsertStateParam;
|
||||
import io.milvus.param.collection.GetCollectionStatisticsParam;
|
||||
|
||||
public class MilvusGetBulkInsertStateOp extends MilvusBaseOp<GetBulkInsertStateParam> {
|
||||
public MilvusGetBulkInsertStateOp(MilvusServiceClient client, GetBulkInsertStateParam request) {
|
||||
super(client, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object applyOp(long value) {
|
||||
return client.getBulkInsertState(request);
|
||||
}
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.ops;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.grpc.MutationResult;
|
||||
import io.milvus.grpc.SearchResults;
|
||||
import io.milvus.param.R;
|
||||
import io.milvus.param.dml.InsertParam;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class MilvusInsertAsyncOp extends MilvusBaseOp<InsertParam> {
|
||||
private final long timeout;
|
||||
private final TimeUnit timeUnit;
|
||||
|
||||
public MilvusInsertAsyncOp(MilvusServiceClient client, InsertParam request, long timeout, TimeUnit timeUnit) {
|
||||
super(client, request);
|
||||
this.timeout = timeout;
|
||||
this.timeUnit = timeUnit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object applyOp(long value) {
|
||||
ListenableFuture<R<MutationResult>> call = client.insertAsync(request);
|
||||
try {
|
||||
return call.get(timeout,timeUnit);
|
||||
} catch (Exception e) {
|
||||
if (e instanceof RuntimeException rte) {
|
||||
throw rte;
|
||||
}
|
||||
else throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
@ -18,8 +18,8 @@ package io.nosqlbench.adapter.milvus.ops;
|
||||
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
|
||||
public class MilvusListDatabasesOp extends MilvusBaseOp<Void> {
|
||||
public MilvusListDatabasesOp(MilvusServiceClient client, Void request) {
|
||||
public class MilvusListDatabasesOp extends MilvusBaseOp<Object> {
|
||||
public MilvusListDatabasesOp(MilvusServiceClient client, String request) {
|
||||
super(client, request);
|
||||
}
|
||||
|
||||
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.ops;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.grpc.QueryResults;
|
||||
import io.milvus.grpc.SearchResults;
|
||||
import io.milvus.param.R;
|
||||
import io.milvus.param.dml.QueryParam;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class MilvusQueryAsyncOp extends MilvusBaseOp<QueryParam> {
|
||||
private final long timeout;
|
||||
private final TimeUnit timeUnit;
|
||||
|
||||
public MilvusQueryAsyncOp(MilvusServiceClient client, QueryParam request, long timeout, TimeUnit timeUnit) {
|
||||
super(client, request);
|
||||
|
||||
this.timeout = timeout;
|
||||
this.timeUnit = timeUnit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object applyOp(long value) {
|
||||
ListenableFuture<R<QueryResults>> call = client.queryAsync(request);
|
||||
try {
|
||||
return call.get(timeout,timeUnit);
|
||||
} catch (Exception e) {
|
||||
if (e instanceof RuntimeException rte) {
|
||||
throw rte;
|
||||
}
|
||||
else throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2024 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.nosqlbench.adapter.milvus.ops;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import io.milvus.client.MilvusServiceClient;
|
||||
import io.milvus.grpc.SearchResults;
|
||||
import io.milvus.param.R;
|
||||
import io.milvus.param.dml.SearchParam;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
public class MilvusSearchAsyncOp extends MilvusBaseOp<SearchParam> {
|
||||
|
||||
private final long timeout;
|
||||
private final TimeUnit timeUnit;
|
||||
|
||||
/**
|
||||
* Create a new {@link ParsedOp} encapsulating a call to the Milvus/Zilliz client delete method
|
||||
*
|
||||
* @param client The associated {@link MilvusServiceClient} used to communicate with the database
|
||||
* @param request The {@link SearchParam} built for this operation
|
||||
*/
|
||||
public MilvusSearchAsyncOp(MilvusServiceClient client, SearchParam request, long timeout, TimeUnit timeUnit) {
|
||||
super(client, request);
|
||||
this.timeout = timeout;
|
||||
this.timeUnit = timeUnit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<SearchResults> applyOp(long value) {
|
||||
ListenableFuture<R<SearchResults>> call = client.searchAsync(request);
|
||||
try {
|
||||
return call.get(timeout,timeUnit);
|
||||
} catch (Exception e) {
|
||||
if (e instanceof RuntimeException rte) {
|
||||
throw rte;
|
||||
}
|
||||
else throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
@ -16,11 +16,6 @@
|
||||
|
||||
package io.nosqlbench.adapter.milvus.types;
|
||||
|
||||
import io.milvus.client.MilvusClient;
|
||||
import io.milvus.param.alias.AlterAliasParam;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import static io.nosqlbench.adapter.milvus.types.MilvusOpGroup.*;
|
||||
|
||||
public enum MilvusOpType {
|
||||
@ -47,11 +42,10 @@ public enum MilvusOpType {
|
||||
get_collection_statistics(Collection),
|
||||
get_load_state(Collection),
|
||||
get_loading_progress(Collection),
|
||||
get_persistent_segment(Collection),
|
||||
get_persistent_segment_info(Collection),
|
||||
get_query_segment_info(Collection),
|
||||
get_replicas(Collection),
|
||||
insert(Collection),
|
||||
insert_async(Collection),
|
||||
load_collection(Collection),
|
||||
release_collection(Collection),
|
||||
show_collections(Collection),
|
||||
@ -71,12 +65,6 @@ public enum MilvusOpType {
|
||||
get_metrics(Management),
|
||||
load_balance(Management),
|
||||
manual_compact(Management),
|
||||
consistency_level_enum(Misc),
|
||||
data_type(Misc),
|
||||
index_type(Misc),
|
||||
log_level(Misc),
|
||||
metric_type(Misc),
|
||||
R(Misc),
|
||||
create_partition(Partition),
|
||||
drop_partition(Partition),
|
||||
get_partition_statistics(Partition),
|
||||
@ -85,20 +73,18 @@ public enum MilvusOpType {
|
||||
release_partitions(Partition),
|
||||
show_partitions(Partition),
|
||||
query(QueryAndSearch),
|
||||
query_async(QueryAndSearch),
|
||||
search(QueryAndSearch),
|
||||
search_async(QueryAndSearch),
|
||||
add_user_to_role(RBAC),
|
||||
create_role(RBAC),
|
||||
drop_role(RBAC),
|
||||
grant_role_privilege(RBAC),
|
||||
remove_user_from_role(RBAC),
|
||||
revoke_role_privilege(RBAC),
|
||||
select_grant_for_role(RBAC),
|
||||
select_grant_for_role_and_object(RBAC),
|
||||
select_role(RBAC),
|
||||
select_user(RBAC);
|
||||
|
||||
// add_user_to_role(RBAC),
|
||||
// create_role(RBAC),
|
||||
// drop_role(RBAC),
|
||||
// grant_role_privilege(RBAC),
|
||||
// remove_user_from_role(RBAC),
|
||||
// revoke_role_privilege(RBAC),
|
||||
// select_grant_for_role(RBAC),
|
||||
// select_grant_for_role_and_object(RBAC),
|
||||
// select_role(RBAC),
|
||||
// select_user(RBAC),
|
||||
;
|
||||
private final MilvusOpGroup group;
|
||||
|
||||
MilvusOpType(MilvusOpGroup group) {
|
||||
|
@ -46,7 +46,7 @@ import java.util.concurrent.TimeUnit;
|
||||
* The type of operation
|
||||
*/
|
||||
public abstract class BaseOpDispenser<T extends Op, S> extends NBBaseComponent implements OpDispenser<T>{
|
||||
private final static Logger logger = LogManager.getLogger(BaseOpDispenser.class);
|
||||
protected final static Logger logger = LogManager.getLogger(BaseOpDispenser.class);
|
||||
public static final String VERIFIER = "verifier";
|
||||
public static final String VERIFIER_INIT = "verifier-init";
|
||||
public static final String EXPECTED_RESULT = "expected-result";
|
||||
|
Loading…
Reference in New Issue
Block a user