Rename OnBlockStored

This commit is contained in:
Arnaud 2025-09-29 15:17:18 +02:00
parent 6bf2c48dea
commit 62bf2e4949
No known key found for this signature in database
GPG Key ID: B8FBC178F10CA7AE

View File

@ -84,8 +84,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
@ -436,7 +435,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
@ -467,8 +466,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: