Skip to content

Commit

Permalink
change parameter name writer_count to max_writer_count
Browse files Browse the repository at this point in the history
  • Loading branch information
t-horikawa committed Jan 20, 2025
1 parent 59118dc commit 11c66a8
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion include/tateyama/api/server/response.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class response {
* @return status::ok when successful
* @return other code when error occurs
*/
virtual status acquire_channel(std::string_view name, std::shared_ptr<data_channel>& ch, std::size_t writer_count) = 0;
virtual status acquire_channel(std::string_view name, std::shared_ptr<data_channel>& ch, std::size_t max_writer_count) = 0;

/**
* @brief release the data channel
Expand Down
8 changes: 4 additions & 4 deletions src/tateyama/endpoint/ipc/ipc_response.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,19 @@ void ipc_response::server_diagnostics(std::string_view diagnostic_record) {
server_wire_->get_response_wire().write(s.data(), tateyama::common::wire::response_header(index_, s.length(), RESPONSE_BODY));
}

tateyama::status ipc_response::acquire_channel(std::string_view name, std::shared_ptr<tateyama::api::server::data_channel>& ch, std::size_t writer_count) {
tateyama::status ipc_response::acquire_channel(std::string_view name, std::shared_ptr<tateyama::api::server::data_channel>& ch, std::size_t max_writer_count) {
if (completed_.load()) {
LOG_LP(ERROR) << "response is already completed";
set_state(state::acquire_failed);
return tateyama::status::unknown;
}
if (writer_count > (UINT8_MAX + 1)) {
LOG_LP(ERROR) << "too large writer count (" << writer_count << ") given";
if (max_writer_count > (UINT8_MAX + 1)) {
LOG_LP(ERROR) << "too large writer count (" << max_writer_count << ") given";
set_state(state::acquire_failed);
return tateyama::status::unknown;
}
try {
data_channel_ = std::make_shared<ipc_data_channel>(server_wire_->create_resultset_wires(name, writer_count), garbage_collector_);
data_channel_ = std::make_shared<ipc_data_channel>(server_wire_->create_resultset_wires(name, max_writer_count), garbage_collector_);
} catch (std::exception &ex) {
ch = nullptr;

Expand Down
4 changes: 2 additions & 2 deletions src/tateyama/endpoint/ipc/ipc_response.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018-2024 Project Tsurugi.
* Copyright 2018-2025 Project Tsurugi.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -114,7 +114,7 @@ class alignas(64) ipc_response : public tateyama::endpoint::common::response {
tateyama::status body(std::string_view body) override;
tateyama::status body_head(std::string_view body_head) override;
void error(proto::diagnostics::Record const& record) override;
tateyama::status acquire_channel(std::string_view name, std::shared_ptr<tateyama::api::server::data_channel>& ch, std::size_t writer_count) override;
tateyama::status acquire_channel(std::string_view name, std::shared_ptr<tateyama::api::server::data_channel>& ch, std::size_t max_writer_count) override;
tateyama::status release_channel(tateyama::api::server::data_channel& ch) override;

private:
Expand Down
8 changes: 4 additions & 4 deletions src/tateyama/endpoint/loopback/loopback_response.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018-2023 Project Tsurugi.
* Copyright 2018-2025 Project Tsurugi.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,9 +23,9 @@ namespace tateyama::endpoint::loopback {

tateyama::status loopback_response::acquire_channel(std::string_view name,
std::shared_ptr<tateyama::api::server::data_channel> &ch,
std::size_t writer_count) {
if (writer_count > (UINT8_MAX + 1)) {
LOG_LP(ERROR) << "too large writer count (" << writer_count << ") given";
std::size_t max_writer_count) {
if (max_writer_count > (UINT8_MAX + 1)) {
LOG_LP(ERROR) << "too large writer count (" << max_writer_count << ") given";
return tateyama::status::unknown;
}

Expand Down
4 changes: 2 additions & 2 deletions src/tateyama/endpoint/loopback/loopback_response.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018-2023 Project Tsurugi.
* Copyright 2018-2025 Project Tsurugi.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -76,7 +76,7 @@ class loopback_response: public tateyama::api::server::response {
/**
* @see tateyama::server::response::acquire_channel()
*/
tateyama::status acquire_channel(std::string_view name, std::shared_ptr<tateyama::api::server::data_channel> &ch, std::size_t writer_count)
tateyama::status acquire_channel(std::string_view name, std::shared_ptr<tateyama::api::server::data_channel> &ch, std::size_t max_writer_count)
override;

/**
Expand Down
6 changes: 3 additions & 3 deletions src/tateyama/endpoint/stream/stream_response.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ void stream_response::server_diagnostics(std::string_view diagnostic_record) {
stream_->send(index_, s, true);
}

tateyama::status stream_response::acquire_channel(std::string_view name, std::shared_ptr<tateyama::api::server::data_channel>& ch, std::size_t writer_count) {
if (writer_count > (UINT8_MAX + 1)) {
LOG_LP(ERROR) << "too large writer count (" << writer_count << ") given";
tateyama::status stream_response::acquire_channel(std::string_view name, std::shared_ptr<tateyama::api::server::data_channel>& ch, std::size_t max_writer_count) {
if (max_writer_count > (UINT8_MAX + 1)) {
LOG_LP(ERROR) << "too large writer count (" << max_writer_count << ") given";
set_state(state::acquire_failed);
return tateyama::status::unknown;
}
Expand Down
4 changes: 2 additions & 2 deletions src/tateyama/endpoint/stream/stream_response.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018-2023 Project Tsurugi.
* Copyright 2018-2025 Project Tsurugi.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -94,7 +94,7 @@ class alignas(64) stream_response : public tateyama::endpoint::common::response
tateyama::status body(std::string_view body) override;
tateyama::status body_head(std::string_view body_head) override;
void error(proto::diagnostics::Record const& record) override;
tateyama::status acquire_channel(std::string_view name, std::shared_ptr<tateyama::api::server::data_channel>& ch, std::size_t writer_count) override;
tateyama::status acquire_channel(std::string_view name, std::shared_ptr<tateyama::api::server::data_channel>& ch, std::size_t max_writer_count) override;
tateyama::status release_channel(tateyama::api::server::data_channel& ch) override;

private:
Expand Down

0 comments on commit 11c66a8

Please sign in to comment.