Examples of dataMap()


Examples of net.tomp2p.dht.FutureGet.dataMap()

         */
        public void list(final String nickName) throws IOException, ClassNotFoundException {
            Number160 key = Number160.createHash(nickName);
            FutureGet futureGet = peer.get(key).all().start();
            futureGet.awaitUninterruptibly();
            for (Map.Entry<Number640, Data> entry : futureGet.dataMap().entrySet()) {
                System.out.println("this peers' (" + nickName + ") friend:" + entry.getValue().object());
            }
            System.out.println("DHT reports that " + futureGet.dataMap().size() + " peer(s) are his friends");
        }

View Full Code Here

Examples of net.tomp2p.dht.FutureGet.dataMap()

            FutureGet futureGet = peer.get(key).all().start();
            futureGet.awaitUninterruptibly();
            for (Map.Entry<Number640, Data> entry : futureGet.dataMap().entrySet()) {
                System.out.println("this peers' (" + nickName + ") friend:" + entry.getValue().object());
            }
            System.out.println("DHT reports that " + futureGet.dataMap().size() + " peer(s) are his friends");
        }

        /**
         * @param peer
         *            Set reply handler for peer.
View Full Code Here

Examples of net.tomp2p.dht.FutureGet.dataMap()

      myPeer1.put("This is my location key", "This is my domain", "This is my content key",
              "And here comes the data").awaitUninterruptibly();
      MyPeer myPeer2 = new MyPeer(peers[5]);
      FutureGet futureGet = myPeer2.get("This is my location key", "This is my domain", "This is my content key");
      futureGet.awaitUninterruptibly();
      Map<Number640, Data> map = futureGet.dataMap();
      for (Data data : map.values()) {
        @SuppressWarnings("unchecked")
                MyData<String> myData = (MyData<String>) data.object();
        System.out.println("key: " + myData.key() + ", domain: " + myData.domain() + ", content: "
                + myData.content() + ", data: " + myData.data());
View Full Code Here

Examples of net.tomp2p.dht.FutureGet.dataMap()

            // get the interval
            System.out.println("get for " + inter2);
            FutureGet futureGet = peer.get(key).all().start();
            futureGet.awaitUninterruptibly();
            dhtCounter.incrementAndGet();
            for (Map.Entry<Number640, Data> entry : futureGet.dataMap().entrySet()) {
                // with each result we get a flag if we should query the children (this should be returned in the
                // future, e.g., partially_ok)
                StringBoolean stringBoolean = (StringBoolean) entry.getValue().object();
                result.add(stringBoolean.string);
                if (!stringBoolean.bool && inter2.size() > bagSize) {
View Full Code Here

Examples of net.tomp2p.dht.FutureGet.dataMap()

                peer.put(locationKey).dataMapContent(dataMap).start().awaitUninterruptibly();
            }
        } else if (query.getQueryType() == QueryType.SELECT) {
            FutureGet futureDHT = peer.get(locationKey).all().start();
            futureDHT.awaitUninterruptibly();
            for (Map.Entry<Number640, Data> entry : futureDHT.dataMap().entrySet()) {
                System.out.print("key: " + entry.getKey());
                System.out.println(", value: " + entry.getValue().object());
            }
        }
    }
View Full Code Here

Examples of net.tomp2p.dht.FutureGet.dataMap()

        // query for nr2, but return only those that are in this bloom filter
        FutureGet futureGet1 = peers[peer10].get(nr2).all().keyBloomFilter(contentBF)
                .domainKey(Number160.createHash("my_domain")).start();
        futureGet1.awaitUninterruptibly();
        System.out.println("For the 2nd key we requested with this Bloom filer and we got "
                + futureGet1.dataMap().size() + " items.");
       
        FutureGet futureGet2 = peers[peer10].get(nr2).all().bloomFilterIntersect().keyBloomFilter(contentBF)
                .domainKey(Number160.createHash("my_domain")).start();
        futureGet2.awaitUninterruptibly();
        System.out.println("For the 2nd key we requested with this Bloom filer and we got "
View Full Code Here

Examples of net.tomp2p.dht.FutureGet.dataMap()

       
        FutureGet futureGet2 = peers[peer10].get(nr2).all().bloomFilterIntersect().keyBloomFilter(contentBF)
                .domainKey(Number160.createHash("my_domain")).start();
        futureGet2.awaitUninterruptibly();
        System.out.println("For the 2nd key we requested with this Bloom filer and we got "
                + futureGet2.dataMap().size() + " items.");
    }
}
View Full Code Here

Examples of net.tomp2p.dht.FutureGet.dataMap()

  private String get(String name) throws ClassNotFoundException, IOException {
    FutureGet futureGet = peer.get(Number160.createHash(name)).start();
    futureGet.awaitUninterruptibly();
    if (futureGet.isSuccess()) {
      return futureGet.dataMap().values().iterator().next().object().toString();
    }
    return "not found";
  }

  private void store(String name, String ip) throws IOException {
View Full Code Here

Examples of net.tomp2p.dht.FutureGet.dataMap()

        futurePut = peers[50].add( nr ).data( data2 ).start();
        futurePut.awaitUninterruptibly();
        System.out.println( "added: " + toStore2 + " (" + futurePut.isSuccess() + ")" );
        FutureGet futureGet = peers[77].get( nr ).all().start();
        futureGet.awaitUninterruptibly();
        System.out.println( "size" + futureGet.dataMap().size() );
        Iterator<Data> iterator = futureGet.dataMap().values().iterator();
        System.out.println( "got: " + iterator.next().object() + " (" + futureGet.isSuccess() + ")" );
        System.out.println( "got: " + iterator.next().object() + " (" + futureGet.isSuccess() + ")" );
    }
View Full Code Here

Examples of net.tomp2p.dht.FutureGet.dataMap()

        futurePut.awaitUninterruptibly();
        System.out.println( "added: " + toStore2 + " (" + futurePut.isSuccess() + ")" );
        FutureGet futureGet = peers[77].get( nr ).all().start();
        futureGet.awaitUninterruptibly();
        System.out.println( "size" + futureGet.dataMap().size() );
        Iterator<Data> iterator = futureGet.dataMap().values().iterator();
        System.out.println( "got: " + iterator.next().object() + " (" + futureGet.isSuccess() + ")" );
        System.out.println( "got: " + iterator.next().object() + " (" + futureGet.isSuccess() + ")" );
    }

    /**
 
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.