1// SPDX-License-Identifier: GPL-3.0-or-later
2
3#pragma once
4
5#include "blockdev.h"
6#include "gptdisk.hpp"
7#include "proto/blockdev.services.h"
8
9#include <librpc/rpc.h>
10#include <librpc/rpc_client.h>
11#include <librpc/rpc_server++.hpp>
12#include <memory>
13#include <pb_decode.h>
14
15using namespace mosrpc::blockdev;
16
17extern std::unique_ptr<BlockdevManagerStub> manager;
18
19class GPTLayerServer : public IBlockdevLayerService
20{
21 public:
22 explicit GPTLayerServer(std::shared_ptr<GPTDisk> disk, const std::string &servername);
23
24 private:
25 virtual rpc_result_code_t read_partition_block(rpc_context_t *context, mosrpc_blockdev_read_partition_block_request *req, read_block::response *resp) override;
26 virtual rpc_result_code_t write_partition_block(rpc_context_t *context, mosrpc_blockdev_write_partition_block_request *req, write_block::response *resp) override;
27
28 private:
29 std::shared_ptr<GPTDisk> disk;
30};
31