You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "adamdebreceni (via GitHub)" <gi...@apache.org> on 2023/12/01 12:57:33 UTC
Re: [PR] MINIFICPP-1951 - Prevent append overwriting resource [nifi-minifi-cpp]
adamdebreceni commented on code in PR #1640:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1640#discussion_r1412073720
##########
libminifi/src/core/ContentRepository.cpp:
##########
@@ -98,4 +98,23 @@ bool ContentRepository::remove(const minifi::ResourceClaim &streamId) {
return true;
}
+std::unique_ptr<StreamAppendLock> ContentRepository::append(const org::apache::nifi::minifi::ResourceClaim &claim, size_t offset) {
+ std::lock_guard guard(appending_mutex_);
+ if (offset != size(claim)) {
+ // we are trying to append to a resource that has already been appended to
+ return {};
+ }
+ if (!appending_.insert(claim.getContentFullPath()).second) {
+ // this resource is currently being appended to
+ return {};
+ }
+ return std::make_unique<ContentStreamAppendLock>(sharedFromThis(), claim);
+}
Review Comment:
renamed
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org