mirror of
https://github.com/XRPLF/clio.git
synced 2026-06-03 00:36:44 +00:00
refactor: Rename static constants (#3073)
This commit is contained in:
@@ -58,7 +58,7 @@ SubscriptionSource::SubscriptionSource(
|
||||
, subscriptions_(std::move(subscriptions))
|
||||
, strand_(boost::asio::make_strand(ioContext))
|
||||
, wsTimeout_(wsTimeout)
|
||||
, retry_(util::makeRetryExponentialBackoff(retryDelay, kRETRY_MAX_DELAY, strand_))
|
||||
, retry_(util::makeRetryExponentialBackoff(retryDelay, kRetryMaxDelay, strand_))
|
||||
, onConnect_(std::move(onConnect))
|
||||
, onDisconnect_(std::move(onDisconnect))
|
||||
, onLedgerClosed_(std::move(onLedgerClosed))
|
||||
@@ -198,9 +198,9 @@ SubscriptionSource::handleMessage(std::string const& message)
|
||||
auto const object = raw.as_object();
|
||||
uint32_t ledgerIndex = 0;
|
||||
|
||||
static constexpr auto kJS_LEDGER_CLOSED = "ledgerClosed";
|
||||
static constexpr auto kJS_VALIDATION_RECEIVED = "validationReceived";
|
||||
static constexpr auto kJS_MANIFEST_RECEIVED = "manifestReceived";
|
||||
static constexpr auto kJsLedgerClosed = "ledgerClosed";
|
||||
static constexpr auto kJsValidationReceived = "validationReceived";
|
||||
static constexpr auto kJsManifestReceived = "manifestReceived";
|
||||
|
||||
if (object.contains(JS(result))) {
|
||||
auto const& result = object.at(JS(result)).as_object();
|
||||
@@ -215,7 +215,7 @@ SubscriptionSource::handleMessage(std::string const& message)
|
||||
LOG(log_.debug()) << "Received a message on ledger subscription stream. Message: "
|
||||
<< object;
|
||||
|
||||
} else if (object.contains(JS(type)) && object.at(JS(type)) == kJS_LEDGER_CLOSED) {
|
||||
} else if (object.contains(JS(type)) && object.at(JS(type)) == kJsLedgerClosed) {
|
||||
LOG(log_.debug()) << "Received a message of type 'ledgerClosed' on ledger subscription "
|
||||
"stream. Message: "
|
||||
<< object;
|
||||
@@ -239,12 +239,12 @@ SubscriptionSource::handleMessage(std::string const& message)
|
||||
LOG(log_.debug()) << "Forwarding proposed transaction: " << object;
|
||||
subscriptions_->forwardProposedTransaction(object);
|
||||
} else if (
|
||||
object.contains(JS(type)) && object.at(JS(type)) == kJS_VALIDATION_RECEIVED
|
||||
object.contains(JS(type)) && object.at(JS(type)) == kJsValidationReceived
|
||||
) {
|
||||
LOG(log_.debug()) << "Forwarding validation: " << object;
|
||||
subscriptions_->forwardValidation(object);
|
||||
} else if (
|
||||
object.contains(JS(type)) && object.at(JS(type)) == kJS_MANIFEST_RECEIVED
|
||||
object.contains(JS(type)) && object.at(JS(type)) == kJsManifestReceived
|
||||
) {
|
||||
LOG(log_.debug()) << "Forwarding manifest: " << object;
|
||||
subscriptions_->forwardManifest(object);
|
||||
@@ -358,12 +358,12 @@ SubscriptionSource::setValidatedRange(std::string range)
|
||||
std::string const&
|
||||
SubscriptionSource::getSubscribeCommandJson()
|
||||
{
|
||||
static boost::json::object const kJSON_VALUE{
|
||||
static boost::json::object const kJsonValue{
|
||||
{"command", "subscribe"},
|
||||
{"streams", {"ledger", "manifests", "validations", "transactions_proposed"}},
|
||||
};
|
||||
static std::string const kJSON_STRING = boost::json::serialize(kJSON_VALUE);
|
||||
return kJSON_STRING;
|
||||
static std::string const kJsonString = boost::json::serialize(kJsonValue);
|
||||
return kJsonString;
|
||||
}
|
||||
|
||||
} // namespace etl::impl
|
||||
|
||||
Reference in New Issue
Block a user