Package net.tomp2p.dht

Examples of net.tomp2p.dht.FuturePut


        }
        data.prepareFlag();
        sortedMap.put(vKey, data);

        // put test data (prepare)
        FuturePut fput = peers[rnd.nextInt(10)].put(locationKey)
            .data(contentKey, sortedMap.get(vKey)).domainKey(domainKey).versionKey(vKey).start();
        fput.awaitUninterruptibly();
        fput.futureRequests().awaitUninterruptibly();
        fput.futureRequests().awaitListenersUninterruptibly();
        Assert.assertEquals(true, fput.isSuccess());

        // confirm put
        FuturePut futurePutConfirm = peers[rnd.nextInt(10)].put(locationKey).domainKey(domainKey)
            .data(contentKey, new Data()).versionKey(vKey).putConfirm().start();
        futurePutConfirm.awaitUninterruptibly();
        futurePutConfirm.awaitListenersUninterruptibly();

        // get latest version with digest
        FutureGet fget = peers[rnd.nextInt(10)].get(locationKey).domainKey(domainKey)
            .contentKey(contentKey).getLatest().withDigest().start();
        fget.awaitUninterruptibly();
View Full Code Here


    PeerDHT peers [] = UtilsReplication.createNodes(11, rnd, 4000, null);
    UtilsReplication.perfectRouting(peers);
   
    RoutingConfiguration r = new RoutingConfiguration(6, 10, 2);
    RequestP2PConfiguration p = new RequestP2PConfiguration(6, 10, 0);
    FuturePut fp = peers[5].put(Number160.MAX_VALUE).routingConfiguration(r).requestP2PConfiguration(p).data(new Data("test")).start();
    fp.awaitUninterruptibly();
    //now it is stored on 6 peers: 0, 1 , 2, 4, 5, 8
    for(PeerDHT p1:peers) {
      System.err.println(p1.peer().peerAddress()+":"+p1.storageLayer().get());
    }
    checkIfPresent(peers, 0, 1 , 2, 4, 5, 8);
View Full Code Here

TOP

Related Classes of net.tomp2p.dht.FuturePut

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.