xrpld
Loading...
Searching...
No Matches
xrpl::Resource::Consumer Class Reference

An endpoint that consumes resources. More...

#include <Consumer.h>

Collaboration diagram for xrpl::Resource::Consumer:

Public Member Functions

 Consumer ()
 ~Consumer ()
 Consumer (Consumer const &other)
Consumeroperator= (Consumer const &other)
std::string toString () const
 Return a human readable string uniquely identifying this consumer.
bool isUnlimited () const
 Returns true if this is a privileged endpoint.
void elevate (std::string const &name)
 Raise the Consumer's privilege level to a Named endpoint.
Disposition disposition () const
 Returns the current disposition of this consumer.
Disposition charge (Charge const &fee, std::string const &context={})
 Apply a load charge to the consumer.
bool warn ()
 Returns true if the consumer should be warned.
bool disconnect (beast::Journal const &j)
 Returns true if the consumer should be disconnected.
int balance ()
 Returns the credit balance representing consumption.
Entryentry ()
void setPublicKey (PublicKey const &publicKey)

Private Member Functions

 Consumer (Logic &logic, Entry &entry)

Private Attributes

Logiclogic_
Entryentry_

Friends

class Logic

Detailed Description

An endpoint that consumes resources.

Definition at line 14 of file Consumer.h.

Constructor & Destructor Documentation

◆ Consumer() [1/3]

xrpl::Resource::Consumer::Consumer ( Logic & logic,
Entry & entry )
private

Definition at line 17 of file Consumer.cpp.

◆ Consumer() [2/3]

xrpl::Resource::Consumer::Consumer ( )

Definition at line 21 of file Consumer.cpp.

◆ ~Consumer()

xrpl::Resource::Consumer::~Consumer ( )

Definition at line 34 of file Consumer.cpp.

◆ Consumer() [3/3]

xrpl::Resource::Consumer::Consumer ( Consumer const & other)

Definition at line 25 of file Consumer.cpp.

Member Function Documentation

◆ operator=()

Consumer & xrpl::Resource::Consumer::operator= ( Consumer const & other)

Definition at line 41 of file Consumer.cpp.

◆ toString()

std::string xrpl::Resource::Consumer::toString ( ) const
nodiscard

Return a human readable string uniquely identifying this consumer.

Definition at line 61 of file Consumer.cpp.

◆ isUnlimited()

bool xrpl::Resource::Consumer::isUnlimited ( ) const
nodiscard

Returns true if this is a privileged endpoint.

Definition at line 70 of file Consumer.cpp.

◆ elevate()

void xrpl::Resource::Consumer::elevate ( std::string const & name)

Raise the Consumer's privilege level to a Named endpoint.

The reference to the original endpoint descriptor is released.

◆ disposition()

Disposition xrpl::Resource::Consumer::disposition ( ) const
nodiscard

Returns the current disposition of this consumer.

This should be checked upon creation to determine if the consumer should be disconnected immediately.

Definition at line 79 of file Consumer.cpp.

◆ charge()

Disposition xrpl::Resource::Consumer::charge ( Charge const & fee,
std::string const & context = {} )

Apply a load charge to the consumer.

Definition at line 89 of file Consumer.cpp.

◆ warn()

bool xrpl::Resource::Consumer::warn ( )

Returns true if the consumer should be warned.

This consumes the warning.

Definition at line 100 of file Consumer.cpp.

◆ disconnect()

bool xrpl::Resource::Consumer::disconnect ( beast::Journal const & j)

Returns true if the consumer should be disconnected.

Definition at line 107 of file Consumer.cpp.

◆ balance()

int xrpl::Resource::Consumer::balance ( )

Returns the credit balance representing consumption.

Definition at line 119 of file Consumer.cpp.

◆ entry()

Entry & xrpl::Resource::Consumer::entry ( )

Definition at line 126 of file Consumer.cpp.

◆ setPublicKey()

void xrpl::Resource::Consumer::setPublicKey ( PublicKey const & publicKey)

Definition at line 133 of file Consumer.cpp.

◆ Logic

friend class Logic
friend

Definition at line 17 of file Consumer.h.

Member Data Documentation

◆ logic_

Logic* xrpl::Resource::Consumer::logic_
private

Definition at line 74 of file Consumer.h.

◆ entry_

Entry* xrpl::Resource::Consumer::entry_
private

Definition at line 75 of file Consumer.h.