Package freenet.client

Examples of freenet.client.FetchContext


        Bucket copyBucket = m1.toBucket(smallBucketFactory);
        assertTrue(BucketTools.equalBuckets(metaBucket, copyBucket));
       
        MyFetchCallback fcb = new MyFetchCallback();
       
        FetchContext fctx = HighLevelSimpleClientImpl.makeDefaultFetchContext(size*2, size*2, smallBucketFactory, new SimpleEventProducer());
       
        short cmode = (short) context.getCompatibilityMode().ordinal();
       
        SplitFileFetcherStorage fetcherStorage = new SplitFileFetcherStorage(m1, fcb, new ArrayList<COMPRESSOR_TYPE>(),
                new ClientMetadata(), false, cmode, fctx, false, salt, URI, URI, true, new byte[0],
View Full Code Here


        Bucket copyBucket = m1.toBucket(smallBucketFactory);
        assertTrue(BucketTools.equalBuckets(metaBucket, copyBucket));
       
        MyFetchCallback fcb = new MyFetchCallback();
       
        FetchContext fctx = HighLevelSimpleClientImpl.makeDefaultFetchContext(size*2, size*2, smallBucketFactory, new SimpleEventProducer());
       
        short cmode = (short) context.getCompatibilityMode().ordinal();
       
        SplitFileFetcherStorage fetcherStorage = new SplitFileFetcherStorage(m1, fcb, new ArrayList<COMPRESSOR_TYPE>(),
                new ClientMetadata(), false, cmode, fctx, false, salt, URI, URI, true, new byte[0],
View Full Code Here

    Metadata newMeta = (Metadata) meta.clone();
    newMeta.setSimpleRedirect();
    final SingleFileFetcher f;
    // FIXME arguable archive data is "temporary", but
    // this will use ctx.maxOutputLength
    f = new SingleFileFetcher(this, persistent, true, newMeta, new ArchiveFetcherCallback(forData, element, callback), new FetchContext(ctx, FetchContext.SET_RETURN_ARCHIVES, true, null), context);
    if(logMINOR) Logger.minor(this, "fetchArchive(): "+f);
    // Fetch the archive. The archive fetcher callback will unpack it, and either call the element
    // callback, or just go back around handleMetadata() on this, which will see that the data is now
    // available.
   
View Full Code Here

      boolean canWriteClientCache;
      boolean forkOnCacheable;
      boolean realTimeFlag;
      if(req instanceof SendableGet) {
        SendableGet sg = (SendableGet) req;
        FetchContext ctx = sg.getContext();
        localRequestOnly = ctx.localRequestOnly;
        ignoreStore = ctx.ignoreStore;
        canWriteClientCache = ctx.canWriteClientCache;
        realTimeFlag = sg.realTimeFlag();
        forkOnCacheable = false;
View Full Code Here

   
    public void testChooseKeyOneTry() throws CHKEncodeException, IOException, MetadataUnresolvedException, MetadataParseException, FetchException {
        int dataBlocks = 3, checkBlocks = 3;
        TestSplitfile test = TestSplitfile.constructSingleSegment(dataBlocks*BLOCK_SIZE, checkBlocks, null, false);
        StorageCallback cb = test.createStorageCallback();
        FetchContext ctx = test.makeFetchContext();
        ctx.maxSplitfileBlockRetries = 0;
        SplitFileFetcherStorage storage = test.createStorage(cb, ctx);
        boolean[] tried = new boolean[dataBlocks+checkBlocks];
        innerChooseKeyTest(dataBlocks, checkBlocks, storage.segments[0], tried, test, false);
        assertEquals(storage.chooseRandomKey(), null);
View Full Code Here

    public void testChooseKeyThreeTries() throws CHKEncodeException, IOException, MetadataUnresolvedException, MetadataParseException, FetchException {
        int dataBlocks = 3, checkBlocks = 3;
        TestSplitfile test = TestSplitfile.constructSingleSegment(dataBlocks*BLOCK_SIZE, checkBlocks, null, false);
        StorageCallback cb = test.createStorageCallback();
        FetchContext ctx = test.makeFetchContext();
        ctx.maxSplitfileBlockRetries = 2;
        SplitFileFetcherStorage storage = test.createStorage(cb, ctx);
        for(int i=0;i<3;i++) {
            boolean[] tried = new boolean[dataBlocks+checkBlocks];
            innerChooseKeyTest(dataBlocks, checkBlocks, storage.segments[0], tried, test, false);
View Full Code Here

    public void testChooseKeyCooldown() throws CHKEncodeException, IOException, MetadataUnresolvedException, MetadataParseException, FetchException, InterruptedException {
        int dataBlocks = 3, checkBlocks = 3;
        int COOLDOWN_TIME = 200;
        TestSplitfile test = TestSplitfile.constructSingleSegment(dataBlocks*BLOCK_SIZE, checkBlocks, null, false);
        StorageCallback cb = test.createStorageCallback();
        FetchContext ctx = test.makeFetchContext();
        ctx.maxSplitfileBlockRetries = 5;
        ctx.setCooldownRetries(3);
        ctx.setCooldownTime(COOLDOWN_TIME, true);
        SplitFileFetcherStorage storage = test.createStorage(cb, ctx);
        // 3 tries for each block.
        long now = System.currentTimeMillis();
        for(int i=0;i<3;i++) {
            boolean[] tried = new boolean[dataBlocks+checkBlocks];
View Full Code Here

        int checkBlocks = 3;
        long size = 32768*2-1;
        assertTrue(dataBlocks * (long)BLOCK_SIZE >= size);
        TestSplitfile test = TestSplitfile.constructSingleSegment(size, checkBlocks, null, true);
        StorageCallback cb = test.createStorageCallback();
        FetchContext ctx = test.makeFetchContext();
        ctx.maxSplitfileBlockRetries = 2;
        SplitFileFetcherStorage storage = test.createStorage(cb, ctx);
        // No need to shutdown the old storage.
        storage = test.createStorage(cb, ctx, cb.getRAF());
        for(int i=0;i<3;i++) {
View Full Code Here

        int checkBlocks = 3;
        long size = 32768*2-1;
        assertTrue(dataBlocks * (long)BLOCK_SIZE >= size);
        TestSplitfile test = TestSplitfile.constructSingleSegment(size, checkBlocks, null, true);
        StorageCallback cb = test.createStorageCallback();
        FetchContext ctx = test.makeFetchContext();
        ctx.maxSplitfileBlockRetries = 2;
        SplitFileFetcherStorage storage = test.createStorage(cb, ctx);
        // No need to shutdown the old storage.
        storage = test.createStorage(cb, ctx, cb.getRAF());
        for(int i=0;i<3;i++) {
View Full Code Here

    }

    public void start(short priority, long maxSize) {
      HighLevelSimpleClient hlsc = node.clientCore.makeClient(priority,
          false, false);
      FetchContext context = hlsc.getFetchContext();
      context.maxNonSplitfileRetries = -1;
      context.maxSplitfileBlockRetries = -1;
      context.maxTempLength = maxSize;
      context.maxOutputLength = maxSize;
      ClientGetter get = new ClientGetter(this, freenetURI, context,
View Full Code Here

TOP

Related Classes of freenet.client.FetchContext

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.