samza-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] mynameborat commented on a change in pull request #915: Consolidating offset read and write for store-offsets and side-inputs, maintaining backward compatbility
Date Tue, 12 Feb 2019 07:06:55 GMT
mynameborat commented on a change in pull request #915: Consolidating offset read and write
for store-offsets and side-inputs, maintaining backward compatbility
URL: https://github.com/apache/samza/pull/915#discussion_r255824624
 
 

 ##########
 File path: samza-core/src/main/java/org/apache/samza/storage/StorageManagerUtil.java
 ##########
 @@ -115,6 +129,36 @@ public static boolean isOffsetFileValid(File storeDir, String offsetFileName)
{
     return hasValidOffsetFile;
   }
 
+  /**
+   * Write the given SSP-Offset map into the offsets file.
+   * @param storeBaseDir the base directory of the store
+   * @param storeName the store name to use
+   * @param taskName the task name which is referencing the store
+   * @param offsets The SSP-offset to write
+   * @return
+   * @throws IOException
+   */
+  public static File writeOffsetFile(File storeBaseDir, String storeName, TaskName taskName,
+      Map<SystemStreamPartition, String> offsets) throws IOException {
+    File offsetFile = new File(getStorePartitionDir(storeBaseDir, storeName, taskName), OFFSET_FILE_NAME);
+    String fileContents = OBJECT_WRITER.writeValueAsString(offsets);
+    FileUtil.writeWithChecksum(offsetFile, fileContents);
+    return offsetFile;
 
 Review comment:
   why does this have to return the file?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message