diff --git a/adapter-pinecone/src/main/java/io/nosqlbench/adapter/pinecone/opdispensers/PineconeDeleteOpDispenser.java b/adapter-pinecone/src/main/java/io/nosqlbench/adapter/pinecone/opdispensers/PineconeDeleteOpDispenser.java index 101e06fd5..285b28bbe 100644 --- a/adapter-pinecone/src/main/java/io/nosqlbench/adapter/pinecone/opdispensers/PineconeDeleteOpDispenser.java +++ b/adapter-pinecone/src/main/java/io/nosqlbench/adapter/pinecone/opdispensers/PineconeDeleteOpDispenser.java @@ -58,6 +58,15 @@ public class PineconeDeleteOpDispenser extends PineconeOpDispenser { deleteRequestFunc.apply(value)); } + /** + * @param op The ParsedOp used to build the Request + * @return A function that will take a long (the current cycle) and return a Pinecone DeleteRequest + * + * The pattern used here is to accommodate the way Request types are constructed for Pinecone. + * Requests use a Builder pattern, so at time of instantiation the methods should be chained together. + * For each method in the chain a function is created here and added to the chain of functions + * called at time of instantiation. + */ private LongFunction createDeleteRequestFunction(ParsedOp op) { LongFunction rFunc = l -> DeleteRequest.newBuilder(); diff --git a/adapter-pinecone/src/main/java/io/nosqlbench/adapter/pinecone/opdispensers/PineconeDescribeIndexStatsOpDispenser.java b/adapter-pinecone/src/main/java/io/nosqlbench/adapter/pinecone/opdispensers/PineconeDescribeIndexStatsOpDispenser.java index 15d0ee17f..a350c5ca0 100644 --- a/adapter-pinecone/src/main/java/io/nosqlbench/adapter/pinecone/opdispensers/PineconeDescribeIndexStatsOpDispenser.java +++ b/adapter-pinecone/src/main/java/io/nosqlbench/adapter/pinecone/opdispensers/PineconeDescribeIndexStatsOpDispenser.java @@ -50,6 +50,17 @@ public class PineconeDescribeIndexStatsOpDispenser extends PineconeOpDispenser { indexStatsRequestFunc = createDescribeIndexStatsRequestFunction(op); } + /** + * @param op The ParsedOp used to build the Request + * @return A function that will take a long (the current cycle) and return a Pinecone DescribeIndexStatsRequest + * + * The pattern used here is to accommodate the way Request types are constructed for Pinecone. + * Requests use a Builder pattern, so at time of instantiation the methods should be chained together. + * For each method in the chain a function is created here and added to the chain of functions + * called at time of instantiation. Additionally some of the arguments to the builder methods require + * creation through their own builder process. In these cases the pattern adopted includes multiple layers of + * functions in order to build all objects in the correct manner and ordering. + */ private LongFunction createDescribeIndexStatsRequestFunction(ParsedOp op) { LongFunction rFunc = l -> DescribeIndexStatsRequest.newBuilder(); Optional> filterFunction = op.getAsOptionalFunction("filter", String.class); diff --git a/adapter-pinecone/src/main/java/io/nosqlbench/adapter/pinecone/opdispensers/PineconeFetchOpDispenser.java b/adapter-pinecone/src/main/java/io/nosqlbench/adapter/pinecone/opdispensers/PineconeFetchOpDispenser.java index 0b75b3367..14e4fd057 100644 --- a/adapter-pinecone/src/main/java/io/nosqlbench/adapter/pinecone/opdispensers/PineconeFetchOpDispenser.java +++ b/adapter-pinecone/src/main/java/io/nosqlbench/adapter/pinecone/opdispensers/PineconeFetchOpDispenser.java @@ -50,6 +50,15 @@ public class PineconeFetchOpDispenser extends PineconeOpDispenser { fetchRequestFunc = createFetchRequestFunction(op); } + /** + * @param op The ParsedOp used to build the Request + * @return A function that will take a long (the current cycle) and return a Pinecone FetchRequest + * + * The pattern used here is to accommodate the way Request types are constructed for Pinecone. + * Requests use a Builder pattern, so at time of instantiation the methods should be chained together. + * For each method in the chain a function is created here and added to the chain of functions + * called at time of instantiation. + */ private LongFunction createFetchRequestFunction(ParsedOp op) { LongFunction rFunc = l -> FetchRequest.newBuilder(); diff --git a/adapter-pinecone/src/main/java/io/nosqlbench/adapter/pinecone/opdispensers/PineconeQueryOpDispenser.java b/adapter-pinecone/src/main/java/io/nosqlbench/adapter/pinecone/opdispensers/PineconeQueryOpDispenser.java index 1302b3ab0..51940b0e9 100644 --- a/adapter-pinecone/src/main/java/io/nosqlbench/adapter/pinecone/opdispensers/PineconeQueryOpDispenser.java +++ b/adapter-pinecone/src/main/java/io/nosqlbench/adapter/pinecone/opdispensers/PineconeQueryOpDispenser.java @@ -55,6 +55,19 @@ public class PineconeQueryOpDispenser extends PineconeOpDispenser { queryVectorFunc = createQueryVectorFunc(op); } + /** + * @param op The ParsedOp used to build the Request + * @return A function that will take a long (the current cycle) and return a Pinecone QueryRequest Builder + * + * The pattern used here is to accommodate the way Request types are constructed for Pinecone. + * Requests use a Builder pattern, so at time of instantiation the methods should be chained together. + * For each method in the chain a function is created here and added to the chain of functions + * called at time of instantiation. + * + * The QueryVector objects used by the QueryRequest as sufficiently sophisticated in their own building process + * that it has been broken out into a separate method. At runtime they are built separately and then added + * to the build chain by the builder returned by this method. + */ private LongFunction createQueryRequestFunc(ParsedOp op) { LongFunction rFunc = l -> QueryRequest.newBuilder(); @@ -117,6 +130,15 @@ public class PineconeQueryOpDispenser extends PineconeOpDispenser { return rFunc; } + /** + * @param op the ParsedOp from which the Query Vector objects will be built + * @return an Iterable Collection of QueryVector objects to be added to a Pinecone QueryRequest + * + * This method interrogates the subsection of the ParsedOp defined for QueryVector parameters and constructs + * a list of QueryVectors based on the included values, or returns null if this section is not populated. The + * base function returns either the List of vectors or null, while the interior function builds the vectors + * with a Builder pattern based on the values contained in the source ParsedOp. + */ private LongFunction> createQueryVectorFunc(ParsedOp op) { Optional> baseFunc = op.getAsOptionalFunction("query_vectors", List.class); diff --git a/adapter-pinecone/src/main/java/io/nosqlbench/adapter/pinecone/opdispensers/PineconeUpdateOpDispenser.java b/adapter-pinecone/src/main/java/io/nosqlbench/adapter/pinecone/opdispensers/PineconeUpdateOpDispenser.java index 2a8d24b04..496b93c8d 100644 --- a/adapter-pinecone/src/main/java/io/nosqlbench/adapter/pinecone/opdispensers/PineconeUpdateOpDispenser.java +++ b/adapter-pinecone/src/main/java/io/nosqlbench/adapter/pinecone/opdispensers/PineconeUpdateOpDispenser.java @@ -56,6 +56,15 @@ public class PineconeUpdateOpDispenser extends PineconeOpDispenser { sparseValuesFunc = createSparseValuesFunction(op); } + /** + * @param op the ParsedOp from which the SparseValues object will be built + * @return a SparseValues Object to be added to a Pinecone UpdateRequest + * + * This method interrogates the subsection of the ParsedOp defined for SparseValues parameters and constructs + * a SparseValues Object based on the included values, or returns null if this section is not populated. The + * base function returns either the SparseValues Object or null, while the interior function builds the SparseValues + * with a Builder pattern based on the values contained in the source ParsedOp. + */ private LongFunction createSparseValuesFunction(ParsedOp op) { Optional> mFunc = op.getAsOptionalFunction("sparse_values", Map.class); return mFunc.>map(mapLongFunction -> l -> { @@ -77,6 +86,15 @@ public class PineconeUpdateOpDispenser extends PineconeOpDispenser { }).orElse(null); } + /** + * @param op the ParsedOp from which the Metadata objects will be built + * @return an Metadata Struct to be added to a Pinecone UpdateRequest + * + * This method interrogates the subsection of the ParsedOp defined for metadata parameters and constructs + * a Metadata Struct based on the included values, or returns null if this section is not populated. The + * base function returns either the Metadata Struct or null, while the interior function builds the Metadata + * with a Builder pattern based on the values contained in the source ParsedOp. + */ private LongFunction createUpdateMetadataFunction(ParsedOp op) { Optional> mFunc = op.getAsOptionalFunction("metadata", Map.class); return mFunc.>map(mapLongFunction -> l -> { @@ -93,6 +111,19 @@ public class PineconeUpdateOpDispenser extends PineconeOpDispenser { }).orElse(null); } + /** + * @param op The ParsedOp used to build the Request + * @return A function that will take a long (the current cycle) and return a Pinecone UpdateRequest Builder + * + * The pattern used here is to accommodate the way Request types are constructed for Pinecone. + * Requests use a Builder pattern, so at time of instantiation the methods should be chained together. + * For each method in the chain a function is created here and added to the chain of functions + * called at time of instantiation. + * + * The Metadata and SparseValues objects used by the UpdateRequest are sufficiently sophisticated in their own + * building process that they have been broken out into separate methods. At runtime they are built separately + * and then added to the build chain by the builder returned by this method. + */ private LongFunction createUpdateRequestFunction(ParsedOp op) { LongFunction rFunc = l -> UpdateRequest.newBuilder(); diff --git a/adapter-pinecone/src/main/java/io/nosqlbench/adapter/pinecone/opdispensers/PineconeUpsertOpDispenser.java b/adapter-pinecone/src/main/java/io/nosqlbench/adapter/pinecone/opdispensers/PineconeUpsertOpDispenser.java index f086ad40b..0f1dee1b6 100644 --- a/adapter-pinecone/src/main/java/io/nosqlbench/adapter/pinecone/opdispensers/PineconeUpsertOpDispenser.java +++ b/adapter-pinecone/src/main/java/io/nosqlbench/adapter/pinecone/opdispensers/PineconeUpsertOpDispenser.java @@ -55,6 +55,15 @@ public class PineconeUpsertOpDispenser extends PineconeOpDispenser { upsertVectorFunc = createUpsertRequestVectorsFunc(op); } + /** + * @param op the ParsedOp from which the Vector objects will be built + * @return an Iterable Collection of Vector objects to be added to a Pinecone UpsertRequest + * + * This method interrogates the subsection of the ParsedOp defined for Vector parameters and constructs + * a list of Vectors based on the included values, or returns null if this section is not populated. The + * base function returns either the List of vectors or null, while the interior function builds the vectors + * with a Builder pattern based on the values contained in the source ParsedOp. + */ private LongFunction> createUpsertRequestVectorsFunc(ParsedOp op) { Optional> baseFunc = op.getAsOptionalFunction("upsert_vectors", List.class); @@ -104,6 +113,19 @@ public class PineconeUpsertOpDispenser extends PineconeOpDispenser { }).orElse(null); } + /** + * @param op The ParsedOp used to build the Request + * @return A function that will take a long (the current cycle) and return a Pinecone UpsertRequest Builder + * + * The pattern used here is to accommodate the way Request types are constructed for Pinecone. + * Requests use a Builder pattern, so at time of instantiation the methods should be chained together. + * For each method in the chain a function is created here and added to the chain of functions + * called at time of instantiation. + * + * The Vector objects used by the UpsertRequest are sufficiently sophisticated in their own + * building process that they have been broken out into a separate method. At runtime they are built separately + * and then added to the build chain by the builder returned by this method. + */ private LongFunction createUpsertRequestFunc(ParsedOp op) { LongFunction rFunc = l -> UpsertRequest.newBuilder();