Skip to content

Commit

Permalink
Create ExchangeCheckpoint protobuf message for Kingdom-less panel mat…
Browse files Browse the repository at this point in the history
…ch (#1675)
  • Loading branch information
robinsons committed Jul 3, 2024
1 parent 30a9ae4 commit 20c48db
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/main/proto/wfa/panelmatch/client/internal/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@ load("@wfa_rules_kotlin_jvm//kotlin:defs.bzl", "kt_jvm_proto_library")

package(default_visibility = ["//visibility:public"])

proto_library(
name = "exchange_checkpoint_proto",
srcs = ["exchange_checkpoint.proto"],
deps = [
":exchange_step_attempt_proto",
":exchange_workflow_proto",
"@com_google_googleapis//google/type:date_proto",
"@com_google_protobuf//:timestamp_proto",
],
)

kt_jvm_proto_library(
name = "exchange_checkpoint_kt_jvm_proto",
deps = [":exchange_checkpoint_proto"],
)

proto_library(
name = "exchange_step_attempt_proto",
srcs = ["exchange_step_attempt.proto"],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
// Copyright 2024 The Cross-Media Measurement Authors
//
// 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.

syntax = "proto3";

package wfa.panelmatch.client.internal;

import "google/protobuf/timestamp.proto";
import "google/type/date.proto";
import "wfa/panelmatch/client/internal/exchange_step_attempt.proto";
import "wfa/panelmatch/client/internal/exchange_workflow.proto";

option java_package = "org.wfanet.panelmatch.client.internal";
option java_multiple_files = true;

// Tracks the progress of an exchange for a single party. For a Kingdom-less
// exchange, both parties keep a single checkpoint for each exchange date.
// Together, the two checkpoints for a given exchange date can be used to
// determine the current state of the exchange.
message ExchangeCheckpoint {
// The party that owns this checkpoint.
ExchangeWorkflow.Party party = 1;

// ID of the recurring exchange for this checkpoint.
string recurring_exchange_id = 2;

// Date of the exchange.
google.type.Date exchange_date = 3;

// Cryptographically secure fingerprint of the workflow being executed. The
// fingerprint is of the pre-shared serialized workflow which both parties
// have a copy of. This can be compared against the fingerprint in the other
// party's checkpoint to verify that both parties are running the same
// workflow.
bytes workflow_fingerprint = 4;

// Progress info about a single exchange step attempt.
message ProgressEntry {
// Details about an attempt of an exchange step.
ExchangeStepAttempt attempt = 1;

// Time when the attempt began.
google.protobuf.Timestamp start_time = 2;

// Time when the attempt reached a terminal state. Unset if the attempt is
// still in progress.
google.protobuf.Timestamp end_time = 3;
}

// Progress entries for all exchange step attempts by the party that owns
// this checkpoint. When a new attempt is claimed, it as appended to the end
// of this list. Entries are modified by the owning party when the attempt
// reaches a terminal state.
repeated ProgressEntry progress_entries = 5;

// State of the exchange from the perspective of the party that owns this
// checkpoint.
enum ExchangeState {
EXCHANGE_STATE_UNSPECIFIED = 0;

// The exchange is still in-progress. Indicates that this party is
// currently executing an exchange step, or has further steps remaining to
// execute (which may be currently blocked).
IN_PROGRESS = 1;

// All steps belonging to this party have completed successfully. If both
// parties reach this state, then the entire exchange is considered to have
// completed successfully.
//
// Terminal state.
SUCCEEDED = 2;

// One or more steps belonging to this party have failed permanently. If
// either party reaches this state, then the entire exchange is considered
// to have failed.
//
// Terminal state.
FAILED = 3;
}
ExchangeState exchange_state = 6;
}

0 comments on commit 20c48db

Please sign in to comment.