mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-03 00:36:48 +00:00
Reverts 259 files that carried unrelated upstream changes through the phase-6 merge: enum class removals (cppcoreguidelines-use-enum-class), scoped_lock→lock_guard conversions (modernize-use-scoped-lock), nodestore Backend API changes (void const* key), .clang-tidy config, test infrastructure deletions, and miscellaneous develop changes. These changes belong on develop, not in the telemetry PR chain. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
77 lines
1.8 KiB
C++
77 lines
1.8 KiB
C++
#include <xrpl/nodestore/detail/DecodedBlob.h>
|
|
|
|
#include <xrpl/basics/Blob.h>
|
|
#include <xrpl/basics/base_uint.h>
|
|
#include <xrpl/basics/safe_cast.h>
|
|
#include <xrpl/beast/utility/instrumentation.h>
|
|
#include <xrpl/nodestore/NodeObject.h>
|
|
|
|
#include <algorithm>
|
|
#include <memory>
|
|
#include <utility>
|
|
|
|
namespace xrpl::NodeStore {
|
|
|
|
DecodedBlob::DecodedBlob(void const* key, void const* value, int valueBytes)
|
|
{
|
|
/* Data format:
|
|
|
|
Bytes
|
|
|
|
0...7 Unused
|
|
8 char One of NodeObjectType
|
|
9...end The body of the object data
|
|
*/
|
|
|
|
m_success = false;
|
|
m_key = key;
|
|
m_objectType = NodeObjectType::hotUNKNOWN;
|
|
m_objectData = nullptr;
|
|
m_dataBytes = std::max(0, valueBytes - 9);
|
|
|
|
// VFALCO NOTE What about bytes 4 through 7 inclusive?
|
|
|
|
if (valueBytes > 8)
|
|
{
|
|
unsigned char const* byte = static_cast<unsigned char const*>(value);
|
|
m_objectType = safe_cast<NodeObjectType>(byte[8]);
|
|
}
|
|
|
|
if (valueBytes > 9)
|
|
{
|
|
m_objectData = static_cast<unsigned char const*>(value) + 9;
|
|
|
|
switch (m_objectType)
|
|
{
|
|
default:
|
|
break;
|
|
|
|
case NodeObjectType::hotUNKNOWN:
|
|
case NodeObjectType::hotLEDGER:
|
|
case NodeObjectType::hotACCOUNT_NODE:
|
|
case NodeObjectType::hotTRANSACTION_NODE:
|
|
m_success = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
std::shared_ptr<NodeObject>
|
|
DecodedBlob::createObject()
|
|
{
|
|
XRPL_ASSERT(m_success, "xrpl::NodeStore::DecodedBlob::createObject : valid object type");
|
|
|
|
std::shared_ptr<NodeObject> object;
|
|
|
|
if (m_success)
|
|
{
|
|
Blob data(m_objectData, m_objectData + m_dataBytes);
|
|
|
|
object = NodeObject::createObject(m_objectType, std::move(data), uint256::fromVoid(m_key));
|
|
}
|
|
|
|
return object;
|
|
}
|
|
|
|
} // namespace xrpl::NodeStore
|