Skip to content

Commit

Permalink
Add file error handling and structure handlers factory method (#260)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukáš Pelánek authored Jan 23, 2023
1 parent e49fb74 commit d7fec64
Show file tree
Hide file tree
Showing 67 changed files with 1,227 additions and 841 deletions.
22 changes: 21 additions & 1 deletion cpp/backend/common/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ cc_library(
deps = [
":page",
":page_id",
"//common:status_util",
"//common:fstream",
"@com_google_absl//absl/status:status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings:str_format",
],
)

Expand All @@ -45,6 +50,7 @@ cc_test(
deps = [
":file",
"//common:file_util",
"//common:status_test_util",
"@com_google_googletest//:gtest_main",
],
)
Expand All @@ -56,8 +62,10 @@ cc_binary(
deps = [
":file",
"//common:file_util",
"//third_party/gperftools:profiler",
"//common:status_test_util",
"@com_github_google_benchmark//:benchmark_main",
"@com_google_absl//absl/status:statusor",
"//third_party/gperftools:profiler",
],
)

Expand Down Expand Up @@ -100,6 +108,9 @@ cc_library(
":file",
":page_id",
"//common:memory_usage",
"//common:status_util",
"@com_google_absl//absl/status:status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/container:flat_hash_map",
],
)
Expand All @@ -110,6 +121,7 @@ cc_test(
deps = [
":page",
":page_pool",
"//common:status_test_util",
"@com_google_googletest//:gtest_main",
],
)
Expand All @@ -121,9 +133,11 @@ cc_binary(
":access_pattern",
":eviction_policy",
":page_pool",
"//common:status_test_util",
"//third_party/gperftools:profiler",
"@com_github_google_benchmark//:benchmark_main",
],
testonly = True,
)

cc_library(
Expand All @@ -134,6 +148,7 @@ cc_library(
":page",
":page_id",
":page_pool",
"@com_google_absl//absl/status:statusor",
],
)

Expand All @@ -144,5 +159,10 @@ cc_test(
":page_manager",
"//common:status_test_util",
"@com_google_googletest//:gtest_main",
"@com_github_google_benchmark//:benchmark_main",
"@com_google_absl//absl/status:status",
"@com_google_absl//absl/status:statusor",
"//third_party/gperftools:profiler",
],
testonly = True,
)
2 changes: 1 addition & 1 deletion cpp/backend/common/access_pattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Sequential {
std::size_t next_;
};

// Simulates an uniformely distributed access pattern to a range of
// Simulates an uniformly distributed access pattern to a range of
// [0,...,size).
class Uniform {
public:
Expand Down
4 changes: 2 additions & 2 deletions cpp/backend/common/eviction_policy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace carmen::backend {

namespace {

// Selects a alement for the given set to be evicted according to the provided
// Selects an element for the given set to be evicted according to the provided
// eviction pattern. The EvictionPattern needs to provide a Next() function
// providing a random slot to be evicted. The next higher value present in the
// set is then chosen to be evicted.
Expand Down Expand Up @@ -106,7 +106,7 @@ void LeastRecentlyUsedEvictionPolicy::Read(std::size_t position) {
}

void LeastRecentlyUsedEvictionPolicy::Written(std::size_t position) {
// This policy does not distinguish between read an writes.
// This policy does not distinguish between read and writes.
Read(position);
}

Expand Down
4 changes: 2 additions & 2 deletions cpp/backend/common/eviction_policy_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ BENCHMARK(BM_UniformWriteTest<RandomEvictionPolicy>)
BENCHMARK(BM_UniformWriteTest<LeastRecentlyUsedEvictionPolicy>)
->Range(kMinPoolSize, kMaxPoolSize);

// Evalutes the performance of removing elements from the pool.
// Evaluates the performance of removing elements from the pool.
template <EvictionPolicy Policy>
void BM_UniformRemoveTest(benchmark::State& state) {
auto pool_size = state.range(0);
Expand All @@ -81,7 +81,7 @@ BENCHMARK(BM_UniformRemoveTest<RandomEvictionPolicy>)
BENCHMARK(BM_UniformRemoveTest<LeastRecentlyUsedEvictionPolicy>)
->Range(kMinPoolSize, kMaxPoolSize);

// Evalutes the performance of selecting pages to be evicted.
// Evaluates the performance of selecting pages to be evicted.
template <EvictionPolicy Policy>
void BM_GetPageToEvictTest(benchmark::State& state) {
auto pool_size = state.range(0);
Expand Down
Loading

0 comments on commit d7fec64

Please sign in to comment.