rippled
Loading...
Searching...
No Matches
Consumer.h
1#pragma once
2
3#include <xrpl/basics/Log.h>
4#include <xrpl/protocol/PublicKey.h>
5#include <xrpl/resource/Charge.h>
6#include <xrpl/resource/Disposition.h>
7
8namespace xrpl {
9namespace Resource {
10
11struct Entry;
12class Logic;
13
16{
17private:
18 friend class Logic;
19 Consumer(Logic& logic, Entry& entry);
20
21public:
22 Consumer();
23 ~Consumer();
24 Consumer(Consumer const& other);
26 operator=(Consumer const& other);
27
30 to_string() const;
31
33 bool
34 isUnlimited() const;
35
39 void
40 elevate(std::string const& name);
41
47 disposition() const;
48
51 charge(Charge const& fee, std::string const& context = {});
52
56 bool
57 warn();
58
60 bool
61 disconnect(beast::Journal const& j);
62
64 int
65 balance();
66
67 // Private: Retrieve the entry associated with the consumer
68 Entry&
69 entry();
70
71 void
72 setPublicKey(PublicKey const& publicKey);
73
74private:
77};
78
80operator<<(std::ostream& os, Consumer const& v);
81
82} // namespace Resource
83} // namespace xrpl
A generic endpoint for log messages.
Definition Journal.h:40
A public key.
Definition PublicKey.h:42
A consumption charge.
Definition Charge.h:10
An endpoint that consumes resources.
Definition Consumer.h:16
Consumer & operator=(Consumer const &other)
Definition Consumer.cpp:40
void setPublicKey(PublicKey const &publicKey)
Definition Consumer.cpp:129
void elevate(std::string const &name)
Raise the Consumer's privilege level to a Named endpoint.
bool warn()
Returns true if the consumer should be warned.
Definition Consumer.cpp:96
bool isUnlimited() const
Returns true if this is a privileged endpoint.
Definition Consumer.cpp:66
bool disconnect(beast::Journal const &j)
Returns true if the consumer should be disconnected.
Definition Consumer.cpp:103
Disposition disposition() const
Returns the current disposition of this consumer.
Definition Consumer.cpp:75
std::string to_string() const
Return a human readable string uniquely identifying this consumer.
Definition Consumer.cpp:57
int balance()
Returns the credit balance representing consumption.
Definition Consumer.cpp:115
Disposition charge(Charge const &fee, std::string const &context={})
Apply a load charge to the consumer.
Definition Consumer.cpp:85
Disposition
The disposition of a consumer after applying a load charge.
Definition Disposition.h:7
std::ostream & operator<<(std::ostream &os, Charge const &v)
Definition Charge.cpp:36
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5