Examples of KUID


Examples of org.ardverk.dht.KUID

   * Compares the localhost's {@link KUID} with the given {@link Contact}'s
   * {@link KUID} and throws an {@link IllegalArgumentException} if the two
   * have different lengths.
   */
  private void checkKeyLength(Contact other) throws IllegalArgumentException {
    KUID contactId = localhost.getId();
    KUID otherId = other.getId();
    if (contactId.lengthInBits()
        != otherId.lengthInBits()) {
      throw new IllegalArgumentException(
          "Bits: " + contactId.lengthInBits()
          + " vs. " + contactId.lengthInBits());
    }
  }
View Full Code Here

Examples of org.ardverk.dht.KUID

    StateEntity entity = add0(contact);
    fireContact(entity.bucket, entity.existing, contact);
  }
 
  private synchronized StateEntity  add0(Contact contact) {
    KUID contactId = contact.getId();
    DefaultBucket bucket = buckets.selectValue(contactId);
    ContactEntry entry = bucket.get(contactId);
   
    Contact existing = null;
    if (entry != null) {
View Full Code Here

Examples of org.ardverk.dht.KUID

          // Cancellations are OK too
          if (future.isCancelled()) {
            return;
          }
         
          KUID contactId = contact.getId();
         
          synchronized (DefaultRouteTable.this) {
            DefaultBucket bucket = buckets.selectValue(contactId);
            ContactEntry current = bucket.get(contactId);
           
View Full Code Here

Examples of org.ardverk.dht.KUID

   
    // We *split* the Bucket if:
    // 1. Bucket contains the localhost Contact
    // 2. Bucket is smallest subtree
    // 3. Bucket hasn't reached its max depth
    KUID contactId = localhost.getId();
   
    if (bucket.contains(contactId)
        || isSmallestSubtree(bucket)
        || !isTooDeep(bucket)) {
      return true;
View Full Code Here

Examples of org.ardverk.dht.KUID

   * Returns true if the given {@link DefaultBucket} is the closest left
   * or right hand sibling of the {@link DefaultBucket} which contains
   * the localhost {@link Contact}.
   */
  private synchronized boolean isSmallestSubtree(DefaultBucket bucket) {
    KUID contactId = localhost.getId();
    KUID bucketId = bucket.getId();
    int prefixLength = contactId.commonPrefix(bucketId);
   
    // The sibling Bucket contains the localhost Contact.
    // We're looking if the other Bucket is its sibling
    // (what we call the smallest subtree).
View Full Code Here

Examples of org.ardverk.dht.KUID

   
    long creationTime = readLong();
    SortedMap<KUID, Vector> dst = new TreeMap<KUID, Vector>();
   
    while (0 < count--) {
      KUID contactId = readKUID();
      Vector vector = readVector();
     
      if (!vector.isEmpty()) {
        dst.put(contactId, vector);
      }
View Full Code Here

Examples of org.ardverk.dht.KUID

   
    /**
     * Adds the given {@link ContactEntry} to the {@link Bucket}'s active list.
     */
    private boolean addActive(ContactEntry entry) {
      KUID contactId = entry.getId();
     
      // Make sure Bucket does not contain the Contact!
      assert (!contains(contactId));
       
      if (hasOrMakeSpace()) {
View Full Code Here

Examples of org.ardverk.dht.KUID

    int value = readInt();
    return new Vector(timeStamp, value);
  }
 
  public Contact readSender(Contact.Type type, SocketAddress src) throws IOException {
    KUID contactId = readKUID();
    int instanceId = readInt();
    boolean invisible = readBoolean();
    SocketAddress address = readSocketAddress();
   
    return new DefaultContact(type, contactId,
View Full Code Here

Examples of org.ardverk.dht.KUID

    return new DefaultContact(type, contactId,
        instanceId, invisible, src, address);
  }
 
  public Contact readContact() throws IOException {
    KUID contactId = readKUID();
    SocketAddress address = readSocketAddress();
   
    return new DefaultContact(contactId, address);
  }
View Full Code Here

Examples of org.ardverk.dht.KUID

    /**
     * Adds the {@link ContactEntry} to the {@link Bucket}'s cache list.
     */
    private ContactEntry addCache(ContactEntry entry) {
      Contact contact = entry.getContact();
      KUID contactId = contact.getId();
     
      // Make sure Bucket does not contain the Contact!
      assert (!contains(contactId));
     
      if (!isCacheFull()) {
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.