mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-02 14:03:06 +00:00
enhancement/init-function-signature-type (#93)
This commit is contained in:
parent
4d9a7e4641
commit
51d521d3ef
@ -13,7 +13,7 @@ five method are:
|
||||
5. **Query** - for historical messages.
|
||||
|
||||
```Nim
|
||||
proc init*(conf: WakuNodeConf): Future[WakuNode]
|
||||
proc init*(T: type WakuNode, conf: WakuNodeConf): Future[T]
|
||||
## Creates and starts a Waku node.
|
||||
##
|
||||
## Status: Implemented.
|
||||
|
||||
@ -18,7 +18,7 @@ let conf = WakuNodeConf.load()
|
||||
# Node operations happens asynchronously
|
||||
proc runBackground(conf: WakuNodeConf) {.async.} =
|
||||
# Create and start the node
|
||||
let node = await init(conf)
|
||||
let node = await WakuNode.init(conf)
|
||||
|
||||
# Subscribe to a topic
|
||||
let topic = "foobar"
|
||||
|
||||
@ -223,7 +223,7 @@ proc start*(node: WakuNode, conf: WakuNodeConf) {.async.} =
|
||||
## Public API
|
||||
##
|
||||
|
||||
method init*(conf: WakuNodeConf): Future[WakuNode] {.async.} =
|
||||
method init*(T: type WakuNode, conf: WakuNodeConf): Future[T] {.async.} =
|
||||
## Creates and starts a Waku node.
|
||||
##
|
||||
let node = await createWakuNode(conf)
|
||||
@ -313,5 +313,5 @@ method query*(w: WakuNode, query: HistoryQuery): HistoryResponse =
|
||||
|
||||
when isMainModule:
|
||||
let conf = WakuNodeConf.load()
|
||||
discard init(conf)
|
||||
discard WakuNode.init(conf)
|
||||
runForever()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user