Rename OnBlockStored

This commit is contained in:
Arnaud 2025-09-29 15:17:18 +02:00 committed by Eric
parent 8e34f3f309
commit d25afb98c4
No known key found for this signature in database

View File

@ -81,8 +81,7 @@ type
BatchProc* = proc(blocks: seq[bt.Block]): Future[?!void] {.
gcsafe, async: (raises: [CancelledError])
.}
OnBlockStoreProc =
proc(chunk: seq[byte]): Future[void] {.gcsafe, async: (raises: [CancelledError]).}
OnBlockStoredProc = proc(chunk: seq[byte]): void {.gcsafe, raises: [].}
func switch*(self: CodexNodeRef): Switch =
return self.switch
@ -405,7 +404,7 @@ proc store*(
filename: ?string = string.none,
mimetype: ?string = string.none,
blockSize = DefaultBlockSize,
onBlockStoreProc: OnBlockStoreProc = nil,
onBlockStored: OnBlockStoredProc = nil,
): Future[?!Cid] {.async.} =
## Save stream contents as dataset with given blockSize
## to nodes's BlockStore, and return Cid of its manifest
@ -436,8 +435,8 @@ proc store*(
error "Unable to store block", cid = blk.cid, err = err.msg
return failure(&"Unable to store block {blk.cid}")
if not onBlockStoreProc.isNil:
discard onBlockStoreProc(chunk)
if not onBlockStored.isNil:
onBlockStored(chunk)
except CancelledError as exc:
raise exc
except CatchableError as exc: