-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add TaskContext and Data as task argument (#40)
- Loading branch information
1 parent
0a896a8
commit 03d043a
Showing
20 changed files
with
649 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#ifndef SPIDER_CORE_DATAIMPL_HPP | ||
#define SPIDER_CORE_DATAIMPL_HPP | ||
|
||
#include <memory> | ||
#include <utility> | ||
|
||
#include "../client/Data.hpp" | ||
#include "../core/Data.hpp" | ||
|
||
namespace spider::core { | ||
|
||
class DataImpl { | ||
public: | ||
template <class T> | ||
static auto create_data(std::unique_ptr<Data> data, std::shared_ptr<DataStorage> data_store) | ||
-> spider::Data<T> { | ||
return spider::Data<T>{std::move(data), data_store}; | ||
} | ||
|
||
template <class T> | ||
static auto get_impl(spider::Data<T> const& data) -> std::shared_ptr<DataStorage> { | ||
return data.get_impl(); | ||
} | ||
}; | ||
|
||
} // namespace spider::core | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#ifndef SPIDER_CORE_TASKCONTEXTIMPL_HPP | ||
#define SPIDER_CORE_TASKCONTEXTIMPL_HPP | ||
|
||
#include <memory> | ||
|
||
#include "../client/TaskContext.hpp" | ||
#include "../storage/DataStorage.hpp" | ||
#include "../storage/MetadataStorage.hpp" | ||
|
||
namespace spider::core { | ||
class TaskContextImpl { | ||
public: | ||
static auto create_task_context( | ||
std::shared_ptr<DataStorage> const& data_storage, | ||
std::shared_ptr<MetadataStorage> const& metadata_storage | ||
) -> TaskContext { | ||
return TaskContext{data_storage, metadata_storage}; | ||
} | ||
|
||
static auto get_data_store(TaskContext const& task_context) -> std::shared_ptr<DataStorage> { | ||
return task_context.m_data_store; | ||
} | ||
|
||
static auto get_metadata_store(TaskContext const& task_context | ||
) -> std::shared_ptr<MetadataStorage> { | ||
return task_context.m_metadata_store; | ||
} | ||
}; | ||
|
||
} // namespace spider::core | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.