Make class members journal const

This commit is contained in:
Miguel Portilla
2019-10-25 14:05:34 -04:00
committed by Nik Bougalis
parent 06c371544a
commit 5c1dd87fab
55 changed files with 67 additions and 65 deletions

View File

@@ -59,7 +59,7 @@ class RCLConsensus
LedgerMaster& ledgerMaster_;
LocalTxs& localTxs_;
InboundTransactions& inboundTransactions_;
beast::Journal j_;
beast::Journal const j_;
NodeID const nodeID_;
PublicKey const valPublic_;
@@ -389,7 +389,7 @@ class RCLConsensus
std::chrono::milliseconds roundTime,
std::set<TxID>& failedTxs);
/** Validate the given ledger and share with peers as necessary
/** Validate the given ledger and share with peers as necessary
@param ledger The ledger to validate
@param txns The consensus transaction set
@@ -515,7 +515,7 @@ private:
Adaptor adaptor_;
Consensus<Adaptor> consensus_;
beast::Journal j_;
beast::Journal const j_;
};
}

View File

@@ -167,7 +167,7 @@ handleNewValidation(Application& app,
bool shouldRelay = false;
RCLValidations& validations = app.getValidations();
beast::Journal j = validations.adaptor().journal();
beast::Journal const j = validations.adaptor().journal();
auto dmp = [&](beast::Journal::Stream s, std::string const& msg) {
s << "Val for " << hash

View File

@@ -50,7 +50,7 @@ public:
private:
Application& app_;
NodeCache& m_nodeCache;
beast::Journal j_;
beast::Journal const j_;
};
} // ripple

View File

@@ -49,7 +49,7 @@ using OrderedTxs = CanonicalTXSet;
class OpenLedger
{
private:
beast::Journal j_;
beast::Journal const j_;
CachedSLEs& cache_;
std::mutex mutable modify_mutex_;
std::mutex mutable current_mutex_;

View File

@@ -82,7 +82,7 @@ private:
std::uint32_t mSeq;
beast::Journal j_;
beast::Journal const j_;
};
} // ripple

View File

@@ -42,7 +42,7 @@ private:
std::mutex fetchRateMutex_;
// measures ledgers per second, constants are important
DecayWindow<30, clock_type> fetchRate_;
beast::Journal j_;
beast::Journal const j_;
public:
using u256_acq_pair = std::pair<

View File

@@ -44,7 +44,7 @@ Cleans up the ledger. Specifically, resolves these issues:
class LedgerCleanerImp : public LedgerCleaner
{
Application& app_;
beast::Journal j_;
beast::Journal const j_;
mutable std::mutex mutex_;
mutable std::condition_variable wakeup_;

View File

@@ -92,7 +92,7 @@ private:
FullBelowCache fullbelow_;
NodeStore::Database& db_;
bool const shardBacked_;
beast::Journal j_;
beast::Journal const j_;
// missing node handler
LedgerIndex maxSeq = 0;

View File

@@ -90,7 +90,7 @@ private:
private:
Application& app_;
beast::Journal journal_;
beast::Journal const journal_;
std::thread thread_;
std::mutex mutex_; // Guards deadLock_, armed_, and stop_.

View File

@@ -91,7 +91,7 @@ class FeeVoteImpl : public FeeVote
{
private:
Setup target_;
beast::Journal journal_;
beast::Journal const journal_;
public:
FeeVoteImpl (Setup const& setup, beast::Journal journal);

View File

@@ -128,7 +128,7 @@ private:
static std::uint32_t constexpr lftFeeDecFraction = 4; // decrease fee by 1/4
static std::uint32_t constexpr lftFeeMax = lftNormalFee * 1000000;
beast::Journal j_;
beast::Journal const j_;
std::mutex mutable lock_;
std::uint32_t localTxnLoadFee_; // Scale factor, lftNormalFee = normal fee

View File

@@ -54,7 +54,7 @@ private:
public:
soci::session session_;
std::mutex mutex_;
beast::Journal journal_;
beast::Journal const journal_;
// Just instantiate without any logic in case online delete is not
// configured
@@ -86,7 +86,7 @@ private:
static std::uint32_t const minimumDeletionIntervalSA_ = 8;
NodeStore::Scheduler& scheduler_;
beast::Journal journal_;
beast::Journal const journal_;
NodeStore::DatabaseRotating* dbRotating_ = nullptr;
SavedStateDB state_db_;
std::thread thread_;

View File

@@ -371,7 +371,7 @@ private:
/// when fee escalation kicks in.
std::uint64_t escalationMultiplier_;
/// Journal
beast::Journal j_;
beast::Journal const j_;
public:
/// Constructor
@@ -655,7 +655,7 @@ private:
/// Setup parameters used to control the behavior of the queue
Setup const setup_;
/// Journal
beast::Journal j_;
beast::Journal const j_;
/** Tracks the current state of the queue.
@note This member must always and only be accessed under

View File

@@ -128,7 +128,7 @@ class ValidatorList
ManifestCache& validatorManifests_;
ManifestCache& publisherManifests_;
TimeKeeper& timeKeeper_;
beast::Journal j_;
beast::Journal const j_;
std::shared_timed_mutex mutable mutex_;
std::atomic<std::size_t> quorum_;

View File

@@ -110,7 +110,7 @@ private:
};
Application& app_;
beast::Journal j_;
beast::Journal const j_;
std::mutex mutable sites_mutex_;
std::mutex mutable state_mutex_;

View File

@@ -159,7 +159,7 @@ protected:
// True if an unsupported amendment is enabled
bool unsupportedEnabled_;
beast::Journal j_;
beast::Journal const j_;
// Finds or creates state
AmendmentState* add (uint256 const& amendment);

View File

@@ -169,7 +169,7 @@ private:
// Source may only be used there if not mentioned by an account.
AccountIssueToNodeIndex umReverse;
beast::Journal j_;
beast::Journal const j_;
};
} // ripple

View File

@@ -194,7 +194,7 @@ private:
hash_map<Issue, int> mPathsOutCountMap;
Application& app_;
beast::Journal j_;
beast::Journal const j_;
// Add ripple paths
static std::uint32_t const afADD_ACCOUNTS = 0x001;

View File

@@ -127,7 +127,7 @@ public:
// Map of currency, issuer to node index.
AccountIssueToNodeIndex mumSource_;
beast::Journal j_;
beast::Journal const j_;
Logs& logs_;
private:

View File

@@ -142,7 +142,7 @@ private:
PathState& pathState_;
bool multiQuality_;
NodeIndex nodeIndex_;
beast::Journal j_;
beast::Journal const j_;
};
} // path

View File

@@ -52,7 +52,7 @@ protected:
bool const ownerPaysTransferFee_;
// Mark as inactive (dry) if too many offers are consumed
bool inactive_ = false;
beast::Journal j_;
beast::Journal const j_;
struct Cache
{

View File

@@ -44,7 +44,7 @@ protected:
// Charge transfer fees when the prev step redeems
Step const* const prevStep_ = nullptr;
bool const isLast_;
beast::Journal j_;
beast::Journal const j_;
struct Cache
{

View File

@@ -505,7 +505,7 @@ struct StrandContext
than once
*/
boost::container::flat_set<Issue>& seenBookOuts;
beast::Journal j; ///< Journal for logging
beast::Journal const j;
/** StrandContext constructor. */
StrandContext (ReadView const& view_,

View File

@@ -41,7 +41,7 @@ class XRPEndpointStep : public StepImp<
private:
AccountID acc_;
bool const isLast_;
beast::Journal j_;
beast::Journal const j_;
// Since this step will always be an endpoint in a strand
// (either the first or last step) the same cache is used

View File

@@ -69,7 +69,7 @@ public:
};
protected:
beast::Journal j_;
beast::Journal const j_;
ApplyView& view_;
ApplyView& cancelView_;
Book book_;

