code: private void open() {
      // Load existing log segments from disk.
      for (Segment segment : loadSegments()) {
        segments.put(segment.descriptor().index(), segment);
      }
  
      // If a segment doesn't already exist, create an initial segment starting at index 1.
      if (!segments.isEmpty()) {
        currentSegment = segments.lastEntry().getValue();
      } else {
        SegmentDescriptor descriptor = SegmentDescriptor.builder()
          .withId(1)
          .withVersion(1)
          .withIndex(1)
          .withMaxSegmentSize(storage.maxSegmentSize())
          .withMaxEntries(storage.maxEntriesPerSegment())
          .build();
  
        descriptor.lock();
  
        currentSegment = createSegment(descriptor);
        currentSegment.descriptor().update(System.currentTimeMillis());
        currentSegment.descriptor().lock();
  
        segments.put(1L, currentSegment);
      }
    }
docs: Opens the segments.