From d93849d4054be8bebf2e64fc1632618ba4e6afea Mon Sep 17 00:00:00 2001 From: Tristan Vuong Date: Wed, 15 Nov 2023 16:59:13 +0000 Subject: [PATCH 1/5] Add batch create and batch get measurements methods. --- .../api/v2alpha/measurements_service.proto | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/src/main/proto/wfa/measurement/api/v2alpha/measurements_service.proto b/src/main/proto/wfa/measurement/api/v2alpha/measurements_service.proto index 2683d97c9..6723fb212 100644 --- a/src/main/proto/wfa/measurement/api/v2alpha/measurements_service.proto +++ b/src/main/proto/wfa/measurement/api/v2alpha/measurements_service.proto @@ -48,6 +48,16 @@ service Measurements { // // This is a state transition method (see https://aip.dev/216). rpc CancelMeasurement(CancelMeasurementRequest) returns (Measurement) {} + + // Batch creates `Measurement`s. Results in an error if any of the specified + // `Measurement`s fail to be created. + rpc BatchCreateMeasurements(BatchCreateMeasurementsRequest) + returns (BatchCreateMeasurementsResponse) {} + + // Batch gets `Measurement`s. Results in a `NOT_FOUND` error if any of the + // specified `Measurement`s do not exist. + rpc BatchGetMeasurements(BatchGetMeasurementsRequest) + returns (BatchGetMeasurementsResponse) {} } // Request message for `GetMeasurement` method. @@ -135,3 +145,45 @@ message CancelMeasurementRequest { (google.api.field_behavior) = REQUIRED ]; } + +// Request message for `BatchCreateMeasurements` method. +message BatchCreateMeasurementsRequest { + // Resource name of the parent `MeasurementConsumer`. + string parent = 1 [ + (google.api.resource_reference).type = + "halo.wfanet.org/MeasurementConsumer", + (google.api.field_behavior) = REQUIRED + ]; + + // The requests specifying the `Measurement`s to create. A maximum of 50 + // `Measurement`s can be created in a single batch. + repeated CreateMeasurementRequest requests = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// Response message for `BatchCreateMeasurements` method. +message BatchCreateMeasurementsResponse { + // The `Measurement` resources. + repeated Measurement measurements = 1; +} + +// Request message for `BatchGetMeasurements` method. +message BatchGetMeasurementsRequest { + // Resource name of the parent `MeasurementConsumer`. + string parent = 1 [ + (google.api.resource_reference).type = + "halo.wfanet.org/MeasurementConsumer", + (google.api.field_behavior) = REQUIRED + ]; + + // The requests specifying the `Measurement`s to get. A maximum of 50 + // `Measurement`s can be retrieved in a single batch. + repeated GetMeasurementRequest requests = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// Response message for `BatchGetMeasurements` method. +message BatchGetMeasurementsResponse { + // The `Measurement` resources. + repeated Measurement measurements = 1; +} From 086ae0c79d07cca9ebd7ec4eb777bfedf5e3ab9b Mon Sep 17 00:00:00 2001 From: Tristan Vuong Date: Tue, 21 Nov 2023 16:08:34 +0000 Subject: [PATCH 2/5] Update batch get measurements request --- .../api/v2alpha/measurements_service.proto | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/main/proto/wfa/measurement/api/v2alpha/measurements_service.proto b/src/main/proto/wfa/measurement/api/v2alpha/measurements_service.proto index 6723fb212..657299bcf 100644 --- a/src/main/proto/wfa/measurement/api/v2alpha/measurements_service.proto +++ b/src/main/proto/wfa/measurement/api/v2alpha/measurements_service.proto @@ -169,17 +169,12 @@ message BatchCreateMeasurementsResponse { // Request message for `BatchGetMeasurements` method. message BatchGetMeasurementsRequest { - // Resource name of the parent `MeasurementConsumer`. - string parent = 1 [ - (google.api.resource_reference).type = - "halo.wfanet.org/MeasurementConsumer", + // List of resource names. A maximum of 50 `Measurement`s can be retrieved in + // a single batch. + repeated string names = 1 [ + (google.api.resource_reference).type = "halo.wfanet.org/Measurement", (google.api.field_behavior) = REQUIRED ]; - - // The requests specifying the `Measurement`s to get. A maximum of 50 - // `Measurement`s can be retrieved in a single batch. - repeated GetMeasurementRequest requests = 2 - [(google.api.field_behavior) = REQUIRED]; } // Response message for `BatchGetMeasurements` method. From a9d729782c60daea301c6ddfefd902762d09f6bf Mon Sep 17 00:00:00 2001 From: Tristan Vuong Date: Tue, 21 Nov 2023 16:11:42 +0000 Subject: [PATCH 3/5] Update batch get measurements request --- .../measurement/api/v2alpha/measurements_service.proto | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/proto/wfa/measurement/api/v2alpha/measurements_service.proto b/src/main/proto/wfa/measurement/api/v2alpha/measurements_service.proto index 657299bcf..def6e62dc 100644 --- a/src/main/proto/wfa/measurement/api/v2alpha/measurements_service.proto +++ b/src/main/proto/wfa/measurement/api/v2alpha/measurements_service.proto @@ -169,9 +169,16 @@ message BatchCreateMeasurementsResponse { // Request message for `BatchGetMeasurements` method. message BatchGetMeasurementsRequest { + // Resource name of the parent `MeasurementConsumer`. + string parent = 1 [ + (google.api.resource_reference).type = + "halo.wfanet.org/MeasurementConsumer", + (google.api.field_behavior) = REQUIRED + ]; + // List of resource names. A maximum of 50 `Measurement`s can be retrieved in // a single batch. - repeated string names = 1 [ + repeated string names = 2 [ (google.api.resource_reference).type = "halo.wfanet.org/Measurement", (google.api.field_behavior) = REQUIRED ]; From cf79bdf9237de521d1d64338d64bc9de5e03c024 Mon Sep 17 00:00:00 2001 From: Tristan Vuong Date: Tue, 21 Nov 2023 21:17:09 +0000 Subject: [PATCH 4/5] Add restriction in comment to BatchCreateMeasurements. --- .../wfa/measurement/api/v2alpha/measurements_service.proto | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/proto/wfa/measurement/api/v2alpha/measurements_service.proto b/src/main/proto/wfa/measurement/api/v2alpha/measurements_service.proto index def6e62dc..678330889 100644 --- a/src/main/proto/wfa/measurement/api/v2alpha/measurements_service.proto +++ b/src/main/proto/wfa/measurement/api/v2alpha/measurements_service.proto @@ -155,8 +155,9 @@ message BatchCreateMeasurementsRequest { (google.api.field_behavior) = REQUIRED ]; - // The requests specifying the `Measurement`s to create. A maximum of 50 - // `Measurement`s can be created in a single batch. + // The requests specifying the `Measurement`s to create. Either all requests + // must have the same parent or all requests must leave the parent unset. A + // maximum of 50 `Measurement`s can be created in a single batch. repeated CreateMeasurementRequest requests = 2 [(google.api.field_behavior) = REQUIRED]; } From f228edf9028ed75d4887b51ca4c851ffa479ec5f Mon Sep 17 00:00:00 2001 From: Tristan Vuong Date: Tue, 21 Nov 2023 21:18:35 +0000 Subject: [PATCH 5/5] Add restriction in comment to BatchCreateMeasurements. --- .../wfa/measurement/api/v2alpha/measurements_service.proto | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/proto/wfa/measurement/api/v2alpha/measurements_service.proto b/src/main/proto/wfa/measurement/api/v2alpha/measurements_service.proto index 678330889..14f72e55d 100644 --- a/src/main/proto/wfa/measurement/api/v2alpha/measurements_service.proto +++ b/src/main/proto/wfa/measurement/api/v2alpha/measurements_service.proto @@ -156,8 +156,9 @@ message BatchCreateMeasurementsRequest { ]; // The requests specifying the `Measurement`s to create. Either all requests - // must have the same parent or all requests must leave the parent unset. A - // maximum of 50 `Measurement`s can be created in a single batch. + // must have the same parent and the parent must match the top-level parent, + // or all requests must leave the parent unset. A maximum of 50 `Measurement`s + // can be created in a single batch. repeated CreateMeasurementRequest requests = 2 [(google.api.field_behavior) = REQUIRED]; }