rossvideo / Catena

BSD 3-Clause "New" or "Revised" License
6 stars 2 forks source link

decouple c++ sdk from grpc headers #43

Closed mejohnnaylor closed 11 months ago

mejohnnaylor commented 11 months ago

it's ok (mandatory even) to use grpc headers in the example device.

but it's not ok to couple the device model to grpc headers.

I think the only one that is coupled at the moment is in Status.h which includes grpcpp/support/status_code_enum.h

The purpose is to have the device model throw status exceptions that include a grpc::StatusCode.

While we want to keep the codes, we don't want the tight coupling so we need a header that defines the same enum as in the grpc header w/o including it.

The grpc header is plain old C:

namespace grpc {

enum StatusCode {
  /// Not an error; returned on success.
  OK = 0,

  /// The operation was cancelled (typically by the caller).
  CANCELLED = 1,
...
}
}

we can just copy/paste this into Catena's Status.h header.