Beispiel #1
0
 public void deleteSegment(SegmentDescriptor descriptor) throws IOException {
   indexService.deleteIndex(descriptor);
   File segmentFile = fileService.createSegmentFile(descriptor);
   if (segmentFile.exists()) {
     assert segmentFile.delete();
   }
 }
Beispiel #2
0
 public Segment createSegment(SegmentDescriptor descriptor) throws IOException {
   File segmentFile = fileService.createSegmentFile(descriptor);
   if (!segmentFile.exists()) {
     if (!segmentFile.createNewFile()) {
       throw new IOException("Error create new file: " + segmentFile);
     }
   }
   return new Segment(
       segmentFile, descriptor, indexService.createIndex(descriptor), streamService);
 }