-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
476 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...ain/java/io/nosqlbench/adapter/qdrant/opdispensers/QdrantCollectionExistsOpDispenser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright (c) 2020-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.qdrant.opdispensers; | ||
|
||
import io.nosqlbench.adapter.qdrant.QdrantDriverAdapter; | ||
import io.nosqlbench.adapter.qdrant.ops.QdrantBaseOp; | ||
import io.nosqlbench.adapter.qdrant.ops.QdrantCollectionExistsOp; | ||
import io.nosqlbench.adapters.api.templating.ParsedOp; | ||
import io.qdrant.client.QdrantClient; | ||
import io.qdrant.client.grpc.Collections.CollectionExistsRequest; | ||
|
||
import java.util.function.LongFunction; | ||
|
||
public class QdrantCollectionExistsOpDispenser extends QdrantBaseOpDispenser<CollectionExistsRequest> { | ||
public QdrantCollectionExistsOpDispenser(QdrantDriverAdapter adapter, ParsedOp op, LongFunction<String> targetFunction) { | ||
super(adapter, op, targetFunction); | ||
} | ||
|
||
@Override | ||
public LongFunction<CollectionExistsRequest> getParamFunc( | ||
LongFunction<QdrantClient> clientF, ParsedOp op, LongFunction<String> targetF) { | ||
LongFunction<CollectionExistsRequest.Builder> ebF = | ||
l -> CollectionExistsRequest.newBuilder().setCollectionName(targetF.apply(l)); | ||
|
||
final LongFunction<CollectionExistsRequest.Builder> lastF = ebF; | ||
return l -> lastF.apply(l).build(); | ||
} | ||
|
||
@Override | ||
public LongFunction<QdrantBaseOp<CollectionExistsRequest>> createOpFunc( | ||
LongFunction<CollectionExistsRequest> paramF, | ||
LongFunction<QdrantClient> clientF, | ||
ParsedOp op, | ||
LongFunction<String> targetF) { | ||
return l -> new QdrantCollectionExistsOp(clientF.apply(l), paramF.apply(l)); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
.../main/java/io/nosqlbench/adapter/qdrant/opdispensers/QdrantCollectionInfoOpDispenser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (c) 2020-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.qdrant.opdispensers; | ||
|
||
import io.nosqlbench.adapter.qdrant.QdrantDriverAdapter; | ||
import io.nosqlbench.adapter.qdrant.ops.QdrantBaseOp; | ||
import io.nosqlbench.adapter.qdrant.ops.QdrantCollectionInfoOp; | ||
import io.nosqlbench.adapters.api.templating.ParsedOp; | ||
import io.qdrant.client.QdrantClient; | ||
|
||
import java.util.function.LongFunction; | ||
|
||
public class QdrantCollectionInfoOpDispenser extends QdrantBaseOpDispenser<String> { | ||
public QdrantCollectionInfoOpDispenser(QdrantDriverAdapter adapter, ParsedOp op, LongFunction<String> targetFunction) { | ||
super(adapter, op, targetFunction); | ||
} | ||
|
||
@Override | ||
public LongFunction<String> getParamFunc( | ||
LongFunction<QdrantClient> clientF, ParsedOp op, LongFunction<String> targetF) { | ||
return l -> targetF.apply(l); | ||
} | ||
|
||
@Override | ||
public LongFunction<QdrantBaseOp<String>> createOpFunc( | ||
LongFunction<String> paramF, | ||
LongFunction<QdrantClient> clientF, | ||
ParsedOp op, | ||
LongFunction<String> targetF) { | ||
return l -> new QdrantCollectionInfoOp(clientF.apply(l), paramF.apply(l)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...ava/io/nosqlbench/adapter/qdrant/opdispensers/QdrantListCollectionAliasesOpDispenser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (c) 2020-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.qdrant.opdispensers; | ||
|
||
import io.nosqlbench.adapter.qdrant.QdrantDriverAdapter; | ||
import io.nosqlbench.adapter.qdrant.ops.QdrantBaseOp; | ||
import io.nosqlbench.adapter.qdrant.ops.QdrantListCollectionAliasesOp; | ||
import io.nosqlbench.adapters.api.templating.ParsedOp; | ||
import io.qdrant.client.QdrantClient; | ||
import io.qdrant.client.grpc.Collections.ListCollectionAliasesRequest; | ||
|
||
import java.util.function.LongFunction; | ||
|
||
public class QdrantListCollectionAliasesOpDispenser extends QdrantBaseOpDispenser<ListCollectionAliasesRequest> { | ||
public QdrantListCollectionAliasesOpDispenser(QdrantDriverAdapter adapter, ParsedOp op, | ||
LongFunction<String> targetFunction) { | ||
super(adapter, op, targetFunction); | ||
} | ||
|
||
@Override | ||
public LongFunction<ListCollectionAliasesRequest> getParamFunc(LongFunction<QdrantClient> clientF, ParsedOp op, | ||
LongFunction<String> targetF) { | ||
LongFunction<ListCollectionAliasesRequest.Builder> ebF = | ||
l -> ListCollectionAliasesRequest.newBuilder().setCollectionName(targetF.apply(l)); | ||
|
||
final LongFunction<ListCollectionAliasesRequest.Builder> lastF = ebF; | ||
return l -> lastF.apply(l).build(); | ||
} | ||
|
||
@Override | ||
public LongFunction<QdrantBaseOp<ListCollectionAliasesRequest>> createOpFunc( | ||
LongFunction<ListCollectionAliasesRequest> paramF, | ||
LongFunction<QdrantClient> clientF, ParsedOp op, LongFunction<String> targetF) { | ||
return l -> new QdrantListCollectionAliasesOp(clientF.apply(l), paramF.apply(l)); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
...main/java/io/nosqlbench/adapter/qdrant/opdispensers/QdrantListCollectionsOpDispenser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright (c) 2020-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.qdrant.opdispensers; | ||
|
||
import io.nosqlbench.adapter.qdrant.QdrantDriverAdapter; | ||
import io.nosqlbench.adapter.qdrant.ops.QdrantBaseOp; | ||
import io.nosqlbench.adapter.qdrant.ops.QdrantListCollectionsOp; | ||
import io.nosqlbench.adapters.api.templating.ParsedOp; | ||
import io.qdrant.client.QdrantClient; | ||
|
||
import java.util.function.LongFunction; | ||
|
||
public class QdrantListCollectionsOpDispenser extends QdrantBaseOpDispenser<Object> { | ||
public QdrantListCollectionsOpDispenser(QdrantDriverAdapter adapter, | ||
ParsedOp op, LongFunction<String> targetFunction) { | ||
super(adapter, op, targetFunction); | ||
} | ||
|
||
@Override | ||
public LongFunction<Object> getParamFunc(LongFunction<QdrantClient> clientF, ParsedOp op, LongFunction<String> targetF) { | ||
return l -> ""; | ||
} | ||
|
||
@Override | ||
public LongFunction<QdrantBaseOp<Object>> createOpFunc( | ||
LongFunction<Object> paramF, | ||
LongFunction<QdrantClient> clientF, | ||
ParsedOp op, LongFunction<String> targetF) { | ||
return l -> new QdrantListCollectionsOp(clientF.apply(l), null); | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...c/main/java/io/nosqlbench/adapter/qdrant/opdispensers/QdrantListSnapshotsOpDispenser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright (c) 2020-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.qdrant.opdispensers; | ||
|
||
import io.nosqlbench.adapter.qdrant.QdrantDriverAdapter; | ||
import io.nosqlbench.adapter.qdrant.ops.QdrantBaseOp; | ||
import io.nosqlbench.adapter.qdrant.ops.QdrantListSnapshotsOp; | ||
import io.nosqlbench.adapters.api.templating.ParsedOp; | ||
import io.qdrant.client.QdrantClient; | ||
import io.qdrant.client.grpc.SnapshotsService.ListSnapshotsRequest; | ||
|
||
import java.util.function.LongFunction; | ||
|
||
public class QdrantListSnapshotsOpDispenser extends QdrantBaseOpDispenser<ListSnapshotsRequest> { | ||
public QdrantListSnapshotsOpDispenser(QdrantDriverAdapter adapter, ParsedOp op, LongFunction<String> targetFunction) { | ||
super(adapter, op, targetFunction); | ||
} | ||
|
||
@Override | ||
public LongFunction<ListSnapshotsRequest> getParamFunc(LongFunction<QdrantClient> clientF, | ||
ParsedOp op, LongFunction<String> targetF) { | ||
LongFunction<ListSnapshotsRequest.Builder> ebF = | ||
l -> ListSnapshotsRequest.newBuilder().setCollectionName(targetF.apply(l)); | ||
|
||
final LongFunction<ListSnapshotsRequest.Builder> lastF = ebF; | ||
return l -> lastF.apply(l).build(); | ||
} | ||
|
||
@Override | ||
public LongFunction<QdrantBaseOp<ListSnapshotsRequest>> createOpFunc(LongFunction<ListSnapshotsRequest> paramF, | ||
LongFunction<QdrantClient> clientF, | ||
ParsedOp op, LongFunction<String> targetF) { | ||
return l -> new QdrantListSnapshotsOp(clientF.apply(l), paramF.apply(l)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...apter-qdrant/src/main/java/io/nosqlbench/adapter/qdrant/ops/QdrantCollectionExistsOp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) 2020-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.qdrant.ops; | ||
|
||
import io.qdrant.client.QdrantClient; | ||
import io.qdrant.client.grpc.Collections.CollectionExistsRequest; | ||
|
||
import java.time.Duration; | ||
|
||
public class QdrantCollectionExistsOp extends QdrantBaseOp<CollectionExistsRequest> { | ||
public QdrantCollectionExistsOp(QdrantClient client, CollectionExistsRequest request) { | ||
super(client, request); | ||
} | ||
|
||
@Override | ||
public Object applyOp(long value) { | ||
Boolean response; | ||
try { | ||
response = client.collectionExistsAsync(request.getCollectionName(), Duration.ofSeconds(600)).get(); | ||
logger.info("Collection {} exists: {}", request.getCollectionName(), response); | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
return response; | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...adapter-qdrant/src/main/java/io/nosqlbench/adapter/qdrant/ops/QdrantCollectionInfoOp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) 2020-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.qdrant.ops; | ||
|
||
import io.qdrant.client.QdrantClient; | ||
import io.qdrant.client.grpc.Collections.CollectionInfo; | ||
|
||
import java.time.Duration; | ||
|
||
public class QdrantCollectionInfoOp extends QdrantBaseOp<String> { | ||
public QdrantCollectionInfoOp(QdrantClient client, String request) { | ||
super(client, request); | ||
} | ||
|
||
@Override | ||
public Object applyOp(long value) { | ||
CollectionInfo response; | ||
try { | ||
response = client.getCollectionInfoAsync(request, Duration.ofSeconds(600)).get(); | ||
logger.debug("Collection info: {}", response.toString()); | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
return response; | ||
} | ||
} |
Oops, something went wrong.