Examples of IParameters


Examples of org.hive2hive.core.network.data.parameters.IParameters

      throws InvalidProcessStateException {
    return get(H2HEncryptionUtil.key2String(locationKey), contentKey);
  }

  protected NetworkContent get(String locationKey, String contentKey) throws InvalidProcessStateException {
    IParameters parameters = new Parameters().setLocationKey(locationKey).setContentKey(contentKey);
    return dataManager.get(parameters);
  }
View Full Code Here

Examples of org.hive2hive.core.network.data.parameters.IParameters

   * Performs a get call (blocking) and decrypts the received user profile.
   */
  public void get(QueueEntry entry) {
    logger.debug("Get user profile. user id = '{}'", credentials.getUserId());

    IParameters parameters = new Parameters().setLocationKey(credentials.getProfileLocationKey()).setContentKey(
        H2HConstants.USER_PROFILE);

    // load the current digest list from network
    NavigableMap<Number640, Number160> digest = dataManager.getDigest(parameters);
    // compare the current user profile's version key with the cached one
View Full Code Here

Examples of org.hive2hive.core.network.data.parameters.IParameters

          userProfileEncryptionKey);

      encryptedUserProfile.setBasedOnKey(entry.getUserProfile().getVersionKey());
      encryptedUserProfile.generateVersionKey();

      IParameters parameters = new Parameters().setLocationKey(credentials.getProfileLocationKey())
          .setContentKey(H2HConstants.USER_PROFILE).setVersionKey(encryptedUserProfile.getVersionKey())
          .setData(encryptedUserProfile).setProtectionKeys(entry.getUserProfile().getProtectionKeys())
          .setTTL(entry.getUserProfile().getTimeToLive());

      boolean success = dataManager.put(parameters);
View Full Code Here

Examples of org.hive2hive.core.network.data.parameters.IParameters

      return usersKeyPair.getPublic();
    if (publicKeyCache.containsKey(userId))
      // check the cache
      return publicKeyCache.get(userId);

    IParameters parameters = new Parameters().setLocationKey(userId).setContentKey(
        H2HConstants.USER_PUBLIC_KEY);
    NetworkContent content = dataManager.get(parameters);
    return evaluateResult(content, userId);
  }
View Full Code Here

Examples of org.hive2hive.core.network.data.parameters.IParameters

  }

  @Override
  public boolean putUserProfileTask(String userId, Number160 contentKey, NetworkContent content,
      KeyPair protectionKey) {
    IParameters parameters = new Parameters().setLocationKey(userId).setContentKey(contentKey)
        .setDomainKey(H2HConstants.USER_PROFILE_TASK_DOMAIN).setData(content)
        .setProtectionKeys(protectionKey).setTTL(content.getTimeToLive());
    FuturePut putFuture = putUnblocked(parameters);
    if (putFuture == null) {
      return false;
View Full Code Here

Examples of org.hive2hive.core.network.data.parameters.IParameters

    return listener.awaitAndGet();
  }

  @Override
  public NetworkContent getUserProfileTask(String userId) {
    IParameters parameters = new Parameters().setLocationKey(userId).setDomainKey(
        H2HConstants.USER_PROFILE_TASK_DOMAIN);

    FutureGet futureGet = getPeer()
        .get(parameters.getLKey())
        .from(new Number640(parameters.getLKey(), parameters.getDKey(), Number160.ZERO,
            Number160.ZERO))
        .to(new Number640(parameters.getLKey(), parameters.getDKey(), Number160.MAX_VALUE,
            Number160.MAX_VALUE)).ascending().returnNr(1).start();
    FutureGetListener listener = new FutureGetListener(parameters);
    futureGet.addListener(listener);
    return listener.awaitAndGet();
  }
View Full Code Here

Examples of org.hive2hive.core.network.data.parameters.IParameters

    return listener.await();
  }

  @Override
  public boolean removeUserProfileTask(String userId, Number160 contentKey, KeyPair protectionKey) {
    IParameters parameters = new Parameters().setLocationKey(userId)
        .setDomainKey(H2HConstants.USER_PROFILE_TASK_DOMAIN).setContentKey(contentKey)
        .setProtectionKeys(protectionKey);
    FutureRemove futureRemove = removeUnblocked(parameters);
    FutureRemoveListener listener = new FutureRemoveListener(parameters, true, this);
    futureRemove.addListener(listener);
View Full Code Here

Examples of org.hive2hive.core.network.data.parameters.IParameters

  public void testPut() throws ClassNotFoundException, IOException, NoPeerConnectionException {
    NetworkManager nodeA = network.get(random.nextInt(networkSize));
    NetworkManager nodeB = network.get(random.nextInt(networkSize));

    H2HTestData data = new H2HTestData(NetworkTestUtil.randomString());
    IParameters parameters = new Parameters().setLocationKey(nodeA.getNodeId())
        .setContentKey(NetworkTestUtil.randomString()).setData(data);

    boolean success = nodeB.getDataManager().put(parameters);
    Assert.assertTrue(success);
    FutureGet futureGet = nodeB.getDataManager().getUnblocked(parameters);
View Full Code Here

Examples of org.hive2hive.core.network.data.parameters.IParameters

      if (i > 0) {
        data.setBasedOnKey(content.get(i - 1).getVersionKey());
      }
      content.add(data);

      IParameters parameters = new Parameters().setLocationKey(locationKey).setContentKey(contentKey)
          .setData(data);
      boolean success = nodeB.getDataManager().put(parameters);
      Assert.assertTrue(success);
      FutureGet futureGet = nodeB.getDataManager().getUnblocked(parameters);
      futureGet.awaitUninterruptibly();
View Full Code Here

Examples of org.hive2hive.core.network.data.parameters.IParameters

      return;
    }

    logger.debug("Downloading chunk {} of file {} from the DHT", metaChunk.getIndex(),
        task.getDestinationName());
    IParameters parameters = new Parameters().setLocationKey(metaChunk.getChunkId()).setContentKey(
        H2HConstants.FILE_CHUNK);
    NetworkContent content = dataManager.get(parameters);
    if (content == null) {
      task.abortDownload("Chunk not found in the DHT");
      return;
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.