adam-markovics commented on a change in pull request #1107:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1107#discussion_r677141249
##########
File path: extensions/windows-event-log/tests/BookmarkTests.cpp
##########
@@ -40,7 +40,10 @@ std::unique_ptr<Bookmark> createBookmark(TestPlan &test_plan,
const utils::Identifier &uuid =
IdGenerator::getIdGenerator()->generate()) {
const auto state_manager =
test_plan.getStateManagerProvider()->getCoreComponentStateManager(uuid);
const auto logger = test_plan.getLogger();
- return utils::make_unique<Bookmark>(channel, L"*", "", uuid, false,
state_manager, logger);
+ state_manager->beginTransaction();
+ auto bookmark = utils::make_unique<Bookmark>(channel, L"*", "", uuid, false,
state_manager, logger);
+ state_manager->commit();
Review comment:
If you want to make a change to the state (set or clear) without being
in a transaction, your call will fail, returning false.
I don't think it is possible to auto-commit outside of onTrigger. It is the
user's responsibility to decide when/how often/if to commit or rollback. I
cannot think of a way that is universally applicable everywhere.
Transaction objects wouldn't solve this problem, and they would break
preexisting interface of state manager, affecting all users, even in onTriggers.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]