1#include <xrpl/resource/Consumer.h>
3#include <xrpl/basics/Log.h>
4#include <xrpl/beast/utility/Journal.h>
5#include <xrpl/beast/utility/instrumentation.h>
6#include <xrpl/protocol/PublicKey.h>
7#include <xrpl/resource/Charge.h>
8#include <xrpl/resource/Disposition.h>
9#include <xrpl/resource/detail/Entry.h>
10#include <xrpl/resource/detail/Logic.h>
29 entry_ = other.entry_;
30 logic_->acquire(*entry_);
73 return entry_->isUnlimited();
102 XRPL_ASSERT(
entry_,
"xrpl::Resource::Consumer::warn : non-null entry");
109 XRPL_ASSERT(
entry_,
"xrpl::Resource::Consumer::disconnect : non-null entry");
113 JLOG(j.
debug()) <<
"disconnecting " <<
entry_->toString();
121 XRPL_ASSERT(
entry_,
"xrpl::Resource::Consumer::balance : non-null entry");
128 XRPL_ASSERT(
entry_,
"xrpl::Resource::Consumer::entry : non-null entry");
135 entry_->publicKey = publicKey;
A generic endpoint for log messages.
An endpoint that consumes resources.
Consumer & operator=(Consumer const &other)
void setPublicKey(PublicKey const &publicKey)
bool warn()
Returns true if the consumer should be warned.
bool isUnlimited() const
Returns true if this is a privileged endpoint.
Consumer(Logic &logic, Entry &entry)
std::string toString() const
Return a human readable string uniquely identifying this consumer.
bool disconnect(beast::Journal const &j)
Returns true if the consumer should be disconnected.
Disposition disposition() const
Returns the current disposition of this consumer.
int balance()
Returns the credit balance representing consumption.
Disposition charge(Charge const &fee, std::string const &context={})
Apply a load charge to the consumer.
Disposition
The disposition of a consumer after applying a load charge.
std::ostream & operator<<(std::ostream &os, Charge const &v)