nim-dagger/dagger/stores/blockstore.nim
Dmitriy Ryajov 47a0d4ef7a
Move empty digest (#38)
* improve empty digest initialization

* cleanup warnings
2022-01-10 20:25:27 -06:00

59 lines
1.2 KiB
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/chronos
import pkg/libp2p
import pkg/questionable/results
import ../blocktype
export blocktype, libp2p
type
BlockStore* = ref object of RootObj
{.push locks:"unknown".}
method getBlock*(
b: BlockStore,
cid: Cid): Future[?!Block] {.base.} =
## Get a block from the stores
##
doAssert(false, "Not implemented!")
method putBlock*(
s: BlockStore,
blk: Block): Future[bool] {.base.} =
## Put a block to the blockstore
##
doAssert(false, "Not implemented!")
method delBlock*(
s: BlockStore,
cid: Cid): Future[bool] {.base.} =
## Delete a block/s from the block store
##
doAssert(false, "Not implemented!")
{.pop.}
method hasBlock*(s: BlockStore, cid: Cid): bool {.base.} =
## Check if the block exists in the blockstore
##
return false
proc contains*(s: BlockStore, blk: Cid): bool =
s.hasBlock(blk)