Tabnine Logo
Key
Code IndexAdd Tabnine to your IDE (free)

How to use
Key
in
co.edu.uniquindio.overlay

Best Java code snippets using co.edu.uniquindio.overlay.Key (Showing top 11 results out of 315)

origin: com.github.estigma88/jdhtuq-chord

if (key1.getHashing().compareTo(key2.getHashing()) == -1) {
  if (hashing.compareTo(key1.getHashing()) == 1
      && (hashing.compareTo(key2.getHashing()) == -1 || hashing
      .compareTo(key2.getHashing()) == 0)) {
    return true;
  if (key1.getHashing().compareTo(key2.getHashing()) == 1) {
    if ((hashing.compareTo(key1.getHashing()) == 1 && hashing
        .compareTo(key2.getHashing()) == 1)
        || hashing.compareTo(key2.getHashing()) == 0) {
      return true;
    } else {
      if (hashing.compareTo(key1.getHashing()) == -1
          && hashing.compareTo(key2.getHashing()) == -1) {
        return true;
    if (hashing.compareTo(key2.getHashing()) == 0) {
      return true;
origin: com.github.estigma88/jdhtuq-dhash

/**
 * Relocates the resources of the node.
 *
 * @param key The node where the files will be relocated.
 */
public void relocateAllResources(Key key, ProgressStatus progressStatus) throws StorageException {
  Set<String> resourcesNames = resourceManager.getAllKeys();
  log.info("Relocating Files...");
  log.debug("Number of files: [" + resourcesNames.size() + "]");
  int filesRelocated = 0;
  for (String name : resourcesNames) {
    Resource resource = resourceManager.find(name);
    Key fileKey = getFileKey(name);
    if (!fileKey.isBetween(key, overlayNode.getKey())) {
      boolean relocate = put(resource, key, false, progressStatus);
      filesRelocated++;
    }
  }
  log.info("Files relocated: [" + filesRelocated + "]");
}
origin: com.github.estigma88/jdhtuq-dhash

boolean putSync(Resource resource, ProgressStatus progressStatus) throws StorageException {
  progressStatus.status("put", 0L, 1L);
  progressStatus.status("overlay-node-lookup", 0L, 1L);
  Key key = keyFactory.newKey(resource.getId());
  log.debug("Resource to put: [" + resource.getId() + "] Hashing: ["
      + key.getHashing() + "]");
  Key lookupKey = overlayNode.lookUp(key);
  progressStatus.status("overlay-node-lookup", 1L, 1L);
  if (lookupKey == null) {
    log.error("Impossible to do put the resource: "
        + resource.getId() + " in this moment");
    throw new StorageException("Impossible to do put the resource: "
        + resource.getId() + " in this moment");
  }
  log.debug("Lookup key for " + key.getHashing() + ": ["
      + lookupKey.getValue() + "]");
  boolean success = put(resource, lookupKey, true, progressStatus);
  progressStatus.status("put", 1L, 1L);
  return success;
}
origin: com.github.estigma88/jdhtuq-dhash

public void leave(ProgressStatus progressStatus) throws StorageException {
  try {
    Key[] keys = overlayNode.leave();
    Set<String> resourcesNames = resourceManager.getAllKeys();
    log.info("Leaving...");
    log.debug("Number of files to transfer: ["
        + resourcesNames.size() + "]");
    if (!keys[0].equals(overlayNode.getKey())) {
      for (String name : resourcesNames) {
        Resource resource = resourceManager.find(name);
        put(resource, keys[0], false, progressStatus);
        resource.close();
      }
    }
    resourceManager.deleteAll();
    communicationManager.removeObserver(overlayNode.getKey().getValue());
  } catch (OverlayException | IOException e) {
    log.error("Error while leaving dhash node: '"
        + overlayNode.getKey().toString() + "'");
  }
}
origin: com.github.estigma88/jdhtuq-chord

} else {
  log.debug("Node '" + nodeChord.getKey().getValue() + "' found '"
      + findNode.getValue() + "'");
  nodeChord.join(findNode);
origin: com.github.estigma88/jdhtuq-chord

/**
 * Join a Chord ring using node <code>node</code>.
 * <p>
 * The <code>join</code> function asks <code>node</code> to find the
 * immediate successor of <code>n</code>.
 *
 * @param node Identifier of the known node.
 */
public void join(Key node) {
  Message lookupMessage;
  predecessor = null;
  lookupMessage = Message.builder()
      .id(idGenerator.newId())
      .sendType(Message.SendType.REQUEST)
      .messageType(Protocol.LOOKUP)
      .address(Address.builder()
          .destination(node.getValue())
          .source(key.getValue())
          .build())
      .param(Protocol.LookupParams.HASHING.name(), key.getHashing().toString())
      .param(Protocol.LookupParams.TYPE.name(), LookupType.JOIN.name())
      .build();
  successor = communicationManager.send(lookupMessage,
      ChordKey.class, LookupResponseParams.NODE_FIND.name());
  successorList.initializeSuccessors();
}
origin: com.github.estigma88/jdhtuq-chord

if (key1.getHashing().compareTo(key2.getHashing()) == -1) {
  if (hashing.compareTo(key1.getHashing()) == 1
      && (hashing.compareTo(key2.getHashing()) == -1)) {
    return true;
  if (key1.getHashing().compareTo(key2.getHashing()) == 1) {
    if (hashing.compareTo(key1.getHashing()) == 1
        && hashing.compareTo(key2.getHashing()) == 1) {
      return true;
    } else {
      if (hashing.compareTo(key1.getHashing()) == -1
          && hashing.compareTo(key2.getHashing()) == -1) {
        return true;
    if (hashing.compareTo(key2.getHashing()) == 0) {
      return true;
origin: com.github.estigma88/jdhtuq-dhash

.messageType(Protocol.PUT)
.address(Address.builder()
    .destination(lookupKey.getValue())
    .source(name)
    .build())
origin: com.github.estigma88/jdhtuq-dhash

/**
 * Replicates the specified file in its successors.
 *
 * @param resourceId The specified {@link Resource} to replicate.
 * @throws OverlayException
 */
public void replicateData(String resourceId, ProgressStatus progressStatus)
    throws OverlayException, StorageException {
  Key[] succesorList = overlayNode.getNeighborsList();
  for (int i = 0; i < Math.min(replicationFactor, succesorList.length); i++) {
    Resource resource = resourceManager.find(resourceId);
    log
        .debug("Replicate File: [" + resource.getId()
            + "] Hashing: ["
            + succesorList[i].getHashing() + "]");
    log.debug("Replicate to " + succesorList[i].getHashing());
    put(resource, succesorList[i], false, progressStatus);
  }
}
origin: com.github.estigma88/jdhtuq-chord

.messageType(Protocol.LOOKUP)
.address(Address.builder()
    .destination(next.getValue())
    .source(key.getValue())
    .build())
origin: com.github.estigma88/jdhtuq-dhash

.messageType(Protocol.CONTAIN)
.address(Address.builder()
    .destination(lookupKey.getValue())
    .source(name)
    .build())
  .messageType(Protocol.GET)
  .address(Address.builder()
      .destination(lookupKey.getValue())
      .source(name)
      .build())
co.edu.uniquindio.overlayKey

Javadoc

The Key class is responsible for encapsulating an string value with its respective hashing number.

Most used methods

  • getHashing
    This method is used for getting the hashing number of the key
  • getValue
    This method is used for getting the string value of the key
  • isBetween
    This method is used for compare if the key is between two specific keys. This comparison is made in

Popular in Java

  • Making http post requests using okhttp
  • compareTo (BigDecimal)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getSupportFragmentManager (FragmentActivity)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now