Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pot: new package for proximity order tree #3644

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
3 participants
@zelig
Copy link
Contributor

zelig commented Feb 5, 2017

POT: proximity order tree new package defining a container and key/value types.
to be used in swarm kademlia and possibly chunk memory cache

pot implements a container similar to a binary tree.
Value types implement the PoVal interface which provides the PO (proximity order)
comparison operator.
Each fork in the trie is itself a value. Values of the subtree contained under
a node all share the same order when compared to other elements in the tree.

Example of proximity order is the length of the common prefix over bitvectors.
(which is equivalent to the order of magnitude of the XOR distance over integers).

The package provides two implementations of PotVal,

  • BoolAddress: an arbitrary length boolean vector
  • HashAddress: a bitvector based address derived from 256 bit hash (common.Hash)

If the address space if limited, equality is defined as the maximum proximity order.

Arbitrary value types can extend these base types or define their own PO method.

The container offers applicative (funcional) style methods on PO trees:

  • adding/removing en element
  • merging two PO trees (union)

as well as iterator accessors that respect proximity order

@zelig zelig added the in progress label Feb 5, 2017

@zelig zelig force-pushed the ethersphere:pot branch 3 times, most recently Feb 5, 2017

type PotVal interface {
PO(PotVal, int) (po int, eq bool)
String() string
}

This comment has been minimized.

Copy link
@fjl

fjl Feb 28, 2017

Contributor

Naming suggestion:

type Value interface{
    ProximityOrder(Value, int) (po int, eq bool)
}

Please add documentation about the semantics of the method.

}
}

// Pin() returns the pinned element (key) of the Pot

This comment has been minimized.

Copy link
@fjl

fjl Feb 28, 2017

Contributor

Please omit () and parameter names from the beginning of documentation comments.

@zelig zelig self-assigned this Mar 27, 2017

@zelig zelig force-pushed the ethersphere:pot branch to 78ad377 Mar 28, 2017

@zelig zelig added the feature label Apr 20, 2017

@zelig zelig referenced this pull request Jun 26, 2017

Closed

swarm related PRs - Q2 merge plan #14706

9 of 13 tasks complete
@fjl

This comment has been minimized.

Copy link
Contributor

fjl commented Sep 7, 2017

AFAIK you have a better version of this that will be submitted soon, closing.

@fjl fjl closed this Sep 7, 2017

@zelig

This comment has been minimized.

Copy link
Contributor Author

zelig commented Sep 8, 2017

@fjl ok i will open once ready thanks

@gbalint gbalint deleted the ethersphere:pot branch May 25, 2018

@gbalint gbalint restored the ethersphere:pot branch May 25, 2018

@gbalint gbalint deleted the ethersphere:pot branch May 25, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.