pytorch/torch/csrc/distributed/c10d/Store.cpp
Aaron Gokaslan 97db9fde69 Fix header-filter for clang-tidy c10 and apply some fixes to c10 and … (#91178)
…c10d

Fixes a broken header filters from #90699 and applies a few more clang-tidy fixes that are relevant from c10 and c10d. The header filter pattern was actually broken and the clang-tidy include pattern was redundant. Also fixed a few bugs in torch/distributed/c10d

Pull Request resolved: https://github.com/pytorch/pytorch/pull/91178
Approved by: https://github.com/ezyang
2022-12-27 07:34:12 +00:00

41 lines
1.1 KiB
C++

#include <torch/csrc/distributed/c10d/Store.hpp>
namespace c10d {
constexpr std::chrono::milliseconds Store::kDefaultTimeout;
constexpr std::chrono::milliseconds Store::kNoTimeout;
// Define destructor symbol for abstract base class.
Store::~Store() = default;
const std::chrono::milliseconds& Store::getTimeout() const noexcept {
return timeout_;
}
// Set timeout function
void Store::setTimeout(const std::chrono::milliseconds& timeout) {
timeout_ = timeout;
}
void Store::set(const std::string& key, const std::string& value) {
set(key, std::vector<uint8_t>(value.begin(), value.end()));
}
std::string Store::compareSet(
const std::string& key,
const std::string& currentValue,
const std::string& newValue) {
auto value = compareSet(
key,
std::vector<uint8_t>(currentValue.begin(), currentValue.end()),
std::vector<uint8_t>(newValue.begin(), newValue.end()));
return std::string(value.begin(), value.end());
}
std::string Store::get_to_str(const std::string& key) {
auto value = get(key);
return std::string(value.begin(), value.end());
}
} // namespace c10d