rename RpcChannel to IpcChannel

This commit is contained in:
Сергей Маринкевич
2025-12-02 18:26:12 +07:00
parent c6fed622ee
commit 7495f540d2
7 changed files with 25 additions and 21 deletions
+15
View File
@@ -0,0 +1,15 @@
#pragma once
#include "IpcMessage.h"
// Абстракция IPC‑канала, работающего с IpcMessage.
// Живёт отдельно от RPC‑кода, чтобы транспорт не зависел от конкретной RPC‑реализации.
class IpcChannel {
public:
virtual ~IpcChannel() = default;
virtual void send(const IpcMessage& msg) = 0;
virtual IpcMessage receive() = 0;
};
+2 -3
View File
@@ -1,6 +1,6 @@
#pragma once
#include "RpcChannel.h"
#include "IpcChannel.h"
#include <fcntl.h>
#include <sys/stat.h>
@@ -10,7 +10,7 @@
// Инкапсулирует работу с файловыми дескрипторами и обмен сообщениями IpcMessage.
// readPipe — тот FIFO, который этот endpoint читает; writePipe — тот, в который пишет.
class IpcPipeChannel : public RpcChannel {
class IpcPipeChannel : public IpcChannel {
public:
IpcPipeChannel(const char* readPipe, const char* writePipe) {
// Канал не создаёт FIFO, только открывает.
@@ -55,4 +55,3 @@ private:
int fdIn_{-1};
int fdOut_{-1};
};
-10
View File
@@ -1,10 +0,0 @@
#pragma once
#include "IpcMessage.h"
class RpcChannel {
public:
virtual ~RpcChannel() = default;
virtual void send(const IpcMessage& msg) = 0;
virtual IpcMessage receive() = 0;
};
+3 -3
View File
@@ -1,10 +1,10 @@
#pragma once
#include "RpcChannel.h"
#include "IpcChannel.h"
class RpcClient {
public:
explicit RpcClient(RpcChannel& ch) : channel(ch) {}
explicit RpcClient(IpcChannel& ch) : channel(ch) {}
template<typename Ret, typename... Args>
Ret call(const std::string& method, const Args&... args) {
@@ -25,7 +25,7 @@ public:
}
private:
RpcChannel& channel;
IpcChannel& channel;
};