Package org.apache.lucene.store

Examples of org.apache.lucene.store.Directory.copy()


     
      // fsync all copied files (except segmentsFile)
      indexDir.sync(files);
     
      // now copy and fsync segmentsFile
      clientDir.copy(indexDir, segmentsFile, segmentsFile, IOContext.READONCE);
      indexDir.sync(Collections.singletonList(segmentsFile));
     
      success = true;
    } finally {
      if (!success) {
View Full Code Here


    CompoundFileDirectory csw = new CompoundFileDirectory(newDir, "d.cfs", newIOContext(random()), true);
    createSequenceFile(newDir, "d1", (byte) 0, 15);
    IndexOutput out = csw.createOutput("d.xyz", newIOContext(random()));
    out.writeInt(0);
    try {
      newDir.copy(csw, "d1", "d1", newIOContext(random()));
      fail("file does already exist");
    } catch (IllegalArgumentException e) {
      //
    }
    out.close();
View Full Code Here

    out.writeInt(0);
    out1.writeInt(1);
    out.close();
    out1.close();
    nested.close();
    newDir.copy(csw, "b.cfs", "b.cfs", newIOContext(random()));
    newDir.copy(csw, "b.cfe", "b.cfe", newIOContext(random()));
    newDir.deleteFile("b.cfs");
    newDir.deleteFile("b.cfe");
    csw.close();
   
View Full Code Here

    out1.writeInt(1);
    out.close();
    out1.close();
    nested.close();
    newDir.copy(csw, "b.cfs", "b.cfs", newIOContext(random()));
    newDir.copy(csw, "b.cfe", "b.cfe", newIOContext(random()));
    newDir.deleteFile("b.cfs");
    newDir.deleteFile("b.cfe");
    csw.close();
   
    assertEquals(2, newDir.listAll().length);
View Full Code Here

    }
   
    final CompoundFileDirectory cfd = new CompoundFileDirectory(d, "c.cfs", newIOContext(random()), true);
    for(int fileIdx=0;fileIdx<FILE_COUNT;fileIdx++) {
      final String fileName = "file." + fileIdx;
      d.copy(cfd, fileName, fileName, newIOContext(random()));
    }
    cfd.close();

    final IndexInput[] ins = new IndexInput[FILE_COUNT];
    final CompoundFileDirectory cfr = new CompoundFileDirectory(d, "c.cfs", newIOContext(random()), false);
View Full Code Here

    out.writeInt(0);
    out1.writeInt(1);
    out.close();
    out1.close();
    nested.close();
    newDir.copy(csw, "b.cfs", "b.cfs", newIOContext(random()));
    newDir.copy(csw, "b.cfe", "b.cfe", newIOContext(random()));
    newDir.deleteFile("b.cfs");
    newDir.deleteFile("b.cfe");
    csw.close();
   
View Full Code Here

    out1.writeInt(1);
    out.close();
    out1.close();
    nested.close();
    newDir.copy(csw, "b.cfs", "b.cfs", newIOContext(random()));
    newDir.copy(csw, "b.cfe", "b.cfe", newIOContext(random()));
    newDir.deleteFile("b.cfs");
    newDir.deleteFile("b.cfe");
    csw.close();
   
    assertEquals(2, newDir.listAll().length);
View Full Code Here

    }
   
    final CompoundFileDirectory cfd = new CompoundFileDirectory(d, "c.cfs", newIOContext(random()), true);
    for(int fileIdx=0;fileIdx<FILE_COUNT;fileIdx++) {
      final String fileName = "file." + fileIdx;
      d.copy(cfd, fileName, fileName, newIOContext(random()));
    }
    cfd.close();

    final IndexInput[] ins = new IndexInput[FILE_COUNT];
    final CompoundFileDirectory cfr = new CompoundFileDirectory(d, "c.cfs", newIOContext(random()), false);
View Full Code Here

     
      // fsync all copied files (except segmentsFile)
      indexDir.sync(files);
     
      // now copy and fsync segmentsFile
      clientDir.copy(indexDir, segmentsFile, segmentsFile, IOContext.READONCE);
      indexDir.sync(Collections.singletonList(segmentsFile));
     
      success = true;
    } finally {
      if (!success) {
View Full Code Here

      // now copy and fsync segmentsFile, taxonomy first because it is ok if a
      // reader sees a more advanced taxonomy than the index.
      if (taxoSegmentsFile != null) {
        taxoClientDir.copy(taxoDir, taxoSegmentsFile, taxoSegmentsFile, IOContext.READONCE);
      }
      indexClientDir.copy(indexDir, indexSegmentsFile, indexSegmentsFile, IOContext.READONCE);
     
      if (taxoSegmentsFile != null) {
        taxoDir.sync(Collections.singletonList(taxoSegmentsFile));
      }
      indexDir.sync(Collections.singletonList(indexSegmentsFile));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.