Skip to content

Commit

Permalink
Fix ListExchangeSteps to not require a filter.
Browse files Browse the repository at this point in the history
* Expose the party of an ExchangeStep.
* Fix documentation of fields in ListExchangeStepsRequest.Filter.
* Drop fields from ListExchangeStepsRequest.Filter that do not make sense.
  • Loading branch information
SanjayVas committed Oct 10, 2023
1 parent 8053c5f commit 884a3d0
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 34 deletions.
7 changes: 4 additions & 3 deletions src/main/proto/wfa/measurement/api/v2alpha/exchange.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 {
Expand Down
46 changes: 36 additions & 10 deletions src/main/proto/wfa/measurement/api/v2alpha/exchange_step.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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];
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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
Expand All @@ -94,34 +97,22 @@ 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.
//
// (-- 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.
//
Expand Down

0 comments on commit 884a3d0

Please sign in to comment.