Add TODOs to indicate wanted architecture

As discussed in team:
- Retrieving of blocks that are mentioned in the
  manifest should be moved into a BlockStore.
- Sales should be given an instance of BlockStore,
  and an instance of StorageProofs, instead of the
  onStore, onClear, and onProve callbacks
This commit is contained in:
Mark Spanbroek 2022-07-18 10:57:24 +02:00 committed by markspanbroek
parent 13bbf2b052
commit afdb5be2d4
1 changed files with 2 additions and 0 deletions

View File

@ -60,6 +60,7 @@ proc connect*(
addrs: seq[MultiAddress]): Future[void] =
node.switch.connect(peerId, addrs)
# TODO: move code that retrieves blocks in manifest into blockstore
proc retrieve*(
node: CodexNodeRef,
cid: Cid): Future[?!LPStream] {.async.} =
@ -312,6 +313,7 @@ proc start*(node: CodexNodeRef) {.async.} =
await node.discovery.start()
if contracts =? node.contracts:
# TODO: remove Sales callbacks, pass BlockStore and StorageProofs instead
contracts.sales.onStore = proc(cid: string, _: Availability) {.async.} =
# store data in local storage
(await node.store(Cid.init(cid).tryGet())).tryGet()