-
Notifications
You must be signed in to change notification settings - Fork 323
feat etcd: Init etcd client #837
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
base: develop
Are you sure you want to change the base?
Conversation
#pragma once | ||
|
||
#include <chrono> | ||
#include <cstdint> |
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.
давай сразу клиента конфига сделаешь до полноценного watch event'а - так будет проще понять, какой API требуется и что еще необходимо сделать
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.
Кажется, сделал, получать ивенты можно из WatchListener'а
@@ -444,7 +444,7 @@ def _gen_string( | |||
|
|||
if schema.format: | |||
if schema.format == types.StringFormat.BYTE: | |||
format_cpp_type = 'crypto::base64::String64' | |||
format_cpp_type = '::crypto::base64::String64' |
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.
USERVER_NAMESPACE::
@@ -18,9 +18,9 @@ USERVER_NAMESPACE_BEGIN | |||
|
|||
namespace chaotic::convert { | |||
|
|||
crypto::base64::String64 Convert(const std::string& str, chaotic::convert::To<crypto::base64::String64>); | |||
::crypto::base64::String64 Convert(const std::string& str, chaotic::convert::To<::crypto::base64::String64>); |
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.
USERVER_NAMESPACE::
@@ -369,7 +369,7 @@ TEST(Simple, Uuid) { | |||
} | |||
|
|||
TEST(SIMPLE, String64) { | |||
auto str64 = crypto::base64::String64{"hello, userver!"}; | |||
auto str64 = ::crypto::base64::String64{"hello, userver!"}; |
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.
USERVER_NAMESPACE::
@@ -54,7 +54,7 @@ def test_byte(simple_gen): | |||
assert types == { | |||
'::type': cpp_types.CppStringWithFormat( | |||
raw_cpp_type=type_name.TypeName('std::string'), | |||
format_cpp_type='crypto::base64::String64', | |||
format_cpp_type='::crypto::base64::String64', |
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.
USERVER_NAMESPACE::
WatchListener(concurrent::SpscQueue<KeyValueState>::Consumer&& consumer); | ||
|
||
/// @brief Get an event from etcd if there was one, otherwise waits asynchronously until a next event occurs. | ||
/// If the event producing coroutine finished or failed, GetEvent raises EtcdError exception |
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.
|
||
std::string BuildDeleteData(std::string_view key) { | ||
const auto etcd_key = fmt::format("{}{}", kKeyPrefix, key); | ||
return formats::json::ToString(formats::json::MakeObject("key", crypto::base64::Base64Encode(etcd_key))); |
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.
везде где есть base64 - в хаотик
|
||
constexpr std::uint32_t kDefaultAttempts{3}; | ||
constexpr std::chrono::milliseconds kDefaultRequestTimeout{1'000}; | ||
constexpr std::chrono::milliseconds kDefaultWatchTimeout{1'000'000}; |
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.
1000 секунд всего? а что будет когда истечет?
// Etcd endpoints to which client make HTTP requests | ||
std::vector<std::string> endpoints; | ||
// Number of attempts to each endpoint, on failed attempts client randomly moves to another endpoint | ||
std::uint32_t attempts; |
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.
{1}
// Number of attempts to each endpoint, on failed attempts client randomly moves to another endpoint | ||
std::uint32_t attempts; | ||
// Timeout for all HTTP requests to etcd except watch request | ||
std::chrono::microseconds request_timeout_ms; |
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.
{дефолт}
std::chrono::microseconds request_timeout_ms; | ||
// Timeout for watch HTTP request. It's a stremed request, so it is used also as a connection timeout, so it should | ||
// not be too short | ||
std::chrono::microseconds watch_timeout_ms; |
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.
{дефолт}
Note: by creating a PR or an issue you automatically agree to the CLA. See CONTRIBUTING.md. Feel free to remove this note, the agreement holds.