mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-07 16:33:08 +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.
|
5. **Query** - for historical messages.
|
||||||
|
|
||||||
```Nim
|
```Nim
|
||||||
proc init*(conf: WakuNodeConf): Future[WakuNode]
|
proc init*(T: type WakuNode, conf: WakuNodeConf): Future[T]
|
||||||
## Creates and starts a Waku node.
|
## Creates and starts a Waku node.
|
||||||
##
|
##
|
||||||
## Status: Implemented.
|
## Status: Implemented.
|
||||||
|
|||||||
@ -18,7 +18,7 @@ let conf = WakuNodeConf.load()
|
|||||||
# Node operations happens asynchronously
|
# Node operations happens asynchronously
|
||||||
proc runBackground(conf: WakuNodeConf) {.async.} =
|
proc runBackground(conf: WakuNodeConf) {.async.} =
|
||||||
# Create and start the node
|
# Create and start the node
|
||||||
let node = await init(conf)
|
let node = await WakuNode.init(conf)
|
||||||
|
|
||||||
# Subscribe to a topic
|
# Subscribe to a topic
|
||||||
let topic = "foobar"
|
let topic = "foobar"
|
||||||
|
|||||||
@ -223,7 +223,7 @@ proc start*(node: WakuNode, conf: WakuNodeConf) {.async.} =
|
|||||||
## Public API
|
## 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.
|
## Creates and starts a Waku node.
|
||||||
##
|
##
|
||||||
let node = await createWakuNode(conf)
|
let node = await createWakuNode(conf)
|
||||||
@ -313,5 +313,5 @@ method query*(w: WakuNode, query: HistoryQuery): HistoryResponse =
|
|||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
let conf = WakuNodeConf.load()
|
let conf = WakuNodeConf.load()
|
||||||
discard init(conf)
|
discard WakuNode.init(conf)
|
||||||
runForever()
|
runForever()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user