1#ifndef XRPL_SHAMAP_SHAMAPITEM_H_INCLUDED
2#define XRPL_SHAMAP_SHAMAPITEM_H_INCLUDED
4#include <xrpl/basics/ByteUtilities.h>
5#include <xrpl/basics/CountedObject.h>
6#include <xrpl/basics/SlabAllocator.h>
7#include <xrpl/basics/Slice.h>
8#include <xrpl/basics/base_uint.h>
9#include <xrpl/beast/utility/instrumentation.h>
11#include <boost/smart_ptr/intrusive_ptr.hpp>
28 friend boost::intrusive_ptr<SHAMapItem>
83 return reinterpret_cast<std::uint8_t const*
>(
this) +
sizeof(*
this);
118 LogicError(
"SHAMapItem: the reference count is 0!");
141inline boost::intrusive_ptr<SHAMapItem>
145 data.size() <= megabytes<std::size_t>(16),
146 "ripple::make_shamapitem : maximum input size");
159 return {
new (raw)
SHAMapItem{tag, data},
false};
165inline boost::intrusive_ptr<SHAMapItem>
Tracks the number of instances of an object.
SHAMapItem(SHAMapItem &&other)=delete
void const * data() const
friend void intrusive_ptr_add_ref(SHAMapItem const *x)
uint256 const & key() const
std::uint32_t const size_
SHAMapItem(uint256 const &tag, Slice data)
friend void intrusive_ptr_release(SHAMapItem const *x)
SHAMapItem & operator=(SHAMapItem const &other)=delete
friend boost::intrusive_ptr< SHAMapItem > make_shamapitem(uint256 const &tag, Slice data)
std::atomic< std::uint32_t > refcount_
SHAMapItem & operator=(SHAMapItem &&)=delete
SHAMapItem(SHAMapItem const &other)=delete
A collection of slab allocators of various sizes for a given type.
An immutable linear range of bytes.
SlabAllocatorSet< SHAMapItem > slabber({ { 128, megabytes(std::size_t(60)) }, { 192, megabytes(std::size_t(46)) }, { 272, megabytes(std::size_t(60)) }, { 384, megabytes(std::size_t(56)) }, { 564, megabytes(std::size_t(40)) }, { 772, megabytes(std::size_t(46)) }, { 1052, megabytes(std::size_t(60)) }, })
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
constexpr auto megabytes(T value) noexcept
void intrusive_ptr_release(SHAMapItem const *x)
boost::intrusive_ptr< SHAMapItem > make_shamapitem(uint256 const &tag, Slice data)
void intrusive_ptr_add_ref(SHAMapItem const *x)
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.