CatapultServer
v0.5.0.1 (Elephant)
|
Go to the documentation of this file.
27 namespace catapult {
namespace handlers {
30 template<
typename TPacket,
typename TCache>
33 const auto* pRequest = ionet::CoercePacket<TPacket>(&packet);
37 auto view = cache.createView();
38 std::vector<tree::TreeNode> path;
39 view->tryLookup(pRequest->Key, path);
42 std::vector<uint8_t> serializedPath;
43 for (
const auto& node : path) {
45 const auto* pData = reinterpret_cast<const uint8_t*>(serializedNode.data());
46 serializedPath.insert(serializedPath.end(), pData, pData + serializedNode.size());
49 auto payloadSize = utils::checked_cast<size_t, uint32_t>(serializedPath.size());
50 auto pResponsePacket = ionet::CreateSharedPacket<ionet::Packet>(payloadSize);
52 std::memcpy(pResponsePacket->Data(), serializedPath.data(), serializedPath.size());
#define CATAPULT_LOG(SEV)
Writes a log entry to the default logger with SEV severity.
Definition: Logging.h:340
DisruptorConsumerT< TransactionElements > TransactionConsumer
A transaction disruptor consumer function.
Definition: DisruptorConsumer.h:44
constexpr bool IsValidationResultSuccess(ValidationResult result)
Returns a value indicating whether the validation result is a success.
Definition: ValidationResult.h:90
consumer< const model::Transaction &, const Hash256 &, validators::ValidationResult > FailedTransactionSink
Indicates a transaction with the specified hash failed validation.
Definition: ChainFunctions.h:33
disruptor::ConstBlockConsumer CreateBlockStatelessValidationConsumer(const std::shared_ptr< const validators::stateless::AggregateEntityValidator > &pValidator, const std::shared_ptr< const validators::ParallelValidationPolicy > &pValidationPolicy, const RequiresValidationPredicate &requiresValidationPredicate)
Definition: StatelessValidationConsumer.cpp:65
DisruptorConsumerT< const BlockElements > ConstBlockConsumer
A const block disruptor consumer function.
Definition: DisruptorConsumer.h:41
void ExtractEntityInfos(const TransactionElements &elements, model::WeakEntityInfos &entityInfos, std::vector< size_t > &entityInfoElementIndexes)
Definition: InputUtils.cpp:45
void registerHandler(PacketType type, const PacketHandler &handler)
Registers a handler for the specified packet type.
Definition: PacketHandlers.cpp:100
void AggregateValidationResult(std::atomic< ValidationResult > &aggregate, ValidationResult value)
Aggregates result into aggregate.
Definition: AggregateValidationResult.cpp:62
static constexpr auto Packet_Type
Definition: RemoteNodeApi.cpp:33
void ExtractMatchingEntityInfos(const std::vector< BlockElement > &elements, WeakEntityInfos &entityInfos, const MatchingEntityPredicate &predicate)
Extracts all entity infos for which predicate returns true from elements into entityInfos.
Definition: Elements.cpp:79
constexpr disruptor::ConsumerResult Abort(validators::ValidationResult validationResult)
Creates an aborted consumer result around validationResult.
Definition: ConsumerResultFactory.h:34
#define CATAPULT_LOG_LEVEL(LEVEL)
Writes a log entry to the default logger with LEVEL severity.
Definition: Logging.h:336
A packet payload that can be written.
Definition: PacketPayload.h:29
Definition: AddressExtractionExtension.cpp:28
constexpr bool IsValidationResultFailure(ValidationResult result)
Returns a value indicating whether the validation result is a failure.
Definition: ValidationResult.h:95
constexpr utils::LogLevel MapToLogLevel(ValidationResult result)
Maps validation result to an appropriate logging level.
Definition: ValidationResult.h:100
static std::string SerializeValue(const tree::TreeNode &value)
Serializes value to string.
Definition: PatriciaTreeSerializer.cpp:119
model::MatchingEntityPredicate RequiresValidationPredicate
Predicate for checking whether or not an entity requires validation.
Definition: BlockConsumers.h:58
A collection of packet handlers where there is at most one handler per packet type.
Definition: PacketHandlers.h:62
disruptor::TransactionConsumer CreateTransactionStatelessValidationConsumer(const std::shared_ptr< const validators::stateless::AggregateEntityValidator > &pValidator, const std::shared_ptr< const validators::ParallelValidationPolicy > &pValidationPolicy, const chain::FailedTransactionSink &failedTransactionSink)
Definition: StatelessValidationConsumer.cpp:77
std::vector< WeakEntityInfo > WeakEntityInfos
A container of weak entity infos.
Definition: WeakEntityInfo.h:144
constexpr disruptor::ConsumerResult Continue()
Creates a continuation consumer result.
Definition: ConsumerResultFactory.h:29
void RegisterStatePathHandler(ionet::ServerPacketHandlers &handlers, const TCache &cache)
Registers a handler in handlers that responds with serialized state path produced by querying cache.
Definition: StatePathHandlerFactory.h:31