Package freenet.support.io

Examples of freenet.support.io.FilenameGenerator


        long shortTermLimit = core.getMinDiskFreeShortTerm();
        long longTermLimit = core.getMinDiskFreeLongTerm();
        File tempDir = core.tempFilenameGenerator.getDir();
        if(tempDir.getUsableSpace() < shortTermLimit)
            return Status.TRANSIENT; // Takes precedence.
        FilenameGenerator fg = core.persistentFilenameGenerator;
        if(fg != null) {
            File persistentTempDir = fg.getDir();
            long space = persistentTempDir.getUsableSpace();
            if(space < shortTermLimit)
                return Status.PERSISTENT_COMPLETION;
            if(space < longTermLimit)
                return Status.PERSISTENT;
View Full Code Here


    private File getWhere(Status status) {
        // FIXME return the filesystem rather than the directory. Will need java.nio.file (1.7).
        if(status == Status.PERSISTENT || status == Status.PERSISTENT_COMPLETION) {
            // Be very careful about race conditions!
            FilenameGenerator fg = core.persistentFilenameGenerator;
            if(fg != null) {
                return fg.getDir();
            }
        }
        return core.tempFilenameGenerator.getDir();
    }
View Full Code Here

    }
   
    FileUtil.setOwnerRWX(getTempDir());

    try {
      tempFilenameGenerator = new FilenameGenerator(random, true, getTempDir(), "temp-");
    } catch(IOException e) {
      String msg = "Could not find or create temporary directory (filename generator)";
      throw new NodeInitException(NodeInitException.EXIT_BAD_DIR, msg);
    }
View Full Code Here

  @Override
  protected void setUp() throws java.lang.Exception {
    tempDir = new File("tmp-slashdotstoretest");
    tempDir.mkdir();
    fg = new FilenameGenerator(weakPRNG, true, tempDir, "temp-");
    tbf = new TempBucketFactory(exec, fg, 4096, 65536, weakPRNG, false, 2*1024*1024, null);
    exec.start();
  }
View Full Code Here

        dir = new File("split-file-inserter-storage-test");
        dir.mkdir();
        executor = new WaitableExecutor(new PooledExecutor());
        ticker = new CheatingTicker(executor);
        RandomSource r = new DummyRandomSource(12345);
        fg = new FilenameGenerator(r, true, dir, "freenet-test");
        persistentFileTracker = new TrivialPersistentFileTracker(dir, fg);
        bigRAFFactory = new PooledFileRandomAccessBufferFactory(fg, r);
        smallBucketFactory = new ArrayBucketFactory();
        bigBucketFactory = new TempBucketFactory(executor, fg, 0, 0, r, false, 0, null);
        baseContext = HighLevelSimpleClientImpl.makeDefaultInsertContext(bigBucketFactory, new SimpleEventProducer());
View Full Code Here

        dir = new File("split-file-inserter-storage-test");
        dir.mkdir();
        executor = new WaitableExecutor(new PooledExecutor());
        ticker = new CheatingTicker(executor);
        RandomSource r = new DummyRandomSource(12345);
        fg = new FilenameGenerator(r, true, dir, "freenet-test");
        persistentFileTracker = new TrivialPersistentFileTracker(dir, fg);
        bigRAFFactory = new PooledFileRandomAccessBufferFactory(fg, r);
        smallBucketFactory = new ArrayBucketFactory();
        bigBucketFactory = new TempBucketFactory(executor, fg, 0, 0, r, false, 0, null);
        baseContext = HighLevelSimpleClientImpl.makeDefaultInsertContext(bigBucketFactory, new SimpleEventProducer());
View Full Code Here

TOP

Related Classes of freenet.support.io.FilenameGenerator

Copyright © 2018 www.massapicom. 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.