mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-01-03 14:03:10 +00:00
Rename OnBlockStored
This commit is contained in:
parent
6bf2c48dea
commit
62bf2e4949
@ -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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user