Move entry serialization back to ByteBufWriter
[controller.git] / atomix-storage / src / main / java / io / atomix / storage / journal / FileWriter.java
index a677fc3d26e75d2e0bbfbd7d793ca3dab77dc929..fc9ef64fe3097eb87e194ab4f1e03611ba96de79 100644 (file)
@@ -48,6 +48,14 @@ abstract sealed class FileWriter permits DiskFileWriter, MappedFileWriter {
      */
     abstract void writeEmptyHeader(int position);
 
+    /**
+     * Allocate file space. Note that the allocated space may be a buffer disconnected from the file. Any modifications
+     * to the returned buffer need to be committed via {@link #commitWrite(int, ByteBuffer)}.
+     *
+     * @param position position to start from
+     * @param size the size to allocate
+     * @return A {@link ByteBuffer} covering the allocated area
+     */
     abstract ByteBuffer startWrite(int position, int size);
 
     abstract void commitWrite(int position, ByteBuffer entry);