-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replaced scan_info definition with the range class #129
Changes from 1 commit
5323388
e8c2287
75b8abf
bb0ff5e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright 2018-2023 Project Tsurugi. | ||
* Copyright 2018-2024 Project Tsurugi. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
|
@@ -24,7 +24,7 @@ | |
#include <jogasaki/executor/common/task.h> | ||
#include <jogasaki/executor/io/reader_container.h> | ||
#include <jogasaki/executor/io/record_writer.h> | ||
#include <jogasaki/executor/process/abstract/scan_info.h> | ||
#include <jogasaki/executor/process/abstract/range.h> | ||
#include <jogasaki/executor/process/abstract/task_context.h> | ||
#include <jogasaki/model/step.h> | ||
#include <jogasaki/model/task.h> | ||
|
@@ -43,12 +43,12 @@ class task_context : public abstract::task_context { | |
std::vector<io::reader_container> readers = {}, | ||
std::vector<std::shared_ptr<io::record_writer>> downstream_writers = {}, | ||
std::shared_ptr<io::record_writer> external_writer = {}, | ||
std::shared_ptr<abstract::scan_info> info = {} | ||
std::shared_ptr<abstract::range> range = {} | ||
) : | ||
readers_(std::move(readers)), | ||
downstream_writers_(std::move(downstream_writers)), | ||
external_writer_(std::move(external_writer)), | ||
scan_info_(std::move(info)) | ||
range_(std::move(range)) | ||
{} | ||
|
||
io::reader_container reader(reader_index idx) override { | ||
|
@@ -76,10 +76,9 @@ class task_context : public abstract::task_context { | |
external_writer_->release(); | ||
external_writer_.reset(); | ||
} | ||
scan_info_.reset(); | ||
} | ||
|
||
class abstract::scan_info const* scan_info() override { | ||
class abstract::range const* range() override { | ||
return nullptr; | ||
} | ||
|
||
|
@@ -95,7 +94,6 @@ class task_context : public abstract::task_context { | |
std::vector<io::reader_container> readers_{}; | ||
std::vector<std::shared_ptr<io::record_writer>> downstream_writers_{}; | ||
std::shared_ptr<io::record_writer> external_writer_{}; | ||
std::shared_ptr<abstract::scan_info> scan_info_{}; | ||
std::shared_ptr<abstract::range> range_{}; | ||
}; | ||
|
||
} | ||
} // namespace jogasaki::executor::process::mock | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ここも空行を維持でお願いします。 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright 2018-2023 Project Tsurugi. | ||
* Copyright 2018-2024 Project Tsurugi. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
|
@@ -126,4 +126,21 @@ aligned_buffer& aligned_buffer::assign(std::string_view sv) { | |
return assign(aligned_buffer{sv}); | ||
} | ||
|
||
} // namespace | ||
void aligned_buffer::dump(std::ostream& out, int indent) const noexcept{ | ||
std::string indent_space(indent, ' '); | ||
out << indent_space << "aligned_buffer:" << "\n"; | ||
out << indent_space << " capacity_: " << capacity_ << "\n"; | ||
out << indent_space << " alignment_: " << alignment_ << "\n"; | ||
out << indent_space << " size_: " << size_ << "\n"; | ||
out << indent_space << " data_: " ; | ||
for (std::size_t i = 0; i < size_; ++i) { | ||
out << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(data_[i]) << " "; | ||
if ((i + 1) % 16 == 0) { | ||
out << std::endl; | ||
} | ||
} | ||
out << std::setfill(' ') << std::dec << std::endl; | ||
|
||
} | ||
|
||
} // namespace jogasaki::data | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ここも空行を維持でお願いします。 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright 2018-2023 Project Tsurugi. | ||
* Copyright 2018-2024 Project Tsurugi. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
|
@@ -18,27 +18,25 @@ | |
namespace jogasaki::executor::process::abstract { | ||
|
||
/** | ||
* @brief scan info | ||
* @details this instance provides specification of scan (e.g. definition of the range of scanned records) | ||
* @brief range | ||
* @details definition of the range of scanned records | ||
*/ | ||
class scan_info { | ||
public: | ||
class range { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 趣味の問題に近いですが、rangeという単純名だとstd::rangeみたいなものもあるので、scan_rangeあたりにしませんか?rangeだと一般名で検索でヒットしすぎるので少しだけ修飾したいという思いです。 |
||
public: | ||
/** | ||
* @brief create empty object | ||
*/ | ||
scan_info() = default; | ||
range() = default; | ||
|
||
/** | ||
* @brief destroy the object | ||
*/ | ||
virtual ~scan_info() = default; | ||
virtual ~range() = default; | ||
|
||
scan_info(scan_info const& other) = default; | ||
scan_info& operator=(scan_info const& other) = default; | ||
scan_info(scan_info&& other) noexcept = default; | ||
scan_info& operator=(scan_info&& other) noexcept = default; | ||
range(range const& other) = default; | ||
range& operator=(range const& other) = default; | ||
range(range&& other) noexcept = default; | ||
range& operator=(range&& other) noexcept = default; | ||
}; | ||
|
||
} | ||
|
||
|
||
} // namespace jogasaki::executor::process::abstract |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright 2018-2024 Project Tsurugi. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#include "bound.h" | ||
|
||
namespace jogasaki::executor::process::impl { | ||
|
||
[[nodiscard]] std::string_view bound::key() const noexcept { | ||
return {static_cast<char*>(key_->data()), len_}; | ||
} | ||
[[nodiscard]] kvs::end_point_kind bound::endpointkind() const noexcept { return endpointkind_; } | ||
void bound::dump(std::ostream& out, int indent) const noexcept { | ||
std::string indent_space(indent, ' '); | ||
out << indent_space << "bound:" | ||
<< "\n"; | ||
out << indent_space << " endpointkind_: " << endpointkind_ << "\n"; | ||
out << indent_space << " len_: " << len_ << "\n"; | ||
out << indent_space << " key_: " << *key_ << "\n"; | ||
key_->dump(out, indent + 2); | ||
} | ||
} // namespace jogasaki::executor::process::impl |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. すごい細かい話ですが、ファイルの末尾に改行だけを含む空の行を追加してもらえますか? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright 2018-2024 Project Tsurugi. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#pragma once | ||
|
||
#include <jogasaki/data/aligned_buffer.h> | ||
#include <jogasaki/kvs/storage.h> | ||
|
||
namespace jogasaki::executor::process::impl { | ||
|
||
class bound { | ||
|
||
public: | ||
bound() = default; | ||
bound(bound const& other) = delete; | ||
bound& operator=(bound const& other) = delete; | ||
bound(bound&& other) noexcept = delete; | ||
bound& operator=(bound&& other) noexcept = delete; | ||
~bound() = default; | ||
bound(kvs::end_point_kind endpointkind, std::size_t len, | ||
std::unique_ptr<data::aligned_buffer> key) | ||
: endpointkind_(endpointkind), len_(len), key_(std::move(key)) {} | ||
kvs::end_point_kind endpointkind() { return endpointkind_; }; | ||
std::unique_ptr<data::aligned_buffer> key() { return std::move(key_); }; | ||
[[nodiscard]] std::string_view key() const noexcept; | ||
[[nodiscard]] kvs::end_point_kind endpointkind() const noexcept; | ||
/** | ||
* @brief Support for debugging, callable in GDB | ||
* @param out The output stream to which the buffer's internal state will be written. | ||
* @param indent The indentation level for formatting the output, default is 0. | ||
*/ | ||
void dump(std::ostream& out, int indent = 0) const noexcept; | ||
|
||
private: | ||
kvs::end_point_kind endpointkind_{}; | ||
std::size_t len_{}; | ||
std::unique_ptr<data::aligned_buffer> key_{}; | ||
}; | ||
|
||
} // namespace jogasaki::executor::process::impl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここも空行を維持でお願いします。