private void createHeader ( RollingSegmentHandle handle ) throws StreamSegmentException { Preconditions . checkArgument ( handle . getHeaderHandle ( ) == null , "handle already has a header." ) ; // Create a new Header SegmentChunk. String headerName = StreamSegmentNameUtils . getHeaderSegmentName ( handle . getSegmentName ( ) ) ; this . baseStorage . create ( headerName ) ; val headerHandle = this . baseStorage . openWrite ( headerName ) ; // Create a new Handle and serialize it, after which update the original handle. val newHandle = new RollingSegmentHandle ( headerHandle , handle . getRollingPolicy ( ) , handle . chunks ( ) ) ; serializeHandle ( newHandle ) ; handle . refresh ( newHandle ) ; }
region Header Operations