From 884a3d01b85befc16c87ac95654b134b30f4a187 Mon Sep 17 00:00:00 2001 From: Sanjay Vasandani Date: Tue, 10 Oct 2023 16:50:20 -0700 Subject: [PATCH] Fix ListExchangeSteps to not require a filter. * Expose the party of an ExchangeStep. * Fix documentation of fields in ListExchangeStepsRequest.Filter. * Drop fields from ListExchangeStepsRequest.Filter that do not make sense. --- .../measurement/api/v2alpha/exchange.proto | 7 +-- .../api/v2alpha/exchange_step.proto | 46 +++++++++++++++---- .../api/v2alpha/exchange_step_attempt.proto | 2 + .../api/v2alpha/exchange_steps_service.proto | 33 +++++-------- 4 files changed, 54 insertions(+), 34 deletions(-) diff --git a/src/main/proto/wfa/measurement/api/v2alpha/exchange.proto b/src/main/proto/wfa/measurement/api/v2alpha/exchange.proto index 4c14c245b..a2fa190ab 100644 --- a/src/main/proto/wfa/measurement/api/v2alpha/exchange.proto +++ b/src/main/proto/wfa/measurement/api/v2alpha/exchange.proto @@ -24,7 +24,8 @@ option java_package = "org.wfanet.measurement.api.v2alpha"; option java_multiple_files = true; option java_outer_classname = "ExchangeProto"; -// Represents a RecurringExchange on a specific date. +// Resource that represents an instance of a `RecurringExchange` for a single +// date. message Exchange { option (google.api.resource) = { type: "halo.wfanet.org/Exchange" @@ -38,8 +39,8 @@ message Exchange { // Resource name. string name = 1; - // Must be a complete date (no field can be unset/zero). - google.type.Date date = 2; + // Date of the Exchange. Must be a complete date (no field can be unset/zero). + google.type.Date date = 2 [(google.api.field_behavior) = REQUIRED]; // State of an `Exchange`. enum State { diff --git a/src/main/proto/wfa/measurement/api/v2alpha/exchange_step.proto b/src/main/proto/wfa/measurement/api/v2alpha/exchange_step.proto index 86304b1c4..91df85a10 100644 --- a/src/main/proto/wfa/measurement/api/v2alpha/exchange_step.proto +++ b/src/main/proto/wfa/measurement/api/v2alpha/exchange_step.proto @@ -38,18 +38,42 @@ message ExchangeStep { // Resource name. string name = 1; - // State of this `ExchangeStep`. - State state = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Serialized ExchangeWorkflow that this ExchangeStep corresponds to. - bytes serialized_exchange_workflow = 3; - - // Denormalized Exchange date. Must be a complete date (no field can be - // unset/zero). - google.type.Date exchange_date = 4; + // Denormalized `date` from the parent `Exchange`. + // + // Must be a complete date (no field can be unset/zero). + google.type.Date exchange_date = 4 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.field_behavior) = IMMUTABLE + ]; // Current index of the step inside the serialized_exchange_workflow. - int32 step_index = 5; + int32 step_index = 5 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // The party that executes this step. Required. + // + // This must be one of the parties on the ancestor `RecurringExchange`. + oneof party { + // Resource name of the `DataProvider` that executes this step. + string data_provider = 6 [ + (google.api.resource_reference).type = "halo.wfanet.org/DataProvider", + (google.api.field_behavior) = IMMUTABLE + ]; + // Resource name of the `ModelProvider` that executes this step. + string model_provider = 7 [ + (google.api.resource_reference).type = "halo.wfanet.org/ModelProvider", + (google.api.field_behavior) = IMMUTABLE + ]; + } + + // Serialized denormalized `exchange_workflow` field from the ancestor + // `RecurringExchange`. + bytes serialized_exchange_workflow = 3 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.field_behavior) = IMMUTABLE + ]; // State of an `ExchangeStep`. enum State { @@ -81,4 +105,6 @@ message ExchangeStep { // associated ExchangeStepAttempt is in state `FAILED_STEP`. FAILED = 6; } + // State of this `ExchangeStep`. + State state = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; } diff --git a/src/main/proto/wfa/measurement/api/v2alpha/exchange_step_attempt.proto b/src/main/proto/wfa/measurement/api/v2alpha/exchange_step_attempt.proto index 4d68141de..fdbd0b301 100644 --- a/src/main/proto/wfa/measurement/api/v2alpha/exchange_step_attempt.proto +++ b/src/main/proto/wfa/measurement/api/v2alpha/exchange_step_attempt.proto @@ -29,6 +29,8 @@ message ExchangeStepAttempt { option (google.api.resource) = { type: "halo.wfanet.org/ExchangeStepAttempt" pattern: "recurringExchanges/{recurring_exchange}/exchanges/{exchange}/steps/{exchange_step}/attempts/{exchange_step_attempt}" + pattern: "dataProviders/{data_provider}/recurringExchanges/{recurring_exchange}/exchanges/{exchange}/steps/{exchange_step}/attempts/{exchange_step_attempt}" + pattern: "modelProviders/{data_provider}/recurringExchanges/{recurring_exchange}/exchanges/{exchange}/steps/{exchange_step}/attempts/{exchange_step_attempt}" singular: "exchangeStepAttempt" plural: "exchangeStepAttempts" }; diff --git a/src/main/proto/wfa/measurement/api/v2alpha/exchange_steps_service.proto b/src/main/proto/wfa/measurement/api/v2alpha/exchange_steps_service.proto index d7431a6fa..024c677cf 100644 --- a/src/main/proto/wfa/measurement/api/v2alpha/exchange_steps_service.proto +++ b/src/main/proto/wfa/measurement/api/v2alpha/exchange_steps_service.proto @@ -37,7 +37,7 @@ service ExchangeSteps { rpc ClaimReadyExchangeStep(ClaimReadyExchangeStepRequest) returns (ClaimReadyExchangeStepResponse); - // Lists `ExchangeStep`s. + // Lists `ExchangeStep` resources. rpc ListExchangeSteps(ListExchangeStepsRequest) returns (ListExchangeStepsResponse) { option (google.api.method_signature) = "parent"; @@ -72,6 +72,9 @@ message ClaimReadyExchangeStepResponse { // Request message for `ListExchangeSteps` method. message ListExchangeStepsRequest { // Resource name of the parent `Exchange`. + // + // The wildcard ID (`-`) may be used in place of the `Exchange` ID to list + // across every `Exchange` in the ancestor `RecurringExchange`. string parent = 1 [ (google.api.resource_reference).type = "halo.wfanet.org/Exchange", (google.api.field_behavior) = REQUIRED @@ -94,6 +97,8 @@ message ListExchangeStepsRequest { // Filter criteria. Repeated fields are treated as logical ORs, and multiple // fields specified as logical ANDs. message Filter { + reserved 3, 4; + // Matches against the `exchange_date` field. repeated google.type.Date exchange_dates = 1; // Matches against the `state` field. @@ -101,27 +106,13 @@ message ListExchangeStepsRequest { // (-- api-linter: core::0216::state-field-output-only=disabled // aip.dev/not-precedent: This is not a resource state field. --) repeated ExchangeStep.State states = 2; - // Matches against the `event_data_provider` field of the ancestor - // `RecurringExchange`. - repeated string recurring_exchange_data_providers = 3 + + // Matches against the `data_provider` field. + string data_provider = 5 [(google.api.resource_reference).type = "halo.wfanet.org/DataProvider"]; - // Matches against the `model_provider` field of the ancestor - // `RecurringExchange`. - repeated string recurring_exchange_model_providers = 4 - [(google.api.resource_reference).type = - "halo.wfanet.org/ModelProvider"]; - - // Party name. - oneof party { - // Matches against the `event_data_provider` field of the ancestor - // `RecurringExchange`. - string data_provider = 5 [(google.api.resource_reference).type = - "halo.wfanet.org/DataProvider"]; - // Matches against the `model_provider` field of the ancestor - // `RecurringExchange`. - string model_provider = 6 [(google.api.resource_reference).type = - "halo.wfanet.org/ModelProvider"]; - } + // Matches against the `model_provider` field. + string model_provider = 6 [(google.api.resource_reference).type = + "halo.wfanet.org/ModelProvider"]; } // Filter criteria for this request. //