mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-01-04 06:23:06 +00:00
Rename OnBlockStored
This commit is contained in:
parent
8e34f3f309
commit
d25afb98c4
@ -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:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user