implement base ops for all milvus API

This commit is contained in:
Jonathan Shook 2024-03-18 15:54:05 -05:00
parent 25353cc4a8
commit fa96682f26
60 changed files with 1685 additions and 76 deletions

View File

@ -16,11 +16,9 @@
package io.nosqlbench.adapter.milvus;
import io.nosqlbench.adapter.milvus.ops.MilvusOp;
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
import io.nosqlbench.adapters.api.activityimpl.uniform.BaseDriverAdapter;
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
import io.nosqlbench.nb.annotations.Service;
import io.nosqlbench.nb.api.components.core.NBComponent;
import io.nosqlbench.nb.api.config.standard.NBConfigModel;
import io.nosqlbench.nb.api.config.standard.NBConfiguration;
@ -28,14 +26,14 @@ import io.nosqlbench.nb.api.labels.NBLabels;
import java.util.function.Function;
public class MilvusDriverAdapter extends BaseDriverAdapter<MilvusOp, MilvusSpace> {
public class MilvusDriverAdapter extends BaseDriverAdapter<MilvusBaseOp, MilvusSpace> {
public MilvusDriverAdapter(NBComponent parentComponent, NBLabels labels) {
super(parentComponent, labels);
}
@Override
public OpMapper<MilvusOp> getOpMapper() {
public OpMapper<MilvusBaseOp> getOpMapper() {
return new MilvusOpMapper(this);
}

View File

@ -17,8 +17,8 @@
package io.nosqlbench.adapter.milvus;
import io.nosqlbench.adapter.milvus.opdispensers.*;
import io.nosqlbench.adapter.milvus.ops.MilvusOp;
import io.nosqlbench.adapter.milvus.ops.MilvusOpTypes;
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
import io.nosqlbench.adapter.milvus.types.MilvusOpType;
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
import io.nosqlbench.adapters.api.templating.ParsedOp;
@ -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<MilvusOp> {
public class MilvusOpMapper implements OpMapper<MilvusBaseOp> {
private static final Logger logger = LogManager.getLogger(MilvusOpMapper.class);
private final MilvusDriverAdapter adapter;
@ -46,9 +46,9 @@ public class MilvusOpMapper implements OpMapper<MilvusOp> {
* @return The correct {@link MilvusOpDispenser} subclass based on the op type
*/
@Override
public OpDispenser<? extends MilvusOp> apply(ParsedOp op) {
TypeAndTarget<MilvusOpTypes, String> typeAndTarget = op.getTypeAndTarget(
MilvusOpTypes.class,
public OpDispenser<? extends MilvusBaseOp> apply(ParsedOp op) {
TypeAndTarget<MilvusOpType, String> typeAndTarget = op.getTypeAndTarget(
MilvusOpType.class,
String.class,
"type",
"target"

View File

@ -19,17 +19,17 @@ package io.nosqlbench.adapter.milvus.opdispensers;
import io.milvus.client.MilvusServiceClient;
import io.nosqlbench.adapter.milvus.MilvusDriverAdapter;
import io.nosqlbench.adapter.milvus.MilvusSpace;
import io.nosqlbench.adapter.milvus.ops.MilvusOp;
import io.nosqlbench.adapter.milvus.ops.MilvusBaseOp;
import io.nosqlbench.adapters.api.activityimpl.BaseOpDispenser;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import java.util.function.LongFunction;
public abstract class MilvusOpDispenser extends BaseOpDispenser<MilvusOp, MilvusSpace> {
public abstract class MilvusOpDispenser extends BaseOpDispenser<MilvusBaseOp, MilvusSpace> {
protected final LongFunction<MilvusSpace> mzSpaceFunction;
protected final LongFunction<MilvusServiceClient> clientFunction;
private final LongFunction<? extends MilvusOp> opF;
private final LongFunction<? extends MilvusBaseOp> opF;
protected MilvusOpDispenser(MilvusDriverAdapter adapter, ParsedOp op, LongFunction<String> targetF) {
super(adapter, op);
@ -38,14 +38,14 @@ public abstract class MilvusOpDispenser extends BaseOpDispenser<MilvusOp, Milvus
this.opF = createOpFunc(this.clientFunction, op, targetF);
}
public abstract LongFunction<? extends MilvusOp> createOpFunc(
public abstract LongFunction<? extends MilvusBaseOp> createOpFunc(
LongFunction<MilvusServiceClient> clientF,
ParsedOp op,
LongFunction<String> targetF
);
@Override
public MilvusOp apply(long value) {
public MilvusBaseOp apply(long value) {
return opF.apply(value);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 nosqlbench
* 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.
@ -16,33 +16,16 @@
package io.nosqlbench.adapter.milvus.ops;
public enum MilvusOpTypes {
drop_collection,
create_index,
import io.milvus.client.MilvusServiceClient;
import io.milvus.param.collection.AlterCollectionParam;
drop_index,
insert,
// update,
search,
delete,
public class MilvusAlterCollectionOp extends MilvusBaseOp<AlterCollectionParam> {
public MilvusAlterCollectionOp(MilvusServiceClient client, AlterCollectionParam request) {
super(client, request);
}
// alter_alias,
// create_alias,
// drop_alias,
// create_credential,
// delete_credential,
// list_cred_users,
// update_credential,
// bulk_insert,
// get_bulk_insert_state,
// list_bulk_insert_tasks,
create_collection,
// alter_collection,
// describe_collection,
// upsert,
// describeindexstats,
// fetch
@Override
public Object applyOp(long value) {
return client.alterCollection(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.alias.AlterAliasParam;
public class MilvusAlterliasOp extends MilvusBaseOp<AlterAliasParam> {
public MilvusAlterliasOp(MilvusServiceClient client, AlterAliasParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.alterAlias(request);
}
}

View File

@ -21,16 +21,27 @@ import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.CycleOp;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public abstract class MilvusOp<T> implements CycleOp<Object> {
import java.util.function.Function;
import java.util.function.LongFunction;
protected final static Logger logger = LogManager.getLogger(MilvusOp.class);
public abstract class MilvusBaseOp<T> implements CycleOp<Object> {
protected final static Logger logger = LogManager.getLogger(MilvusBaseOp.class);
protected final MilvusServiceClient client;
protected final T request;
protected final LongFunction<Object> apiCall;
public MilvusOp(MilvusServiceClient client, T requestParam) {
public MilvusBaseOp(MilvusServiceClient client, T requestParam) {
this.client = client;
this.request = requestParam;
this.apiCall = this::applyOp;
}
public MilvusBaseOp(MilvusServiceClient client, T requestParam, LongFunction<Object> call) {
this.client = client;
this.request = requestParam;
this.apiCall = call;
}
@Override
@ -49,7 +60,7 @@ public abstract class MilvusOp<T> implements CycleOp<Object> {
}
};
public abstract Object applyOp(long value) throws Exception;
public abstract Object applyOp(long value);
@Override
public String toString() {

View File

@ -0,0 +1,31 @@
/*
* 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.BulkInsertParam;
public class MilvusBulkInsertOp extends MilvusBaseOp<BulkInsertParam> {
public MilvusBulkInsertOp(MilvusServiceClient client, BulkInsertParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.bulkInsert(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.alias.CreateAliasParam;
public class MilvusCreateAliasOp extends MilvusBaseOp<CreateAliasParam> {
public MilvusCreateAliasOp(MilvusServiceClient client, CreateAliasParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.createAlias(request);
}
}

View File

@ -17,14 +17,10 @@
package io.nosqlbench.adapter.milvus.ops;
import io.milvus.client.MilvusServiceClient;
import io.milvus.param.R;
import io.milvus.param.RpcStatus;
import io.milvus.param.collection.CreateCollectionParam;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class MilvusCreateCollectionOp extends MilvusOp<CreateCollectionParam> {
public class MilvusCreateCollectionOp extends MilvusBaseOp<CreateCollectionParam> {
/**
* Create a new {@link ParsedOp} encapsulating a call to the Milvus/Zilliz client delete method
*

View File

@ -0,0 +1,31 @@
/*
* 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.credential.CreateCredentialParam;
public class MilvusCreateCredentialOp extends MilvusBaseOp<CreateCredentialParam> {
public MilvusCreateCredentialOp(MilvusServiceClient client, CreateCredentialParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.createCredential(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.collection.CreateDatabaseParam;
public class MilvusCreateDatabaseOp extends MilvusBaseOp<CreateDatabaseParam> {
public MilvusCreateDatabaseOp(MilvusServiceClient client, CreateDatabaseParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.createDatabase(request);
}
}

View File

@ -17,14 +17,9 @@
package io.nosqlbench.adapter.milvus.ops;
import io.milvus.client.MilvusServiceClient;
import io.milvus.param.R;
import io.milvus.param.RpcStatus;
import io.milvus.param.index.CreateIndexParam;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class MilvusCreateIndexOp extends MilvusOp<CreateIndexParam> {
public class MilvusCreateIndexOp extends MilvusBaseOp<CreateIndexParam> {
public MilvusCreateIndexOp(MilvusServiceClient client, CreateIndexParam request) {
super(client, request);
}

View File

@ -0,0 +1,31 @@
/*
* 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.partition.CreatePartitionParam;
public class MilvusCreatePartitionOp extends MilvusBaseOp<CreatePartitionParam> {
public MilvusCreatePartitionOp(MilvusServiceClient client, CreatePartitionParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.createPartition(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.credential.DeleteCredentialParam;
public class MilvusDeleteCredentialOp extends MilvusBaseOp<DeleteCredentialParam> {
public MilvusDeleteCredentialOp(MilvusServiceClient client, DeleteCredentialParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.deleteCredential(request);
}
}

View File

@ -17,15 +17,9 @@
package io.nosqlbench.adapter.milvus.ops;
import io.milvus.client.MilvusServiceClient;
import io.milvus.grpc.MutationResult;
import io.milvus.param.R;
import io.milvus.param.RpcStatus;
import io.milvus.param.dml.DeleteParam;
import io.milvus.param.index.CreateIndexParam;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class MilvusDeleteOp extends MilvusOp<DeleteParam> {
public class MilvusDeleteOp extends MilvusBaseOp<DeleteParam> {
public MilvusDeleteOp(MilvusServiceClient client, DeleteParam request) {
super(client,request);

View File

@ -0,0 +1,31 @@
/*
* 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.collection.DescribeCollectionParam;
public class MilvusDescribeCollectionOp extends MilvusBaseOp<DescribeCollectionParam> {
public MilvusDescribeCollectionOp(MilvusServiceClient client, DescribeCollectionParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.describeCollection(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.index.DescribeIndexParam;
public class MilvusDescribeIndexOp extends MilvusBaseOp<DescribeIndexParam> {
public MilvusDescribeIndexOp(MilvusServiceClient client, DescribeIndexParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.describeIndex(request);
}
}

View File

@ -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.alias.CreateAliasParam;
import io.milvus.param.alias.DropAliasParam;
public class MilvusDropAliasOp extends MilvusBaseOp<DropAliasParam> {
public MilvusDropAliasOp(MilvusServiceClient client, DropAliasParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.dropAlias(request);
}
}

View File

@ -19,10 +19,8 @@ package io.nosqlbench.adapter.milvus.ops;
import io.milvus.client.MilvusServiceClient;
import io.milvus.param.collection.DropCollectionParam;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class MilvusDropCollectionOp extends MilvusOp<DropCollectionParam> {
public class MilvusDropCollectionOp extends MilvusBaseOp<DropCollectionParam> {
/**
* Create a new {@link ParsedOp} encapsulating a call to the Milvus/Zilliz client delete method
*

View File

@ -0,0 +1,31 @@
/*
* 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.collection.DropDatabaseParam;
public class MilvusDropDatabaseOp extends MilvusBaseOp<DropDatabaseParam> {
public MilvusDropDatabaseOp(MilvusServiceClient client, DropDatabaseParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.dropDatabase(request);
}
}

View File

@ -19,10 +19,8 @@ package io.nosqlbench.adapter.milvus.ops;
import io.milvus.client.MilvusServiceClient;
import io.milvus.param.index.DropIndexParam;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class MilvusDropIndexOp extends MilvusOp<DropIndexParam> {
public class MilvusDropIndexOp extends MilvusBaseOp<DropIndexParam> {
/**
* Create a new {@link ParsedOp} encapsulating a call to the Milvus/Zilliz client delete method
*

View File

@ -0,0 +1,31 @@
/*
* 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.partition.DropPartitionParam;
public class MilvusDropPartitionOp extends MilvusBaseOp<DropPartitionParam> {
public MilvusDropPartitionOp(MilvusServiceClient client, DropPartitionParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.dropPartition(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.collection.FlushParam;
public class MilvusFlushOp extends MilvusBaseOp<FlushParam> {
public MilvusFlushOp(MilvusServiceClient client, FlushParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.flush(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.collection.GetCollectionStatisticsParam;
public class MilvusGetCollectionStatisticsOp extends MilvusBaseOp<GetCollectionStatisticsParam> {
public MilvusGetCollectionStatisticsOp(MilvusServiceClient client, GetCollectionStatisticsParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.getCollectionStatistics(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.control.GetCompactionStateParam;
public class MilvusGetCompactionStateOp extends MilvusBaseOp<GetCompactionStateParam> {
public MilvusGetCompactionStateOp(MilvusServiceClient client, GetCompactionStateParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.getCompactionState(request);
}
}

View File

@ -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.control.GetCompactionPlansParam;
import io.milvus.param.control.GetCompactionStateParam;
public class MilvusGetCompactionStateWithPlansOp extends MilvusBaseOp<GetCompactionPlansParam> {
public MilvusGetCompactionStateWithPlansOp(MilvusServiceClient client, GetCompactionPlansParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.getCompactionStateWithPlans(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.control.GetFlushAllStateParam;
public class MilvusGetFlushAllStateOp extends MilvusBaseOp<GetFlushAllStateParam> {
public MilvusGetFlushAllStateOp(MilvusServiceClient client, GetFlushAllStateParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.getFlushAllState(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.control.GetFlushStateParam;
public class MilvusGetFlushStateOp extends MilvusBaseOp<GetFlushStateParam> {
public MilvusGetFlushStateOp(MilvusServiceClient client, GetFlushStateParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.getFlushState(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.index.GetIndexBuildProgressParam;
public class MilvusGetIndexBuildProgressOp extends MilvusBaseOp<GetIndexBuildProgressParam> {
public MilvusGetIndexBuildProgressOp(MilvusServiceClient client, GetIndexBuildProgressParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.getIndexBuildProgress(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.index.GetIndexStateParam;
public class MilvusGetIndexStateOp extends MilvusBaseOp<GetIndexStateParam> {
public MilvusGetIndexStateOp(MilvusServiceClient client, GetIndexStateParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.getIndexState(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.collection.GetLoadStateParam;
public class MilvusGetLoadStateOp extends MilvusBaseOp<GetLoadStateParam> {
public MilvusGetLoadStateOp(MilvusServiceClient client, GetLoadStateParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.getLoadState(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.collection.GetLoadingProgressParam;
public class MilvusGetLoadingProgressOp extends MilvusBaseOp<GetLoadingProgressParam> {
public MilvusGetLoadingProgressOp(MilvusServiceClient client, GetLoadingProgressParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.getLoadingProgress(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.control.GetMetricsParam;
public class MilvusGetMetricsOp extends MilvusBaseOp<GetMetricsParam> {
public MilvusGetMetricsOp(MilvusServiceClient client, GetMetricsParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.getMetrics(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.highlevel.dml.GetIdsParam;
public class MilvusGetOp extends MilvusBaseOp<GetIdsParam> {
public MilvusGetOp(MilvusServiceClient client, GetIdsParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.get(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.partition.GetPartitionStatisticsParam;
public class MilvusGetPartitionStatisticsOp extends MilvusBaseOp<GetPartitionStatisticsParam> {
public MilvusGetPartitionStatisticsOp(MilvusServiceClient client, GetPartitionStatisticsParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.getPartitionStatistics(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.control.GetQuerySegmentInfoParam;
public class MilvusGetPersistentSegmentInfoOp extends MilvusBaseOp<GetQuerySegmentInfoParam> {
public MilvusGetPersistentSegmentInfoOp(MilvusServiceClient client, GetQuerySegmentInfoParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.getQuerySegmentInfo(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.control.GetQuerySegmentInfoParam;
public class MilvusGetQuerySegmentInfoOp extends MilvusBaseOp<GetQuerySegmentInfoParam> {
public MilvusGetQuerySegmentInfoOp(MilvusServiceClient client, GetQuerySegmentInfoParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.getQuerySegmentInfo(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.control.GetReplicasParam;
public class MilvusGetReplicasOp extends MilvusBaseOp<GetReplicasParam> {
public MilvusGetReplicasOp(MilvusServiceClient client, GetReplicasParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.getReplicas(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.partition.HasPartitionParam;
public class MilvusHasPartitionOp extends MilvusBaseOp<HasPartitionParam> {
public MilvusHasPartitionOp(MilvusServiceClient client, HasPartitionParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.hasPartition(request);
}
}

View File

@ -0,0 +1,50 @@
/*
* 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);
}
}
}

View File

@ -22,7 +22,7 @@ import io.milvus.param.R;
import io.milvus.param.dml.InsertParam;
import io.nosqlbench.adapters.api.templating.ParsedOp;
public class MilvusInsertOp extends MilvusOp<InsertParam> {
public class MilvusInsertOp extends MilvusBaseOp<InsertParam> {
/**
* Create a new {@link ParsedOp} encapsulating a call to the Milvus/Zilliz client delete method

View File

@ -0,0 +1,31 @@
/*
* 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.ListBulkInsertTasksParam;
public class MilvusListBulkInsertTasksOp extends MilvusBaseOp<ListBulkInsertTasksParam> {
public MilvusListBulkInsertTasksOp(MilvusServiceClient client, ListBulkInsertTasksParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.listBulkInsertTasks(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.highlevel.collection.ListCollectionsParam;
public class MilvusListCollectionsOp extends MilvusBaseOp<ListCollectionsParam> {
public MilvusListCollectionsOp(MilvusServiceClient client, ListCollectionsParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.listCollections(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.credential.ListCredUsersParam;
public class MilvusListCredUsersOp extends MilvusBaseOp<ListCredUsersParam> {
public MilvusListCredUsersOp(MilvusServiceClient client, ListCredUsersParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.listCredUsers(request);
}
}

View File

@ -0,0 +1,30 @@
/*
* 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;
public class MilvusListDatabasesOp extends MilvusBaseOp<Void> {
public MilvusListDatabasesOp(MilvusServiceClient client, Void request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.listDatabases();
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.control.LoadBalanceParam;
public class MilvusLoadBalanceOp extends MilvusBaseOp<LoadBalanceParam> {
public MilvusLoadBalanceOp(MilvusServiceClient client, LoadBalanceParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.loadBalance(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.collection.LoadCollectionParam;
public class MilvusLoadCollectionOp extends MilvusBaseOp<LoadCollectionParam> {
public MilvusLoadCollectionOp(MilvusServiceClient client, LoadCollectionParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.loadCollection(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.partition.LoadPartitionsParam;
public class MilvusLoadPartitionsOp extends MilvusBaseOp<LoadPartitionsParam> {
public MilvusLoadPartitionsOp(MilvusServiceClient client, LoadPartitionsParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.loadPartitions(request);
}
}

View File

@ -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.grpc.ManualCompactionRequest;
import io.milvus.param.control.ManualCompactParam;
public class MilvusManualCompactOp extends MilvusBaseOp<ManualCompactParam> {
public MilvusManualCompactOp(MilvusServiceClient client, ManualCompactParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.manualCompact(request);
}
}

View File

@ -0,0 +1,52 @@
/*
* 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);
}
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.dml.QueryParam;
public class MilvusQueryOp extends MilvusBaseOp<QueryParam> {
public MilvusQueryOp(MilvusServiceClient client, QueryParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.query(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.collection.ReleaseCollectionParam;
public class MilvusReleaseCollectionOp extends MilvusBaseOp<ReleaseCollectionParam> {
public MilvusReleaseCollectionOp(MilvusServiceClient client, ReleaseCollectionParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.releaseCollection(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.partition.ReleasePartitionsParam;
public class MilvusReleasePartitionsOp extends MilvusBaseOp<ReleasePartitionsParam> {
public MilvusReleasePartitionsOp(MilvusServiceClient client, ReleasePartitionsParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.releasePartitions(request);
}
}

View File

@ -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.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);
}
}
}

View File

@ -21,10 +21,8 @@ import io.milvus.grpc.SearchResults;
import io.milvus.param.R;
import io.milvus.param.dml.SearchParam;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class MilvusSearchOp extends MilvusOp<SearchParam> {
public class MilvusSearchOp extends MilvusBaseOp<SearchParam> {
/**
* Create a new {@link ParsedOp} encapsulating a call to the Milvus/Zilliz client delete method

View File

@ -0,0 +1,31 @@
/*
* 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.collection.ShowCollectionsParam;
public class MilvusShowCollectionsOp extends MilvusBaseOp<ShowCollectionsParam> {
public MilvusShowCollectionsOp(MilvusServiceClient client, ShowCollectionsParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.showCollections(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.partition.ShowPartitionsParam;
public class MilvusShowPartitionsOp extends MilvusBaseOp<ShowPartitionsParam> {
public MilvusShowPartitionsOp(MilvusServiceClient client, ShowPartitionsParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.showPartitions(request);
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.credential.UpdateCredentialParam;
public class MilvusUpdateCredentialOp extends MilvusBaseOp<UpdateCredentialParam> {
public MilvusUpdateCredentialOp(MilvusServiceClient client, UpdateCredentialParam request) {
super(client, request);
}
@Override
public Object applyOp(long value) {
return client.updateCredential(request);
}
}

View File

@ -0,0 +1,34 @@
/*
* 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.types;
public enum MilvusOpGroup {
Alias,
Authentication,
BulkInsert,
Collection,
Connections,
Database,
HighLevel,
Index,
Management,
Misc,
Partition,
QueryAndSearch,
RBAC
}

View File

@ -0,0 +1,108 @@
/*
* Copyright (c) 2023-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.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 {
alter_alias(Alias),
create_alias(Alias),
drop_alias(Alias),
create_credential(Authentication),
delete_credential(Authentication),
list_cred_users(Authentication),
update_credential(Authentication),
bulk_insert(BulkInsert),
get_bulk_insert_state(BulkInsert),
list_bulk_insert_tasks(BulkInsert),
alter_collection(Collection),
create_collection(Collection),
delete(Collection),
describe_collection(Collection),
drop_collection(Collection),
flush(Collection),
get_collection_statistics(Collection),
get_load_state(Collection),
get_loading_progress(Collection),
get_persistent_segment(Collection),
get_query_segment_info(Collection),
get_replicas(Collection),
insert(Collection),
insert_async(Collection),
load_collection(Collection),
release_collection(Collection),
show_collections(Collection),
create_database(Database),
drop_database(Database),
list_databases(Database),
get(HighLevel),
list_collections(HighLevel),
create_index(Index),
describe_index(Index),
drop_index(Index),
get_index_build_progress(Index),
get_index_state(Index),
get_compaction_state(Management),
get_compaction_state_with_plans(Management),
get_flush_all_state(Management),
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),
has_partition(Partition),
load_partitions(Partition),
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);
private final MilvusOpGroup group;
MilvusOpType(MilvusOpGroup group) {
this.group = group;
}
}