Package net.tomp2p.dht

Examples of net.tomp2p.dht.FutureDigest


       
        PeerDHT[] peers = new PeerDHT[] {peer1, peer2, peer3};
        //
        FuturePut futurePut = peer1.put(new Number160(nr3)).data(new Data("store on peer1")).start();
        futurePut.awaitUninterruptibly();
        FutureDigest futureDigest = peer1.digest(new Number160(nr3)).start();
        futureDigest.awaitUninterruptibly();
        System.out.println("we found the data on " + futureDigest.rawDigest().size() + " peers");
        // now peer1 gets to know peer2, transfer the data
        peer1.peer().bootstrap().peerAddress(peer2.peerAddress()).start();
        peer1.peer().bootstrap().peerAddress(peer3.peerAddress()).start();
        Thread.sleep(ONE_SECOND);
        futureDigest = peer1.digest(new Number160(nr3)).start();
        futureDigest.awaitUninterruptibly();
        System.out.println("we found the data on " + futureDigest.rawDigest().size() + " peers");
        shutdown(peers);
    }
View Full Code Here


        }
        futurePut = peers[peer60].put(nr2).dataMapContent(contentMap).domainKey(Number160.createHash("my_domain"))
                .start();
        futurePut.awaitUninterruptibly();
        // digest the first entry
        FutureDigest futureDigest = peers[peer20].digest(nr1).all().returnBloomFilter()
                .domainKey(Number160.createHash("my_domain")).start();
        futureDigest.awaitUninterruptibly();
        // we have the bloom filter for the content keys:
        SimpleBloomFilter<Number160> contentBF = futureDigest.digest().contentBloomFilter();
               
        System.out.println("We got bloomfilter for the first key: " + contentBF);
        //TODO: check keyBF.contains(new Number160(123));
        // query for nr2, but return only those that are in this bloom filter
        FutureGet futureGet1 = peers[peer10].get(nr2).all().keyBloomFilter(contentBF)
View Full Code Here

TOP

Related Classes of net.tomp2p.dht.FutureDigest

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.