Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap types to prepare for the Any type #30

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion proto/relay.proto
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ message RelayPayload {
self_serve.orb.v1.AgeVerificationRequiredFromOperator age_verification_required_from_operator = 14;
self_serve.app.v1.StartCapture start_capture = 15;
self_serve.app.v1.RequestState request_state = 16;
self_serve.orb.v1.SelfServeStatus self_serve_status = 17;
self_serve.orb.v1.NoState no_state = 18;
Copy link
Contributor

@paulquinn00 paulquinn00 Oct 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im a bit torn if the Any field should be inside the oneof at this moment. When we move fully to using the any_payload field we will want to remove the oneof completely and have the any_payload remain alone (is this agreeable to all?).

I believe doing this is not a breaking change so it may not be urgent, but there are side-effects: https://stackoverflow.com/questions/72746051/do-oneof-fields-show-up-on-the-wire-is-it-safe-to-move-a-field-out-of-a-oneof

One nit for hygiene is to number the any_payload field to be 100 (or any number outside the range used in the oneof) so we can cleanly reserve those old field numbers when the oneof goes away.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I completely agree and I have further changes later on. But I wanted to break this down to smaller, easier to review steps. Here is how I envision the final message: 164632d

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the preview. I like it!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also like the preview, that would be my choice also

self_serve.orb.v1.CaptureTriggerTimeout capture_trigger_timeout = 19;

Expand Down
10 changes: 10 additions & 0 deletions proto/self_serve/app/v1/app.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ syntax = "proto3";

package self_serve.app.v1;

// Wrapper message for all messages that can be sent to and from the app. The reason we do this is to ensure static
// typing in the clients while the server can still handle all messages through the Any type.
message W {
ldulcic marked this conversation as resolved.
Show resolved Hide resolved
oneof w {
StartCapture start_capture = 1;
RequestState request_state = 2;
AbortSignup abort_signup = 3;
paulquinn00 marked this conversation as resolved.
Show resolved Hide resolved
}
}

message StartCapture {}
message RequestState {}
message AbortSignup {}
64 changes: 44 additions & 20 deletions proto/self_serve/orb/v1/orb.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,65 @@ syntax = "proto3";

package self_serve.orb.v1;

message NoState {}
message SelfServeStatus {
bool is_self_serve_enabled = 1;
// Wrapper message for all messages that can be sent to and from the orb. The reason we do this is to ensure static
// typing in the clients while the server can still handle all messages through the Any type.
message W {
oneof w {
NoState no_state = 1;
AnnounceOrbId announce_orb_id = 2;
CaptureStarted capture_started = 3;
CaptureTriggerTimeout capture_trigger_timeout = 4;
CaptureEnded capture_ended = 5;
SignupEnded signup_ended = 6;
AgeVerificationRequiredFromOperator age_verification_required_from_operator = 7;
paulquinn00 marked this conversation as resolved.
Show resolved Hide resolved
}
}

message NoState {}
message AnnounceOrbId {
enum ModeType {
MODE_TYPE_UNSPECIFIED = 0;
MODE_TYPE_LEGACY = 1;
MODE_TYPE_SELF_SERVE = 2;
}

enum HardwareType {
HARDWARE_TYPE_UNSPECIFIED = 0;
HARDWARE_TYPE_PEARL = 1;
HARDWARE_TYPE_DIAMOND = 2;
}

string orb_id = 1;
bool is_self_serve_enabled = 2;
ModeType mode_type = 2;
HardwareType hardware_type = 3;
}
message CaptureStarted {}
message CaptureTriggerTimeout {}
message CaptureEnded {
enum FailureFeedbackType {
UNKNOWN = 0;
FACE_OCCLUSION_OR_POOR_LIGHTING = 1;
TOO_FAR = 2;
TOO_CLOSE = 3;
EYES_OCCLUSION = 4;
FAILURE_FEEDBACK_TYPE_UNSPECIFIED = 0;
FAILURE_FEEDBACK_TYPE_FACE_OCCLUSION_OR_POOR_LIGHTING = 1;
FAILURE_FEEDBACK_TYPE_TOO_FAR = 2;
FAILURE_FEEDBACK_TYPE_TOO_CLOSE = 3;
FAILURE_FEEDBACK_TYPE_EYES_OCCLUSION = 4;
}

bool success = 1;
repeated FailureFeedbackType failure_feedback = 2;
}
message SignupEnded {
enum FailureFeedbackType {
UNKNOWN = 0;
CONTACT_LENSES = 1;
EYE_GLASSES = 2;
MASK = 3;
FACE_OCCLUSION = 4;
MULTIPLE_FACES = 5;
EYES_OCCLUSION = 6;
HEAD_POSE = 7;
UNDERAGED = 8;
SERVER_ERROR = 9;
LOW_IMAGE_QUALITY = 10;
FAILURE_FEEDBACK_TYPE_UNSPECIFIED = 0;
FAILURE_FEEDBACK_TYPE_CONTACT_LENSES = 1;
FAILURE_FEEDBACK_TYPE_EYE_GLASSES = 2;
FAILURE_FEEDBACK_TYPE_MASK = 3;
FAILURE_FEEDBACK_TYPE_FACE_OCCLUSION = 4;
FAILURE_FEEDBACK_TYPE_MULTIPLE_FACES = 5;
FAILURE_FEEDBACK_TYPE_EYES_OCCLUSION = 6;
FAILURE_FEEDBACK_TYPE_HEAD_POSE = 7;
FAILURE_FEEDBACK_TYPE_UNDERAGED = 8;
FAILURE_FEEDBACK_TYPE_SERVER_ERROR = 9;
FAILURE_FEEDBACK_TYPE_LOW_IMAGE_QUALITY = 10;
}

bool success = 1;
Expand Down
Loading