Skip to content

Commit d6979af

Browse files
committed
WIP
1 parent 824d4df commit d6979af

11 files changed

Lines changed: 58 additions & 7 deletions

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ file(GLOB SOURCES
33
"limestone/replication/*.cpp"
44
"limestone/partitioned_cursor/*.cpp"
55
"limestone/grpc/service/*.cpp"
6+
"limestone/grpc/backend/*.cpp"
67
"limestone/grpc/client/*.cpp"
78
"limestone/wal_sync/*.cpp"
89
)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include "backend_shared_impl.h"
2+
3+
namespace limestone::grpc::service {
4+
5+
6+
backend_shared_impl::backend_shared_impl(const boost::filesystem::path& log_dir)
7+
: log_dir_(log_dir) {}
8+
9+
std::vector<limestone::internal::wal_history::record> backend_shared_impl::list_wal_history() {
10+
// stub implementation
11+
return {};
12+
}
13+
14+
} // namespace limestone::grpc::service
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#pragma once
2+
3+
#include <vector>
4+
#include "wal_sync/wal_history.h"
5+
6+
namespace limestone::grpc::service {
7+
8+
class backend_shared_impl {
9+
public:
10+
explicit backend_shared_impl(const boost::filesystem::path& log_dir);
11+
virtual ~backend_shared_impl() = default;
12+
13+
// Shared logic for listing WAL history
14+
std::vector<limestone::internal::wal_history::record> list_wal_history();
15+
16+
private:
17+
boost::filesystem::path log_dir_;
18+
};
19+
20+
} // namespace limestone::grpc::service
File renamed without changes.

src/limestone/grpc/service/grpc_service_backend.h renamed to src/limestone/grpc/backend/grpc_service_backend.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@
1818
#include <string>
1919
#include <boost/filesystem.hpp>
2020
#include "limestone/api/datastore.h"
21+
#include "wal_sync/wal_history.h"
2122

2223
namespace limestone::grpc::service {
2324

25+
using limestone::internal::wal_history;
26+
2427
// Pure interface for gRPC backends.
2528
// Implementations: inproc_backend, standalone_backend.
2629
class grpc_service_backend {
@@ -30,6 +33,9 @@ class grpc_service_backend {
3033
// Factory helpers (unchanged)
3134
static std::unique_ptr<grpc_service_backend> create_inproc(limestone::api::datastore& store);
3235
static std::unique_ptr<grpc_service_backend> create_standalone(const boost::filesystem::path& log_dir);
36+
37+
// Returns the list of WAL history records.
38+
virtual std::vector<wal_history::record> list_wal_history() = 0;
3339

3440
protected:
3541
grpc_service_backend() = default;

src/limestone/grpc/service/inproc_backend.cpp renamed to src/limestone/grpc/backend/inproc_backend.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/*
32
* Copyright 2022-2025 Project Tsurugi.
43
*
@@ -25,5 +24,11 @@ inproc_backend::inproc_backend(limestone::api::datastore& store)
2524
// store_ already initialized by member initializer list
2625
}
2726

27+
std::vector<wal_history::record> inproc_backend::list_wal_history() {
28+
// stub implementation
29+
return {};
30+
}
31+
32+
2833

2934
} // namespace limestone::grpc::service

src/limestone/grpc/service/inproc_backend.h renamed to src/limestone/grpc/backend/inproc_backend.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/*
32
* Copyright 2022-2025 Project Tsurugi.
43
*
@@ -16,6 +15,7 @@
1615
*/
1716
#pragma once
1817

18+
#include <vector>
1919
#include "grpc_service_backend.h"
2020

2121
namespace limestone::grpc::service {
@@ -25,8 +25,10 @@ class inproc_backend : public grpc_service_backend {
2525
explicit inproc_backend(limestone::api::datastore& store);
2626
~inproc_backend() override = default;
2727

28+
std::vector<wal_history::record> list_wal_history() override;
2829
private:
2930
limestone::api::datastore& store_;
3031
};
3132

3233
} // namespace limestone::grpc::service
34+
// Move file to src/limestone/grpc/service/backend/inproc_backend.h

src/limestone/grpc/service/standalone_backend.cpp renamed to src/limestone/grpc/backend/standalone_backend.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@
1818

1919
namespace limestone::grpc::service {
2020

21-
22-
23-
2421
standalone_backend::standalone_backend(const boost::filesystem::path& log_dir)
2522
: log_dir_(log_dir)
2623
{
2724
// log_dir_ already initialized by member initializer list
2825
}
2926

27+
std::vector<wal_history::record> standalone_backend::list_wal_history() {
28+
// stub implementation
29+
return {};
30+
}
31+
3032
} // namespace limestone::grpc::service
3133

src/limestone/grpc/service/standalone_backend.h renamed to src/limestone/grpc/backend/standalone_backend.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/*
32
* Copyright 2022-2025 Project Tsurugi.
43
*
@@ -16,6 +15,7 @@
1615
*/
1716
#pragma once
1817

18+
#include <vector>
1919
#include "grpc_service_backend.h"
2020

2121
namespace limestone::grpc::service {
@@ -25,6 +25,7 @@ class standalone_backend : public grpc_service_backend {
2525
explicit standalone_backend(const boost::filesystem::path& log_dir);
2626
~standalone_backend() override = default;
2727

28+
std::vector<wal_history::record> list_wal_history() override;
2829
private:
2930
boost::filesystem::path log_dir_;
3031
};

test/limestone/grpc/grpc_service_backend_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#include <gtest/gtest.h>
1818
#include <boost/filesystem.hpp>
19-
#include "limestone/grpc/service/grpc_service_backend.h"
19+
#include "limestone/grpc/backend/grpc_service_backend.h"
2020
#include "limestone/api/datastore.h"
2121
#include "test_root.h"
2222
#include "limestone/api/configuration.h"

0 commit comments

Comments
 (0)