diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/MilvusDriverAdapter.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/MilvusDriverAdapter.java index 00c375f21..40b98c921 100644 --- a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/MilvusDriverAdapter.java +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/MilvusDriverAdapter.java @@ -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 { +public class MilvusDriverAdapter extends BaseDriverAdapter { public MilvusDriverAdapter(NBComponent parentComponent, NBLabels labels) { super(parentComponent, labels); } @Override - public OpMapper getOpMapper() { + public OpMapper getOpMapper() { return new MilvusOpMapper(this); } diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/MilvusOpMapper.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/MilvusOpMapper.java index efdc30f15..67022ea74 100644 --- a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/MilvusOpMapper.java +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/MilvusOpMapper.java @@ -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 { +public class MilvusOpMapper implements OpMapper { private static final Logger logger = LogManager.getLogger(MilvusOpMapper.class); private final MilvusDriverAdapter adapter; @@ -46,9 +46,9 @@ public class MilvusOpMapper implements OpMapper { * @return The correct {@link MilvusOpDispenser} subclass based on the op type */ @Override - public OpDispenser apply(ParsedOp op) { - TypeAndTarget typeAndTarget = op.getTypeAndTarget( - MilvusOpTypes.class, + public OpDispenser apply(ParsedOp op) { + TypeAndTarget typeAndTarget = op.getTypeAndTarget( + MilvusOpType.class, String.class, "type", "target" diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/opdispensers/MilvusOpDispenser.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/opdispensers/MilvusOpDispenser.java index f9d387a16..281187ad4 100644 --- a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/opdispensers/MilvusOpDispenser.java +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/opdispensers/MilvusOpDispenser.java @@ -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 { +public abstract class MilvusOpDispenser extends BaseOpDispenser { protected final LongFunction mzSpaceFunction; protected final LongFunction clientFunction; - private final LongFunction opF; + private final LongFunction opF; protected MilvusOpDispenser(MilvusDriverAdapter adapter, ParsedOp op, LongFunction targetF) { super(adapter, op); @@ -38,14 +38,14 @@ public abstract class MilvusOpDispenser extends BaseOpDispenser createOpFunc( + public abstract LongFunction createOpFunc( LongFunction clientF, ParsedOp op, LongFunction targetF ); @Override - public MilvusOp apply(long value) { + public MilvusBaseOp apply(long value) { return opF.apply(value); } } diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusOpTypes.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusAlterCollectionOp.java similarity index 53% rename from adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusOpTypes.java rename to adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusAlterCollectionOp.java index f0ca71ac8..a5a37aba8 100644 --- a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusOpTypes.java +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusAlterCollectionOp.java @@ -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 { + 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); + } } diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusAlterliasOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusAlterliasOp.java new file mode 100644 index 000000000..6abe80149 --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusAlterliasOp.java @@ -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 { + public MilvusAlterliasOp(MilvusServiceClient client, AlterAliasParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.alterAlias(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusBaseOp.java similarity index 73% rename from adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusOp.java rename to adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusBaseOp.java index faef0e640..d685fabcd 100644 --- a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusOp.java +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusBaseOp.java @@ -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 implements CycleOp { +import java.util.function.Function; +import java.util.function.LongFunction; - protected final static Logger logger = LogManager.getLogger(MilvusOp.class); +public abstract class MilvusBaseOp implements CycleOp { + + protected final static Logger logger = LogManager.getLogger(MilvusBaseOp.class); protected final MilvusServiceClient client; protected final T request; + protected final LongFunction 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 call) { + this.client = client; + this.request = requestParam; + this.apiCall = call; } @Override @@ -49,7 +60,7 @@ public abstract class MilvusOp implements CycleOp { } }; - public abstract Object applyOp(long value) throws Exception; + public abstract Object applyOp(long value); @Override public String toString() { diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusBulkInsertOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusBulkInsertOp.java new file mode 100644 index 000000000..43a1dee0d --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusBulkInsertOp.java @@ -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 { + public MilvusBulkInsertOp(MilvusServiceClient client, BulkInsertParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.bulkInsert(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusCreateAliasOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusCreateAliasOp.java new file mode 100644 index 000000000..5d2640dd7 --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusCreateAliasOp.java @@ -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 { + public MilvusCreateAliasOp(MilvusServiceClient client, CreateAliasParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.createAlias(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusCreateCollectionOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusCreateCollectionOp.java index 314d6791f..1d9fcc6ec 100644 --- a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusCreateCollectionOp.java +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusCreateCollectionOp.java @@ -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 { +public class MilvusCreateCollectionOp extends MilvusBaseOp { /** * Create a new {@link ParsedOp} encapsulating a call to the Milvus/Zilliz client delete method * diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusCreateCredentialOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusCreateCredentialOp.java new file mode 100644 index 000000000..73d03040c --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusCreateCredentialOp.java @@ -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 { + public MilvusCreateCredentialOp(MilvusServiceClient client, CreateCredentialParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.createCredential(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusCreateDatabaseOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusCreateDatabaseOp.java new file mode 100644 index 000000000..006070fad --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusCreateDatabaseOp.java @@ -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 { + public MilvusCreateDatabaseOp(MilvusServiceClient client, CreateDatabaseParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.createDatabase(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusCreateIndexOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusCreateIndexOp.java index 860e2afc6..52458e7e4 100644 --- a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusCreateIndexOp.java +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusCreateIndexOp.java @@ -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 { +public class MilvusCreateIndexOp extends MilvusBaseOp { public MilvusCreateIndexOp(MilvusServiceClient client, CreateIndexParam request) { super(client, request); } diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusCreatePartitionOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusCreatePartitionOp.java new file mode 100644 index 000000000..3a2698bfa --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusCreatePartitionOp.java @@ -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 { + public MilvusCreatePartitionOp(MilvusServiceClient client, CreatePartitionParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.createPartition(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDeleteCredentialOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDeleteCredentialOp.java new file mode 100644 index 000000000..d582b0f60 --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDeleteCredentialOp.java @@ -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 { + public MilvusDeleteCredentialOp(MilvusServiceClient client, DeleteCredentialParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.deleteCredential(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDeleteOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDeleteOp.java index 09c852ba4..fbf6c274a 100644 --- a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDeleteOp.java +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDeleteOp.java @@ -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 { +public class MilvusDeleteOp extends MilvusBaseOp { public MilvusDeleteOp(MilvusServiceClient client, DeleteParam request) { super(client,request); diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDescribeCollectionOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDescribeCollectionOp.java new file mode 100644 index 000000000..50ed18e4c --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDescribeCollectionOp.java @@ -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 { + public MilvusDescribeCollectionOp(MilvusServiceClient client, DescribeCollectionParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.describeCollection(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDescribeIndexOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDescribeIndexOp.java new file mode 100644 index 000000000..1e5ee5618 --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDescribeIndexOp.java @@ -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 { + public MilvusDescribeIndexOp(MilvusServiceClient client, DescribeIndexParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.describeIndex(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDropAliasOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDropAliasOp.java new file mode 100644 index 000000000..f7f848b05 --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDropAliasOp.java @@ -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 { + public MilvusDropAliasOp(MilvusServiceClient client, DropAliasParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.dropAlias(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDropCollectionOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDropCollectionOp.java index 222e40aa1..f6b157510 100644 --- a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDropCollectionOp.java +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDropCollectionOp.java @@ -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 { +public class MilvusDropCollectionOp extends MilvusBaseOp { /** * Create a new {@link ParsedOp} encapsulating a call to the Milvus/Zilliz client delete method * diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDropDatabaseOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDropDatabaseOp.java new file mode 100644 index 000000000..17a1fda47 --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDropDatabaseOp.java @@ -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 { + public MilvusDropDatabaseOp(MilvusServiceClient client, DropDatabaseParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.dropDatabase(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDropIndexOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDropIndexOp.java index 3b515b461..03e00f19f 100644 --- a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDropIndexOp.java +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDropIndexOp.java @@ -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 { +public class MilvusDropIndexOp extends MilvusBaseOp { /** * Create a new {@link ParsedOp} encapsulating a call to the Milvus/Zilliz client delete method * diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDropPartitionOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDropPartitionOp.java new file mode 100644 index 000000000..1d45dfbb7 --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusDropPartitionOp.java @@ -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 { + public MilvusDropPartitionOp(MilvusServiceClient client, DropPartitionParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.dropPartition(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusFlushOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusFlushOp.java new file mode 100644 index 000000000..83160e4ab --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusFlushOp.java @@ -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 { + public MilvusFlushOp(MilvusServiceClient client, FlushParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.flush(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetCollectionStatisticsOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetCollectionStatisticsOp.java new file mode 100644 index 000000000..dc42def4d --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetCollectionStatisticsOp.java @@ -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 { + public MilvusGetCollectionStatisticsOp(MilvusServiceClient client, GetCollectionStatisticsParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.getCollectionStatistics(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetCompactionStateOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetCompactionStateOp.java new file mode 100644 index 000000000..395a41c39 --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetCompactionStateOp.java @@ -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 { + public MilvusGetCompactionStateOp(MilvusServiceClient client, GetCompactionStateParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.getCompactionState(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetCompactionStateWithPlansOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetCompactionStateWithPlansOp.java new file mode 100644 index 000000000..b61cb6ac9 --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetCompactionStateWithPlansOp.java @@ -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 { + public MilvusGetCompactionStateWithPlansOp(MilvusServiceClient client, GetCompactionPlansParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.getCompactionStateWithPlans(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetFlushAllStateOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetFlushAllStateOp.java new file mode 100644 index 000000000..85837bf89 --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetFlushAllStateOp.java @@ -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 { + public MilvusGetFlushAllStateOp(MilvusServiceClient client, GetFlushAllStateParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.getFlushAllState(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetFlushStateOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetFlushStateOp.java new file mode 100644 index 000000000..bfeaf0102 --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetFlushStateOp.java @@ -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 { + public MilvusGetFlushStateOp(MilvusServiceClient client, GetFlushStateParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.getFlushState(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetIndexBuildProgressOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetIndexBuildProgressOp.java new file mode 100644 index 000000000..b9407194e --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetIndexBuildProgressOp.java @@ -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 { + public MilvusGetIndexBuildProgressOp(MilvusServiceClient client, GetIndexBuildProgressParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.getIndexBuildProgress(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetIndexStateOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetIndexStateOp.java new file mode 100644 index 000000000..c37dd476b --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetIndexStateOp.java @@ -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 { + public MilvusGetIndexStateOp(MilvusServiceClient client, GetIndexStateParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.getIndexState(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetLoadStateOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetLoadStateOp.java new file mode 100644 index 000000000..c76966d8d --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetLoadStateOp.java @@ -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 { + public MilvusGetLoadStateOp(MilvusServiceClient client, GetLoadStateParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.getLoadState(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetLoadingProgressOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetLoadingProgressOp.java new file mode 100644 index 000000000..03a1c8e4d --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetLoadingProgressOp.java @@ -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 { + public MilvusGetLoadingProgressOp(MilvusServiceClient client, GetLoadingProgressParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.getLoadingProgress(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetMetricsOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetMetricsOp.java new file mode 100644 index 000000000..e82455593 --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetMetricsOp.java @@ -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 { + public MilvusGetMetricsOp(MilvusServiceClient client, GetMetricsParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.getMetrics(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetOp.java new file mode 100644 index 000000000..23237bdd6 --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetOp.java @@ -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 { + public MilvusGetOp(MilvusServiceClient client, GetIdsParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.get(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetPartitionStatisticsOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetPartitionStatisticsOp.java new file mode 100644 index 000000000..643149026 --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetPartitionStatisticsOp.java @@ -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 { + public MilvusGetPartitionStatisticsOp(MilvusServiceClient client, GetPartitionStatisticsParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.getPartitionStatistics(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetPersistentSegmentInfoOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetPersistentSegmentInfoOp.java new file mode 100644 index 000000000..c478753e0 --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetPersistentSegmentInfoOp.java @@ -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 { + public MilvusGetPersistentSegmentInfoOp(MilvusServiceClient client, GetQuerySegmentInfoParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.getQuerySegmentInfo(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetQuerySegmentInfoOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetQuerySegmentInfoOp.java new file mode 100644 index 000000000..3d6d3333d --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetQuerySegmentInfoOp.java @@ -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 { + public MilvusGetQuerySegmentInfoOp(MilvusServiceClient client, GetQuerySegmentInfoParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.getQuerySegmentInfo(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetReplicasOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetReplicasOp.java new file mode 100644 index 000000000..4e6c4596c --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusGetReplicasOp.java @@ -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 { + public MilvusGetReplicasOp(MilvusServiceClient client, GetReplicasParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.getReplicas(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusHasPartitionOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusHasPartitionOp.java new file mode 100644 index 000000000..2a5b2aba4 --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusHasPartitionOp.java @@ -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 { + public MilvusHasPartitionOp(MilvusServiceClient client, HasPartitionParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.hasPartition(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusInsertAsyncOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusInsertAsyncOp.java new file mode 100644 index 000000000..97cacdca5 --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusInsertAsyncOp.java @@ -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 { + 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> 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); + } + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusInsertOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusInsertOp.java index eabbe3ebd..ad8bf03c2 100644 --- a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusInsertOp.java +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusInsertOp.java @@ -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 { +public class MilvusInsertOp extends MilvusBaseOp { /** * Create a new {@link ParsedOp} encapsulating a call to the Milvus/Zilliz client delete method diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusListBulkInsertTasksOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusListBulkInsertTasksOp.java new file mode 100644 index 000000000..102b746e0 --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusListBulkInsertTasksOp.java @@ -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 { + public MilvusListBulkInsertTasksOp(MilvusServiceClient client, ListBulkInsertTasksParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.listBulkInsertTasks(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusListCollectionsOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusListCollectionsOp.java new file mode 100644 index 000000000..d2fa070cb --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusListCollectionsOp.java @@ -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 { + public MilvusListCollectionsOp(MilvusServiceClient client, ListCollectionsParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.listCollections(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusListCredUsersOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusListCredUsersOp.java new file mode 100644 index 000000000..c3f88861b --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusListCredUsersOp.java @@ -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 { + public MilvusListCredUsersOp(MilvusServiceClient client, ListCredUsersParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.listCredUsers(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusListDatabasesOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusListDatabasesOp.java new file mode 100644 index 000000000..23e4d2880 --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusListDatabasesOp.java @@ -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 { + public MilvusListDatabasesOp(MilvusServiceClient client, Void request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.listDatabases(); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusLoadBalanceOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusLoadBalanceOp.java new file mode 100644 index 000000000..992cc5182 --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusLoadBalanceOp.java @@ -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 { + public MilvusLoadBalanceOp(MilvusServiceClient client, LoadBalanceParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.loadBalance(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusLoadCollectionOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusLoadCollectionOp.java new file mode 100644 index 000000000..4cc309e1a --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusLoadCollectionOp.java @@ -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 { + public MilvusLoadCollectionOp(MilvusServiceClient client, LoadCollectionParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.loadCollection(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusLoadPartitionsOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusLoadPartitionsOp.java new file mode 100644 index 000000000..4b72eb38c --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusLoadPartitionsOp.java @@ -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 { + public MilvusLoadPartitionsOp(MilvusServiceClient client, LoadPartitionsParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.loadPartitions(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusManualCompactOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusManualCompactOp.java new file mode 100644 index 000000000..1fb547a6d --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusManualCompactOp.java @@ -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 { + public MilvusManualCompactOp(MilvusServiceClient client, ManualCompactParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.manualCompact(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusQueryAsyncOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusQueryAsyncOp.java new file mode 100644 index 000000000..fb79ae577 --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusQueryAsyncOp.java @@ -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 { + 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> 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); + } + + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusQueryOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusQueryOp.java new file mode 100644 index 000000000..6ed37e18c --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusQueryOp.java @@ -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 { + public MilvusQueryOp(MilvusServiceClient client, QueryParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.query(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusReleaseCollectionOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusReleaseCollectionOp.java new file mode 100644 index 000000000..fa60d9686 --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusReleaseCollectionOp.java @@ -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 { + public MilvusReleaseCollectionOp(MilvusServiceClient client, ReleaseCollectionParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.releaseCollection(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusReleasePartitionsOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusReleasePartitionsOp.java new file mode 100644 index 000000000..9180ca2fc --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusReleasePartitionsOp.java @@ -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 { + public MilvusReleasePartitionsOp(MilvusServiceClient client, ReleasePartitionsParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.releasePartitions(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusSearchAsyncOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusSearchAsyncOp.java new file mode 100644 index 000000000..7065856f1 --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusSearchAsyncOp.java @@ -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 { + + 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 applyOp(long value) { + ListenableFuture> 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); + } + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusSearchOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusSearchOp.java index 571894081..d1321b56e 100644 --- a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusSearchOp.java +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusSearchOp.java @@ -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 { +public class MilvusSearchOp extends MilvusBaseOp { /** * Create a new {@link ParsedOp} encapsulating a call to the Milvus/Zilliz client delete method diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusShowCollectionsOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusShowCollectionsOp.java new file mode 100644 index 000000000..4fbdbc8e3 --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusShowCollectionsOp.java @@ -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 { + public MilvusShowCollectionsOp(MilvusServiceClient client, ShowCollectionsParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.showCollections(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusShowPartitionsOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusShowPartitionsOp.java new file mode 100644 index 000000000..e6d4dfb2f --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusShowPartitionsOp.java @@ -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 { + public MilvusShowPartitionsOp(MilvusServiceClient client, ShowPartitionsParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.showPartitions(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusUpdateCredentialOp.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusUpdateCredentialOp.java new file mode 100644 index 000000000..0e20e67bf --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/ops/MilvusUpdateCredentialOp.java @@ -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 { + public MilvusUpdateCredentialOp(MilvusServiceClient client, UpdateCredentialParam request) { + super(client, request); + } + + @Override + public Object applyOp(long value) { + return client.updateCredential(request); + } +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/types/MilvusOpGroup.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/types/MilvusOpGroup.java new file mode 100644 index 000000000..dba36ed91 --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/types/MilvusOpGroup.java @@ -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 + +} diff --git a/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/types/MilvusOpType.java b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/types/MilvusOpType.java new file mode 100644 index 000000000..379386f9e --- /dev/null +++ b/adapter-milvus/src/main/java/io/nosqlbench/adapter/milvus/types/MilvusOpType.java @@ -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; + } + +}