CatapultServer  v0.5.0.1 (Elephant)
ProcessingNotificationSubscriber.h
Go to the documentation of this file.
1 
21 #pragma once
25 
26 namespace catapult { namespace chain {
27 
30  public:
34  const validators::ValidatorContext& validatorContext,
35  const observers::NotificationObserver& observer,
36  observers::ObserverContext& observerContext);
37 
38  public:
41 
42  public:
44  void enableUndo();
45 
47  void undo();
48 
49  public:
50  void notify(const model::Notification& notification) override;
51 
52  private:
53  void validate(const model::Notification& notification);
54  void observe(const model::Notification& notification);
55 
56  private:
61 
65  };
66 }}
m_observer
const NotificationObserver & m_observer
Definition: NotificationObserverAdapter.cpp:44
catapult::validators::IsValidationResultSuccess
constexpr bool IsValidationResultSuccess(ValidationResult result)
Returns a value indicating whether the validation result is a success.
Definition: ValidationResult.h:90
catapult::observers::ObserverContext
Context passed to all the observers.
Definition: ObserverContext.h:78
catapult::model::NotificationSubscriber
A notification subscriber.
Definition: NotificationSubscriber.h:27
catapult::model::NotificationChannel::Observer
Publish notification on observer channel.
catapult::model::IsSet
constexpr bool IsSet(NotificationType type, NotificationChannel channel)
Checks if type has channel set.
Definition: NotificationType.h:61
catapult::observers::NotificationObserverT::notify
virtual void notify(const TNotification &notification, ObserverContext &context) const =0
Notifies the observer with a notification to process and an observer context.
catapult::validators::NotificationValidatorT
A strongly typed notification validator.
Definition: NotificationValidator.h:30
ValidatorContext.h
catapult::validators::ValidationResult
ValidationResult
Enumeration of all possible validation results.
Definition: ValidationResult.h:51
catapult::chain::ProcessingNotificationSubscriber::ProcessingNotificationSubscriber
ProcessingNotificationSubscriber(const validators::stateful::NotificationValidator &validator, const validators::ValidatorContext &validatorContext, const observers::NotificationObserver &observer, observers::ObserverContext &observerContext)
Creates a subscriber around validator, validatorContext, observer and observerContext.
Definition: ProcessingNotificationSubscriber.cpp:26
catapult::chain::ProcessingNotificationSubscriber::enableUndo
void enableUndo()
Enables subsequent notifications to be undone.
Definition: ProcessingNotificationSubscriber.cpp:44
catapult::chain::ProcessingNotificationSubscriber
A notification subscriber that processes notifications.
Definition: ProcessingNotificationSubscriber.h:29
catapult::chain::ProcessingNotificationSubscriber::notify
void notify(const model::Notification &notification) override
Notifies the subscriber of notification.
Definition: ProcessingNotificationSubscriber.cpp:55
catapult::chain::ProcessingNotificationSubscriber::m_observerContext
observers::ObserverContext & m_observerContext
Definition: ProcessingNotificationSubscriber.h:60
catapult::chain::ProcessingNotificationSubscriber::m_aggregateResult
validators::ValidationResult m_aggregateResult
Definition: ProcessingNotificationSubscriber.h:63
catapult::chain::ProcessingNotificationSubscriber::m_validator
const validators::stateful::NotificationValidator & m_validator
Definition: ProcessingNotificationSubscriber.h:57
catapult::validators::ValidatorContext
Contextual information passed to stateful validators.
Definition: ValidatorContext.h:32
catapult::validators::AggregateValidationResult
void AggregateValidationResult(std::atomic< ValidationResult > &aggregate, ValidationResult value)
Aggregates result into aggregate.
Definition: AggregateValidationResult.cpp:62
catapult::chain::ProcessingUndoNotificationSubscriber
A notification subscriber that captures notifications and allows them to be undone.
Definition: ProcessingUndoNotificationSubscriber.h:28
catapult::model::Notification::Type
NotificationType Type
Notification type.
Definition: Notifications.h:46
AggregateValidationResult.h
catapult::chain::ProcessingNotificationSubscriber::undo
void undo()
Undoes all executions since enableUndo was first called.
Definition: ProcessingNotificationSubscriber.cpp:48
catapult::chain::ProcessingNotificationSubscriber::m_observer
const observers::NotificationObserver & m_observer
Definition: ProcessingNotificationSubscriber.h:59
catapult::chain::ProcessingUndoNotificationSubscriber::notify
void notify(const model::Notification &notification) override
Notifies the subscriber of notification.
Definition: ProcessingUndoNotificationSubscriber.cpp:49
catapult::chain::ProcessingNotificationSubscriber::m_undoNotificationSubscriber
ProcessingUndoNotificationSubscriber m_undoNotificationSubscriber
Definition: ProcessingNotificationSubscriber.h:62
catapult::chain::ProcessingNotificationSubscriber::m_validatorContext
const validators::ValidatorContext & m_validatorContext
Definition: ProcessingNotificationSubscriber.h:58
catapult::chain::ProcessingNotificationSubscriber::m_isUndoEnabled
bool m_isUndoEnabled
Definition: ProcessingNotificationSubscriber.h:64
catapult::observers::NotificationObserverT
A strongly typed notification observer.
Definition: NotificationObserver.h:29
catapult::chain::CosignersValidationResult::Success
All cosigners are eligible and sufficient.
catapult::chain::ProcessingNotificationSubscriber::result
validators::ValidationResult result() const
Gets the aggregate result of processed notifications.
Definition: ProcessingNotificationSubscriber.cpp:40
CATAPULT_THROW_RUNTIME_ERROR
#define CATAPULT_THROW_RUNTIME_ERROR(MESSAGE)
Macro used to throw a catapult runtime error.
Definition: exceptions.h:167
catapult::chain::ProcessingNotificationSubscriber::validate
void validate(const model::Notification &notification)
Definition: ProcessingNotificationSubscriber.cpp:69
catapult::model::Notification
A basic notification.
Definition: Notifications.h:36
ValidatorTypes.h
CATAPULT_THROW_INVALID_ARGUMENT
#define CATAPULT_THROW_INVALID_ARGUMENT(MESSAGE)
Macro used to throw a catapult invalid argument.
Definition: exceptions.h:179
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::model::Notification::Size
size_t Size
Notification size.
Definition: Notifications.h:49
ProcessingNotificationSubscriber.h
catapult::validators::NotificationValidatorT::validate
virtual ValidationResult validate(const TNotification &notification, TArgs &&... args) const =0
Validates a single notification with contextual information args.
m_aggregateResult
std::atomic< ValidationResult > m_aggregateResult
Definition: ParallelValidationPolicy.cpp:60
catapult::model::NotificationChannel::Validator
Publish notification on validator channel.
catapult::chain::ProcessingNotificationSubscriber::observe
void observe(const model::Notification &notification)
Definition: ProcessingNotificationSubscriber.cpp:77
catapult::chain::ProcessingUndoNotificationSubscriber::undo
void undo()
Undoes all executions.
Definition: ProcessingUndoNotificationSubscriber.cpp:32
ProcessingUndoNotificationSubscriber.h