-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added changes for filestore implementation for FileCopy
- Loading branch information
Jai Balani
committed
Jan 22, 2025
1 parent
5df7368
commit 3dd73ad
Showing
6 changed files
with
403 additions
and
18 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
ambry-api/src/main/java/com/github/ambry/clustermap/FileStoreException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.github.ambry.clustermap; | ||
|
||
public class FileStoreException extends RuntimeException{ | ||
|
||
private static final long serialVersionUID = 1L; | ||
private final FileStoreErrorCode error; | ||
|
||
public FileStoreException(String s, FileStoreErrorCode error) { | ||
super(s); | ||
this.error = error; | ||
} | ||
|
||
public FileStoreException(String s, FileStoreErrorCode error, Throwable throwable) { | ||
super(s, throwable); | ||
this.error = error; | ||
} | ||
|
||
public enum FileStoreErrorCode{ | ||
FileStoreRunningFailure | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
ambry-api/src/main/java/com/github/ambry/config/FileCopyConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.github.ambry.config; | ||
|
||
public class FileCopyConfig { | ||
|
||
public static final String PARALLEL_PARTITION_HYDRATION_COUNT_PER_DISK = "parallel.partition.hydration.count.per.disk"; | ||
@Config(PARALLEL_PARTITION_HYDRATION_COUNT_PER_DISK) | ||
public final int parallelPartitionHydrationCountPerDisk; | ||
|
||
public static final String NUMBER_OF_FILE_COPY_THREADS = "number.of.file.copy.threads"; | ||
@Config(NUMBER_OF_FILE_COPY_THREADS) | ||
public final int numberOfFileCopyThreads; | ||
|
||
public static final String FILE_CHUNK_TIMEOUT_IN_MINUTES = "file.chunk.timeout.in.minutes"; | ||
@Config(FILE_CHUNK_TIMEOUT_IN_MINUTES) | ||
public final long fileChunkTimeoutInMins; | ||
|
||
/** | ||
* The frequency at which the data gets flushed to disk | ||
*/ | ||
public static final String STORE_DATA_FLUSH_INTERVAL_IN_MBS = "store.data.flush.interval.In.MBs"; | ||
@Config(STORE_DATA_FLUSH_INTERVAL_IN_MBS) | ||
@Default("1000") | ||
public final long storeDataFlushIntervalInMbs; | ||
|
||
public static final String FILE_COPY_META_DATA_FILE_NAME = "file.copy.meta.data.file.name"; | ||
@Config(FILE_COPY_META_DATA_FILE_NAME) | ||
@Default("sealed_logs_metadata_file") | ||
public final String fileCopyMetaDataFileName; | ||
|
||
public FileCopyConfig(VerifiableProperties verifiableProperties) { | ||
fileCopyMetaDataFileName = verifiableProperties.getString(FILE_COPY_META_DATA_FILE_NAME, "sealed_logs_metadata_file"); | ||
parallelPartitionHydrationCountPerDisk = verifiableProperties.getInt(PARALLEL_PARTITION_HYDRATION_COUNT_PER_DISK, 1); | ||
numberOfFileCopyThreads = verifiableProperties.getInt(NUMBER_OF_FILE_COPY_THREADS, 4); | ||
fileChunkTimeoutInMins = verifiableProperties.getInt(FILE_CHUNK_TIMEOUT_IN_MINUTES, 5); | ||
storeDataFlushIntervalInMbs = verifiableProperties.getLong(STORE_DATA_FLUSH_INTERVAL_IN_MBS, 1000); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
ambry-api/src/main/java/com/github/ambry/store/FileInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
package com.github.ambry.store; | ||
|
||
public class FileInfo { | ||
private String fileName; | ||
private final long fileSize; | ||
|
||
public FileInfo(String fileName, Long fileSize) { | ||
this.fileName = fileName; | ||
this.fileSize = fileSize; | ||
} | ||
public String getFileName() { | ||
return fileName; | ||
} | ||
|
||
public Long getFileSize() { | ||
return fileSize; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "FileInfo{" + | ||
"fileName='" + fileName + '\'' + | ||
", fileSize=" + fileSize + | ||
'}'; | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
ambry-api/src/main/java/com/github/ambry/store/LogInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.github.ambry.store; | ||
|
||
import java.util.List; | ||
|
||
|
||
public class LogInfo { | ||
FileInfo sealedSegment; | ||
List<FileInfo> indexSegments; | ||
List<FileInfo> bloomFilters; | ||
|
||
public LogInfo(FileInfo sealedSegment, List<FileInfo> indexSegments, List<FileInfo> bloomFilters) { | ||
this.sealedSegment = sealedSegment; | ||
this.indexSegments = indexSegments; | ||
this.bloomFilters = bloomFilters; | ||
} | ||
|
||
public FileInfo getSealedSegment() { | ||
return sealedSegment; | ||
} | ||
|
||
public void setSealedSegments(FileInfo sealedSegments) { | ||
this.sealedSegment = sealedSegments; | ||
} | ||
|
||
public List<FileInfo> getIndexSegments() { | ||
return indexSegments; | ||
} | ||
|
||
public void setIndexSegments(List<FileInfo> indexSegments) { | ||
this.indexSegments = indexSegments; | ||
} | ||
|
||
public List<FileInfo> getBloomFilters() { | ||
return bloomFilters; | ||
} | ||
|
||
public void setBloomFilters(List<FileInfo> bloomFilters) { | ||
this.bloomFilters = bloomFilters; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "LogInfo{" + | ||
"sealedSegment=" + sealedSegment + | ||
", indexSegments=" + indexSegments + | ||
", bloomFilters=" + bloomFilters + | ||
'}'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.