Package net.tomp2p.rpc

Examples of net.tomp2p.rpc.DigestResult


                         
                          KeyMap640Keys keyMaps = future.responseMessage()
                              .keyMap640Keys(0);
                          if (keyMaps != null && keyMaps.keysMap() != null) {
                            rawDigest.put(future.request().recipient(),
                                new DigestResult(keyMaps.keysMap()));
                          }

                                                    logger.debug("set data from {}", future.request()
                                                            .recipient());
                                                }
View Full Code Here


                                            @Override
                                            public void interMediateResponse(FutureResponse future) {
                                                // the future tells us that the communication was successful, which is
                                                // ok for digest
                                                if (future.isSuccess()) {
                              final DigestResult digest;
                              if (builder.isReturnMetaValues()) {
                                Map<Number640, Data> dataMap = future.responseMessage()
                                        .dataMap(0).dataMap();
                                digest = new DigestResult(dataMap);
                              } else if (builder.isReturnBloomFilter()) {
                                SimpleBloomFilter<Number160> sbf1 = future.responseMessage()
                                        .bloomFilter(0);
                                SimpleBloomFilter<Number160> sbf2 = future.responseMessage()
                                        .bloomFilter(1);
                                digest = new DigestResult(sbf1, sbf2);
                              } else {
                                NavigableMap<Number640, Collection<Number160>> keyDigest = future
                                        .responseMessage().keyMap640Keys(0).keysMap();
                                digest = new DigestResult(keyDigest);
                              }
                              rawDigest.put(future.request().recipient(), digest);
                              logger.debug("set data from {}", future.request().recipient());
                                                }
                                            }
View Full Code Here

      fput.awaitUninterruptibly();

      // get digest
      FutureDigest fget = peers[77].digest(lKey).all().start();
      fget.awaitUninterruptibly();
      DigestResult dr = fget.digest();
      NavigableMap<Number640, Collection<Number160>> map = dr.keyDigest();
     
      // verify fetched digest
      Entry<Number640, Collection<Number160>> e1 = map.pollFirstEntry();
      Assert.assertEquals(Number160.ONE, e1.getValue().iterator().next());
      Assert.assertEquals(new Number640(lKey, Number160.ZERO, ckey, versionKey1), e1.getKey());
View Full Code Here

      // get digest
      FutureDigest fget = peers[rnd.nextInt(100)].digest(lKey)
          .from(new Number640(lKey, dKey, ckey, Number160.ZERO))
          .to(new Number640(lKey, dKey, ckey, Number160.MAX_VALUE)).start();
      fget.awaitUninterruptibly();
      DigestResult dr = fget.digest();
      NavigableMap<Number640, Collection<Number160>> fetchedDataMap = dr.keyDigest();

      // verify fetched digest
      Assert.assertEquals(dataMap.size(), fetchedDataMap.size());
      for (Number640 key : dataMap.keySet()) {
        Assert.assertTrue(fetchedDataMap.containsKey(key));
View Full Code Here

          .contentKey(contentKey).getLatest().withDigest().start();
      fgetWithDigest.awaitUninterruptibly();
      Assert.assertTrue(fgetWithDigest.isSuccess());

      // check digest result
      DigestResult digestResult = fgetWithDigest.digest();
      Assert.assertEquals(12, digestResult.keyDigest().size());
      for (Number160 vKey : sortedMap.keySet()) {
        Number640 key = new Number640(locationKey, domainKey, contentKey, vKey);
        Assert.assertTrue(digestResult.keyDigest().containsKey(key));
        Assert.assertEquals(sortedMap.get(vKey).basedOnSet().size(), digestResult.keyDigest()
            .get(key).size());
        for (Number160 bKey : sortedMap.get(vKey).basedOnSet()) {
          Assert.assertTrue(digestResult.keyDigest().get(key).contains(bKey));
        }
      }
    } finally {
      if (master != null) {
        master.shutdown().await();
View Full Code Here

          .contentKey(contentKey).getLatest().withDigest().start();
      fgetWithDigest.awaitUninterruptibly();
      Assert.assertTrue(fgetWithDigest.isSuccess());

      // check digest result
      DigestResult digestResult = fgetWithDigest.digest();
      Assert.assertEquals(13, digestResult.keyDigest().size());
      for (Number160 vKey : sortedMap.keySet()) {
        Number640 key = new Number640(locationKey, domainKey, contentKey, vKey);
        Assert.assertTrue(digestResult.keyDigest().containsKey(key));
        Assert.assertEquals(sortedMap.get(vKey).basedOnSet().size(), digestResult.keyDigest()
            .get(key).size());
        for (Number160 bKey : sortedMap.get(vKey).basedOnSet()) {
          Assert.assertTrue(digestResult.keyDigest().get(key).contains(bKey));
        }
      }
    } finally {
      if (master != null) {
        master.shutdown().await();
View Full Code Here

          .contentKey(contentKey).getLatest().withDigest().start();
      fgetWithDigest.awaitUninterruptibly();
      Assert.assertTrue(fgetWithDigest.isSuccess());

      // check digest result
      DigestResult digestResult = fgetWithDigest.digest();
      Assert.assertEquals(3, digestResult.keyDigest().size());
      for (Number160 vKey : sortedMap.keySet()) {
        Number640 key = new Number640(locationKey, domainKey, contentKey, vKey);
        Assert.assertTrue(digestResult.keyDigest().containsKey(key));
        Assert.assertEquals(sortedMap.get(vKey).basedOnSet().size(), digestResult.keyDigest()
            .get(key).size());
        for (Number160 bKey : sortedMap.get(vKey).basedOnSet()) {
          Assert.assertTrue(digestResult.keyDigest().get(key).contains(bKey));
        }
      }
    } finally {
      if (master != null) {
        master.shutdown().await();
View Full Code Here

        return evaluate0(rawKeys);
    }

    @Override
    public DigestResult evaluate5(Map<PeerAddress, DigestResult> rawDigest) {
        DigestResult retVal =  evaluate0(rawDigest);
        //if its null, we know that we did not get any results. In order to return null, we return and empty digest result.
        return retVal == null ? new DigestResult(emptyMap):retVal;
    }
View Full Code Here

        Number640 key = new Number640(key480, vKey);
        Assert.assertTrue(dataMap.containsKey(key));
        Assert.assertEquals(data.object(), dataMap.get(key).object());

        // check digest result
        DigestResult digestResult = fget.digest();
        Assert.assertEquals(sortedMap.size(), digestResult.keyDigest().size());
        for (Number160 versionKey : sortedMap.keySet()) {
          Number640 digestKey = new Number640(locationKey, domainKey, contentKey, versionKey);
          Assert.assertTrue(digestResult.keyDigest().containsKey(digestKey));
          Assert.assertEquals(sortedMap.get(versionKey).basedOnSet().size(), digestResult
              .keyDigest().get(digestKey).size());
          for (Number160 bKey : sortedMap.get(versionKey).basedOnSet()) {
            Assert.assertTrue(digestResult.keyDigest().get(digestKey).contains(bKey));
          }
        }
      }
    } finally {
      if (master != null) {
View Full Code Here

TOP

Related Classes of net.tomp2p.rpc.DigestResult

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.