mirror of
https://github.com/logos-storage/logos-storage-nim-dht.git
synced 2026-01-04 06:23:05 +00:00
Add pragma for exception raises
This commit is contained in:
parent
57f4b6f7cb
commit
d73dc48515
@ -236,18 +236,18 @@ proc getNode*(d: Protocol, id: NodeId): Option[Node] =
|
||||
## Get the node with id from the routing table.
|
||||
d.routingTable.getNode(id)
|
||||
|
||||
proc randomNodes*(d: Protocol, maxAmount: int): seq[Node] =
|
||||
proc randomNodes*(d: Protocol, maxAmount: int): seq[Node] {.raises: Exception.} =
|
||||
## Get a `maxAmount` of random nodes from the local routing table.
|
||||
d.routingTable.randomNodes(maxAmount)
|
||||
|
||||
proc randomNodes*(d: Protocol, maxAmount: int,
|
||||
pred: proc(x: Node): bool {.gcsafe, noSideEffect.}): seq[Node] =
|
||||
pred: proc(x: Node): bool {.gcsafe, noSideEffect.}): seq[Node] {.raises: Exception.} =
|
||||
## Get a `maxAmount` of random nodes from the local routing table with the
|
||||
## `pred` predicate function applied as filter on the nodes selected.
|
||||
d.routingTable.randomNodes(maxAmount, pred)
|
||||
|
||||
proc randomNodes*(d: Protocol, maxAmount: int,
|
||||
enrField: (string, seq[byte])): seq[Node] =
|
||||
enrField: (string, seq[byte])): seq[Node] {.raises: Exception.} =
|
||||
## Get a `maxAmount` of random nodes from the local routing table. The
|
||||
## the nodes selected are filtered by provided `enrField`.
|
||||
d.randomNodes(maxAmount, proc(x: Node): bool = x.record.contains(enrField))
|
||||
|
||||
@ -555,7 +555,7 @@ proc nodeToRevalidate*(r: RoutingTable): Node =
|
||||
return b.nodes[^1]
|
||||
|
||||
proc randomNodes*(r: RoutingTable, maxAmount: int,
|
||||
pred: proc(x: Node): bool {.gcsafe, noSideEffect.} = nil): seq[Node] =
|
||||
pred: proc(x: Node): bool {.gcsafe, noSideEffect.} = nil): seq[Node] {.raises: Exception.} =
|
||||
## Get a `maxAmount` of random nodes from the routing table with the `pred`
|
||||
## predicate function applied as filter on the nodes selected.
|
||||
var maxAmount = maxAmount
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user