class KademliaRoutingTable<T> : Set<T>
(source)
A Kademlia Routing Table
KademliaRoutingTable(selfId: ByteArray, k: Int, maxReplacements: Int = k, nodeId: (T) -> ByteArray)
Create a new routing table. |
val size: Int |
fun add(node: T): T?
Add a node to the table. |
|
fun clear(): Unit
Clear all nodes (and replacements) from the table. |
|
fun contains(element: T): Boolean |
|
fun containsAll(elements: Collection<T>): Boolean |
|
fun evict(node: T): Boolean
Remove a node from the table, potentially adding an alternative from the replacement cache. |
|
fun isEmpty(): Boolean |
|
fun iterator(): Iterator<T> |
|
fun nearest(targetId: ByteArray, limit: Int): List<T>
Return the nearest nodes to a target id, in order from closest to furthest. |
fun <T> create(selfId: ByteArray, k: Int, nodeId: Function<T, ByteArray>): KademliaRoutingTable<T> fun <T> create(selfId: ByteArray, k: Int, maxReplacements: Int, nodeId: Function<T, ByteArray>): KademliaRoutingTable<T>
Create a new routing table. |