Skip to content

Commit

Permalink
Use protobuf Enum exclusively for message sent from Client (#2644)
Browse files Browse the repository at this point in the history
  • Loading branch information
aleDsz authored Jun 11, 2024
1 parent 06e9a5e commit b56fa7c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion proto/lib/livebook_proto/app_deployment_status.pb.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ defmodule LivebookProto.AppDeploymentStatus do
field :id, 1, type: :string
field :deployment_group_id, 2, type: :string, json_name: "deploymentGroupId"
field :version, 3, type: :string
field :status, 4, type: :string
field :status, 4, type: LivebookProto.AppDeploymentStatusType, enum: true
end
8 changes: 8 additions & 0 deletions proto/lib/livebook_proto/app_deployment_status_type.pb.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
defmodule LivebookProto.AppDeploymentStatusType do
use Protobuf, enum: true, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"

field :connecting, 0
field :preparing, 1
field :available, 2
field :deactivated, 99
end
16 changes: 15 additions & 1 deletion proto/messages.proto
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,25 @@ message Agent {
string deployment_group_id = 4;
}

/**
* We're only using Enum in this case because
* the Client is the source of the information,
* and the Server will always be up-to-date.
*
* Otherwise, it shouldn't be used.
*/
enum AppDeploymentStatusType {
connecting = 0;
preparing = 1;
available = 2;
deactivated = 4;
}

message AppDeploymentStatus {
string id = 1;
string deployment_group_id = 2;
string version = 3;
string status = 4;
AppDeploymentStatusType status = 4;
}

message AppDeploymentStatusReport {
Expand Down

0 comments on commit b56fa7c

Please sign in to comment.