View File

@@ -69,7 +69,7 @@ private:
CrossType cross_type_;
protected:
beast::Journal journal_;
beast::Journal const journal_;
struct Flow
{

View File

@@ -36,7 +36,7 @@ public:
STTx const& tx;
Rules const rules;
ApplyFlags flags;
beast::Journal j;
beast::Journal const j;
PreflightContext(Application& app_, STTx const& tx_,
Rules const& rules_, ApplyFlags flags_,
@@ -54,7 +54,7 @@ public:
TER preflightResult;
STTx const& tx;
ApplyFlags flags;
beast::Journal j;
beast::Journal const j;
PreclaimContext(Application& app_, ReadView const& view_,
TER preflightResult_, STTx const& tx_,
@@ -79,7 +79,7 @@ class Transactor
{
protected:
ApplyContext& ctx_;
beast::Journal j_;
beast::Journal const j_;
AccountID account_;
XRPAmount mPriorBalance; // Balance before fees.

View File

@@ -133,7 +133,7 @@ class PerfLogImp
};
Setup const setup_;
beast::Journal j_;
beast::Journal const j_;
std::function<void()> const signalStop_;
Counters counters_ {ripple::RPC::getHandlerNames(), JobTypes::instance()};
std::ofstream logFile_;

View File

@@ -597,7 +597,7 @@ private:
hash_set<NodeID_t> deadNodes_;
// Journal for debugging
beast::Journal j_;
beast::Journal const j_;
};
template <class Adaptor>

View File

@@ -132,7 +132,7 @@ private:
bool ourVote_; //< Our vote (true is yes)
Tx_t tx_; //< Transaction under dispute
Map_t votes_; //< Map from NodeID to vote
beast::Journal j_;
beast::Journal const j_;
};
// Track a peer's yes/no vote on a particular disputed tx_

View File

@@ -107,7 +107,7 @@ private:
boost::filesystem::path DEBUG_LOGFILE;
void load ();
beast::Journal j_;
beast::Journal const j_;
bool QUIET = false; // Minimize logging verbosity.
bool SILENT = false; // No output to console after startup.

View File

@@ -75,7 +75,7 @@ private:
std::chrono::milliseconds mTargetLatencyAvg;
std::chrono::milliseconds mTargetLatencyPk;
UptimeClock::time_point mLastUpdate;
beast::Journal j_;
beast::Journal const j_;
};
} // ripple

View File

@@ -87,7 +87,7 @@ private:
}
};
beast::Journal j_;
beast::Journal const j_;
std::mutex mutable mutex_;
std::thread thread_;
boost::asio::io_service io_service_;

View File

@@ -205,7 +205,7 @@ private:
JobQueue& jobQueue_;
bool running_ = false;
beast::Journal j_;
beast::Journal const j_;
static
int sqliteWALHook (

View File

@@ -28,7 +28,7 @@ namespace ripple {
class TimeKeeperImpl : public TimeKeeper
{
private:
beast::Journal j_;
beast::Journal const j_;
std::mutex mutable mutex_;
std::chrono::duration<std::int32_t> closeOffset_;
std::unique_ptr<SNTPClock> clock_;

View File

@@ -182,7 +182,7 @@ public:
private:
boost::asio::ssl::context ssl_context_;
beast::Journal j_;
beast::Journal const j_;
const bool verify_;
};

View File

@@ -67,7 +67,7 @@ private:
boost::optional<
boost::asio::ssl::stream<boost::asio::ip::tcp::socket>> stream_;
boost::beast::flat_buffer read_buf_;
beast::Journal j_;
beast::Journal const j_;
void
do_session(

View File

@@ -92,7 +92,7 @@ std::string createHTTPPost (
class RPCParser
{
private:
beast::Journal j_;
beast::Journal const j_;
// TODO New routine for parsing ledger parameters, other routines should standardize on this.
static bool jvParseLedger (Json::Value& jvRequest, std::string const& strLedger)

View File

@@ -194,7 +194,7 @@ private:
std::deque<std::pair<int, Json::Value> > mDeque;
beast::Journal j_;
beast::Journal const j_;
Logs& logs_;
};

View File

@@ -220,7 +220,7 @@ public:
}
protected:
beast::Journal j_;
beast::Journal const j_;
Scheduler& scheduler_;
int fdRequired_ {0};

View File

@@ -81,7 +81,7 @@ private:
using Map = std::map <uint256 const, std::shared_ptr<NodeObject>>;
std::string name_;
beast::Journal journal_;
beast::Journal const journal_;
MemoryDB* db_ {nullptr};
public:

View File

@@ -42,7 +42,7 @@ class NuDBBackend
public:
static constexpr std::size_t currentType = 1;
beast::Journal j_;
beast::Journal const j_;
size_t const keyBytes_;
std::string const name_;
nudb::store db_;

View File

@@ -39,7 +39,7 @@ Shard::Shard(
Application& app,
DatabaseShard const& db,
std::uint32_t index,
beast::Journal& j)
beast::Journal j)
: app_(app)
, index_(index)
, firstSeq_(db.firstLedgerSeq(index))

View File

@@ -36,7 +36,9 @@ namespace NodeStore {
// Removes a path in its entirety
inline static
bool
removeAll(boost::filesystem::path const& path, beast::Journal& j)
removeAll(
boost::filesystem::path const& path,
beast::Journal const& j)
{
try
{
@@ -70,7 +72,7 @@ public:
Application& app,
DatabaseShard const& db,
std::uint32_t index,
beast::Journal& j);
beast::Journal j);
bool
open(Scheduler& scheduler, nudb::context& ctx);
@@ -164,7 +166,7 @@ private:
// Transaction SQLite database used for indexes
std::unique_ptr<DatabaseCon> txSQLiteDB_;
beast::Journal j_;
beast::Journal const j_;
// True if shard has its entire ledger range stored
bool complete_ {false};

View File

@@ -45,7 +45,7 @@ private:
Application& app_;
std::uint32_t const id_;
beast::WrappedSink sink_;
beast::Journal journal_;
beast::Journal const journal_;
endpoint_type remote_endpoint_;
Resource::Consumer usage_;
boost::asio::io_service::strand strand_;

View File

@@ -106,7 +106,7 @@ private:
boost::container::flat_map<
Child*, std::weak_ptr<Child>> list_;
Setup setup_;
beast::Journal journal_;
beast::Journal const journal_;
ServerHandler& serverHandler_;
Resource::Manager& m_resourceManager;
std::unique_ptr <PeerFinder::Manager> m_peerFinder;

View File

@@ -106,8 +106,8 @@ private:
id_t const id_;
beast::WrappedSink sink_;
beast::WrappedSink p_sink_;
beast::Journal journal_;
beast::Journal p_journal_;
beast::Journal const journal_;
beast::Journal const p_journal_;
std::unique_ptr<beast::asio::ssl_bundle> ssl_bundle_;
socket_type& socket_;
stream_type& stream_;

View File

@@ -36,7 +36,7 @@ namespace Resource {
class ManagerImp : public Manager
{
private:
beast::Journal journal_;
beast::Journal const journal_;
Logic logic_;
std::thread thread_;
bool stop_ = false;

View File

@@ -47,7 +47,7 @@ struct Context
boost::string_view forwardedFor;
};
beast::Journal j;
beast::Journal const j;
Json::Value params;
Application& app;
Resource::Charge& loadType;

View File

@@ -47,7 +47,7 @@ struct Request
}
// [in] The Journal for logging
beast::Journal journal;
beast::Journal const journal;
// [in] The JSON-RPC method
std::string method;

View File

@@ -84,7 +84,7 @@ private:
boost::asio::basic_waitable_timer<std::chrono::steady_clock> timer_;
bool process_;
std::map<std::uint32_t, parsedURL> archives_;
beast::Journal j_;
beast::Journal const j_;
};
} // RPC

View File

@@ -88,7 +88,7 @@ protected:
boost::asio::strand<boost::asio::executor> strand_;
waitable_timer timer_;
endpoint_type remote_address_;
beast::Journal journal_;
beast::Journal const journal_;
std::string id_;
std::size_t nid_;

View File

@@ -47,7 +47,7 @@ protected:
Handler& handler_;
endpoint_type remote_address_;
beast::WrappedSink sink_;
beast::Journal j_;
beast::Journal const j_;
boost::asio::executor_work_guard<boost::asio::executor> work_;
boost::asio::strand<boost::asio::executor> strand_;

View File

@@ -70,7 +70,7 @@ private:
timer_type timer_;
endpoint_type remote_address_;
boost::asio::io_context::strand strand_;
beast::Journal j_;
beast::Journal const j_;
public:
Detector(
@@ -88,7 +88,7 @@ private:
void do_detect (yield_context yield);
};
beast::Journal j_;
beast::Journal const j_;
Port const& port_;
Handler& handler_;
boost::asio::io_context& ioc_;

View File

@@ -88,7 +88,7 @@ private:
};
Handler& handler_;
beast::Journal j_;
beast::Journal const j_;
boost::asio::io_service& io_service_;
boost::asio::io_service::strand strand_;
boost::optional <boost::asio::io_service::work> work_;