feat: use error pragma to signal abstract methods

This commit is contained in:
Dmitriy Ryajov 2019-08-21 18:23:13 -06:00
parent a91c15c47a
commit 5f8e633c0f
3 changed files with 6 additions and 4 deletions

View File

@ -44,3 +44,5 @@ method dial*(t: TcpTransport, address: MultiAddress): Future[Connection] {.async
## dial a peer
let client: StreamTransport = await connect(address)
result = await t.connHandler(t.server, client)
method supports(t: Transport, address: MultiAddress): bool = true

View File

@ -33,7 +33,7 @@ method connHandler*(t: Transport,
t.connections.add(connHolder)
result = conn
method init*(t: Transport) {.base.} =
method init*(t: Transport) {.base, error: "not implemented".} =
## perform protocol initialization
discard
@ -53,12 +53,12 @@ method listen*(t: Transport, ma: MultiAddress, handler: ConnHandler) {.base, asy
t.ma = ma
t.handler = handler
method dial*(t: Transport, address: MultiAddress): Future[Connection] {.base, async.} =
method dial*(t: Transport, address: MultiAddress): Future[Connection] {.base, async, error: "not implemented".} =
## dial a peer
discard
method supports(t: Transport, address: MultiAddress): bool {.base.} =
method supports(t: Transport, address: MultiAddress): bool {.base, error: "not implemented".} =
## check if transport supportes the multiaddress
# TODO: this should implement generic logic that would use the multicodec
# declared in the multicodec field and set by each individual transport
result = true
discard

Binary file not shown.