Class FilePadding
- java.lang.Object
-
- org.apache.zookeeper.server.persistence.FilePadding
-
public class FilePadding extends Object
-
-
Constructor Summary
Constructors Constructor Description FilePadding()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static long
calculateFileSizeWithPadding(long position, long fileSize, long preAllocSize)
Calculates a new file size with padding.static long
getPreAllocSize()
Getter of preAllocSize has been added for testingvoid
setCurrentSize(long currentSize)
static void
setPreallocSize(long size)
method to allow setting preallocate size of log file to pad the file.
-
-
-
Method Detail
-
getPreAllocSize
public static long getPreAllocSize()
Getter of preAllocSize has been added for testing
-
setPreallocSize
public static void setPreallocSize(long size)
method to allow setting preallocate size of log file to pad the file.- Parameters:
size
- the size to set to in bytes
-
setCurrentSize
public void setCurrentSize(long currentSize)
-
calculateFileSizeWithPadding
public static long calculateFileSizeWithPadding(long position, long fileSize, long preAllocSize)
Calculates a new file size with padding. We only return a new size if the current file position is sufficiently close (less than 4K) to end of file and preAllocSize is > 0.- Parameters:
position
- the point in the file we have written tofileSize
- application keeps track of the current file sizepreAllocSize
- how many bytes to pad- Returns:
- the new file size. It can be the same as fileSize if no padding was done.
-
-