Skip to content

gRPC: Use oneof clause where appropriate #2593

Closed
@cmaglie

Description

@cmaglie

Describe the request

Some gRPC calls would benefit from the oneof clause, particularly all the streaming responses.

For example the PlatformInstallResponse, is currently defined as:

message PlatformInstallResponse {
  // Progress of the downloads of the platform and tool files.
  DownloadProgress progress = 1;
  // Description of the current stage of the installation.
  TaskProgress task_progress = 2;
}

could be rewritten as:

message PlatformInstallResponse {
  oneof message {
    // Progress of the downloads of the platform and tool files.
    DownloadProgress progress = 1;
    // Description of the current stage of the installation.
    TaskProgress task_progress = 2;
    // The install result.
    PlatformInstallResult result = 3;
  }
}

message PlatformInstallResult {}

making explicit the exclusive nature of the fields and reserving space for an explicit call result that could be expanded in the future.

Describe the current behavior

N/A

Arduino CLI version

nightly

Operating system

N/A

Operating system version

N/A

Additional context

Some of the gRPC calls have already been changed in a similar way, this request is to propagate the same change in all the API.

Issue checklist

  • I searched for previous requests in the issue tracker
  • I verified the feature was still missing when using the nightly build
  • My request contains all necessary details

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions