Skip to content

Commit 55e0717

Browse files
committed
use grpcchannel alias in public headers
1 parent e6a493e commit 55e0717

File tree

4 files changed

+12
-19
lines changed

4 files changed

+12
-19
lines changed

src/viam/sdk/module/module.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#pragma once
22

3+
#include <viam/sdk/common/grpc_client_fwd.hpp>
34
#include <viam/sdk/module/handler_map.hpp>
45
#include <viam/sdk/resource/resource.hpp>
56
#include <viam/sdk/resource/resource_manager.hpp>
@@ -18,14 +19,14 @@ class Module {
1819
bool ready() const;
1920
const HandlerMap_& handles() const;
2021
HandlerMap_& mutable_handles();
21-
const std::shared_ptr<grpc::Channel>& channel() const;
22+
const std::shared_ptr<GrpcChannel>& channel() const;
2223

2324
private:
2425
std::string name_;
2526
std::string addr_;
2627
bool ready_;
2728
HandlerMap_ handles_;
28-
std::shared_ptr<grpc::Channel> channel_;
29+
std::shared_ptr<GrpcChannel> channel_;
2930
};
3031

3132
} // namespace sdk

src/viam/sdk/registry/registry.hpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,14 @@
1010
#include <grpcpp/impl/service_type.h>
1111
#include <grpcpp/server.h>
1212

13+
#include <viam/sdk/common/grpc_client_fwd.hpp>
1314
#include <viam/sdk/config/resource.hpp>
1415
#include <viam/sdk/resource/resource.hpp>
1516
#include <viam/sdk/resource/resource_api.hpp>
1617
#include <viam/sdk/resource/resource_manager.hpp>
1718
#include <viam/sdk/resource/resource_server_base.hpp>
1819
#include <viam/sdk/rpc/server.hpp>
1920

20-
namespace grpc {
21-
22-
class Channel;
23-
24-
}
25-
2621
namespace viam {
2722
namespace sdk {
2823

@@ -60,7 +55,7 @@ class ResourceClientRegistration {
6055
/// @param channel A channel connected to the client.
6156
/// @return A `shared_ptr` to the resource client.
6257
virtual std::shared_ptr<Resource> create_rpc_client(
63-
std::string name, std::shared_ptr<grpc::Channel> channel) const = 0;
58+
std::string name, std::shared_ptr<GrpcChannel> channel) const = 0;
6459
};
6560

6661
// TODO(RSDK-6616): instead of std::functions, consider making these functions
@@ -130,7 +125,7 @@ class Registry {
130125
using ResourceClientRegistration::ResourceClientRegistration;
131126

132127
std::shared_ptr<Resource> create_rpc_client(
133-
std::string name, std::shared_ptr<grpc::Channel> chan) const override {
128+
std::string name, std::shared_ptr<GrpcChannel> chan) const override {
134129
return std::make_shared<ResourceClientT>(std::move(name), std::move(chan));
135130
}
136131
};

src/viam/sdk/robot/client.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <string>
77
#include <thread>
88

9+
#include <viam/sdk/common/grpc_client_fwd.hpp>
910
#include <viam/sdk/common/pose.hpp>
1011
#include <viam/sdk/common/utils.hpp>
1112
#include <viam/sdk/common/world_state.hpp>
@@ -148,7 +149,7 @@ class RobotClient {
148149
std::vector<std::shared_ptr<std::thread>> threads_;
149150
std::atomic<bool> should_refresh_;
150151
unsigned int refresh_interval_;
151-
std::shared_ptr<grpc::Channel> channel_;
152+
std::shared_ptr<GrpcChannel> channel_;
152153
std::shared_ptr<ViamChannel> viam_channel_;
153154
bool should_close_channel_;
154155
struct impl;

src/viam/sdk/rpc/dial.hpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@
55

66
#include <boost/optional.hpp>
77

8-
namespace grpc {
9-
10-
class Channel;
11-
12-
}
8+
#include <viam/sdk/common/grpc_client_fwd.hpp>
139

1410
namespace viam {
1511
namespace sdk {
@@ -18,14 +14,14 @@ class DialOptions;
1814
class ViamChannel {
1915
public:
2016
void close();
21-
ViamChannel(std::shared_ptr<grpc::Channel> channel, const char* path, void* runtime);
17+
ViamChannel(std::shared_ptr<GrpcChannel> channel, const char* path, void* runtime);
2218
static std::shared_ptr<ViamChannel> dial(const char* uri,
2319
const boost::optional<DialOptions>& options);
2420

25-
const std::shared_ptr<grpc::Channel>& channel() const;
21+
const std::shared_ptr<GrpcChannel>& channel() const;
2622

2723
private:
28-
std::shared_ptr<grpc::Channel> channel_;
24+
std::shared_ptr<GrpcChannel> channel_;
2925
const char* path_;
3026
bool closed_;
3127
void* rust_runtime_;

0 commit comments

Comments
 (0)