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