mirror of
https://github.com/status-im/nim-dagger.git
synced 2025-02-09 21:33:42 +00:00
* use PeerInfo in event handlers * use CidV1 and raw multicodec as default * add block stream abstraction * raises defect * adding dataset abstraction * move blockstream into own dir * reorg files and fix tests * rename dataset to blockset * wip * wip * adding basic test for treehash algo * run blockset tests along with with the rest * remove obsolete contents * fix chunker tests * rename bitswap and move to stores * rename bitwsap to blockexc and move to stores * moare project structure reorg
30 lines
714 B
Nim
30 lines
714 B
Nim
## Nim-Dagger
|
|
## Copyright (c) 2021 Status Research & Development GmbH
|
|
## Licensed under either of
|
|
## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
|
## * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
|
## at your option.
|
|
## This file may not be copied, modified, or distributed except according to
|
|
## those terms.
|
|
|
|
{.push raises: [Defect].}
|
|
|
|
import pkg/questionable
|
|
import pkg/questionable/results
|
|
import ../blocktype
|
|
|
|
export blocktype
|
|
|
|
type
|
|
BlockStreamRef* = ref object of RootObj
|
|
|
|
method nextBlock*(b: BlockStreamRef): ?!Block {.base.} =
|
|
doAssert(false, "Not implemented!")
|
|
|
|
iterator items*(b: BlockStreamRef): Block =
|
|
while true:
|
|
without blk =? b.nextBlock():
|
|
break
|
|
|
|
yield blk
|