adamdebreceni commented on code in PR #1429:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1429#discussion_r996791850


##########
libminifi/src/core/BufferedContentSession.cpp:
##########
@@ -16,58 +16,57 @@
  * limitations under the License.
  */
 
+#include "core/BufferedContentSession.h"
 #include <memory>
 #include "core/ContentRepository.h"
-#include "core/ContentSession.h"
 #include "ResourceClaim.h"
 #include "io/BaseStream.h"
 #include "Exception.h"
 #include "utils/gsl.h"
 
-namespace org {
-namespace apache {
-namespace nifi {
-namespace minifi {
-namespace core {
+namespace org::apache::nifi::minifi::core {
 
-ContentSession::ContentSession(std::shared_ptr<ContentRepository> repository) 
: repository_(std::move(repository)) {}
+BufferedContentSession::BufferedContentSession(std::shared_ptr<ContentRepository>
 repository) : repository_(std::move(repository)) {}
 
-std::shared_ptr<ResourceClaim> ContentSession::create() {
+std::shared_ptr<ResourceClaim> BufferedContentSession::create() {
   std::shared_ptr<ResourceClaim> claim = 
std::make_shared<ResourceClaim>(repository_);
-  managedResources_[claim] = std::make_shared<io::BufferStream>();
+  managed_resources_[claim] = std::make_shared<io::BufferStream>();
   return claim;
 }
 
-std::shared_ptr<io::BaseStream> ContentSession::write(const 
std::shared_ptr<ResourceClaim>& resourceId, WriteMode mode) {
-  auto it = managedResources_.find(resourceId);
-  if (it == managedResources_.end()) {
-    if (mode == WriteMode::OVERWRITE) {
-      throw Exception(REPOSITORY_EXCEPTION, "Can only overwrite owned 
resource");
-    }
-    auto& extension = extendedResources_[resourceId];
+std::shared_ptr<io::BaseStream> BufferedContentSession::write(const 
std::shared_ptr<ResourceClaim>& resource_id) {
+  auto it = managed_resources_.find(resource_id);
+  if (it == managed_resources_.end()) {
+    throw Exception(REPOSITORY_EXCEPTION, "Can only overwrite owned resource");
+  }
+  it->second = std::make_shared<io::BufferStream>();
+  return it->second;
+}
+
+std::shared_ptr<io::BaseStream> BufferedContentSession::append(const 
std::shared_ptr<ResourceClaim>& resource_id) {
+  auto it = managed_resources_.find(resource_id);
+  if (it == managed_resources_.end()) {
+    auto& extension = extended_resources_[resource_id];
     if (!extension) {
       extension = std::make_shared<io::BufferStream>();
     }
     return extension;
   }

Review Comment:
   same here, changed it, but not exactly to the suggestion



-- 
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]

Reply via email to