Skip to content

Commit

Permalink
feat(snapshot): replace ServerFamily::Load error with GenericError
Browse files Browse the repository at this point in the history
  • Loading branch information
andydunstall committed Sep 12, 2023
1 parent 5048211 commit 29c604e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/server/server_family.cc
Original file line number Diff line number Diff line change
Expand Up @@ -507,12 +507,12 @@ struct AggregateLoadResult {
// Load starts as many fibers as there are files to load each one separately.
// It starts one more fiber that waits for all load fibers to finish and returns the first
// error (if any occured) with a future.
Future<std::error_code> ServerFamily::Load(const std::string& load_path) {
Future<GenericError> ServerFamily::Load(const std::string& load_path) {
auto paths_result = snapshot_storage_->LoadPaths(load_path);
if (!paths_result) {
LOG(ERROR) << "Failed to load snapshot: " << paths_result.error().Format();

Promise<std::error_code> ec_promise;
Promise<GenericError> ec_promise;
ec_promise.set_value(paths_result.error());
return ec_promise.get_future();
}
Expand Down Expand Up @@ -554,8 +554,8 @@ Future<std::error_code> ServerFamily::Load(const std::string& load_path) {
load_fibers.push_back(proactor->LaunchFiber(std::move(load_fiber)));
}

Promise<std::error_code> ec_promise;
Future<std::error_code> ec_future = ec_promise.get_future();
Promise<GenericError> ec_promise;
Future<GenericError> ec_future = ec_promise.get_future();

// Run fiber that empties the channel and sets ec_promise.
auto load_join_fiber = [this, aggregated_result, load_fibers = std::move(load_fibers),
Expand Down
4 changes: 2 additions & 2 deletions src/server/server_family.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class ServerFamily {

// Load snapshot from file (.rdb file or summary.dfs file) and return
// future with error_code.
Future<std::error_code> Load(const std::string& file_name);
Future<GenericError> Load(const std::string& file_name);

// used within tests.
bool IsSaving() const {
Expand Down Expand Up @@ -218,7 +218,7 @@ class ServerFamily {
void SnapshotScheduling();

Fiber snapshot_schedule_fb_;
Future<std::error_code> load_result_;
Future<GenericError> load_result_;

uint32_t stats_caching_task_ = 0;
Service& service_;
Expand Down

0 comments on commit 29c604e

Please sign in to comment.