Add size to BlobStream, cancel to IngestStream
This commit is contained in:
parent
52c1879630
commit
3aa8a90265
|
@ -403,11 +403,13 @@ type
|
|||
BlobStream* = ref BlobStreamObj
|
||||
BlobStreamObj* = object of RootObj
|
||||
closeImpl*: proc (s: BlobStream) {.nimcall, gcsafe.}
|
||||
sizeImpl*: proc (s: BlobStream): BiggestInt {.nimcall, gcsafe.}
|
||||
setPosImpl*: proc (s: BlobStream; pos: BiggestInt) {.nimcall, gcsafe.}
|
||||
getPosImpl*: proc (s: BlobStream): BiggestInt {.nimcall, gcsafe.}
|
||||
readImpl*: proc (s: BlobStream; buffer: pointer; bufLen: int): int {.nimcall, gcsafe.}
|
||||
IngestStream* = ref IngestStreamObj
|
||||
IngestStreamObj* = object of RootObj
|
||||
cancelImpl*: proc (s: IngestStream) {.nimcall, gcsafe.}
|
||||
finishImpl*: proc (s: IngestStream): tuple[id: BlobId, size: BiggestInt] {.nimcall, gcsafe.}
|
||||
ingestImpl*: proc (s: IngestStream; buf: pointer; size: int) {.nimcall, gcsafe.}
|
||||
|
||||
|
@ -415,6 +417,10 @@ proc close*(s: BlobStream) =
|
|||
assert(not s.closeImpl.isNil)
|
||||
s.closeImpl(s)
|
||||
|
||||
proc size*(s: BlobStream): BiggestInt =
|
||||
assert(not s.sizeImpl.isNil)
|
||||
s.sizeImpl(s)
|
||||
|
||||
proc `pos=`*(s: BlobStream; pos: BiggestInt) =
|
||||
assert(not s.setPosImpl.isNil)
|
||||
s.setPosImpl(s, pos)
|
||||
|
@ -427,6 +433,11 @@ proc read*(s: BlobStream; buf: pointer; len: Natural): int =
|
|||
assert(not s.readImpl.isNil)
|
||||
result = s.readImpl(s, buf, len)
|
||||
|
||||
proc cancle*(s: IngestStream): tuple[id: BlobId, size: BiggestInt] =
|
||||
## Cancel and close ingest stream
|
||||
assert(not s.cancelImpl.isNil)
|
||||
s.cancelImpl(s)
|
||||
|
||||
proc finish*(s: IngestStream): tuple[id: BlobId, size: BiggestInt] =
|
||||
## Finish ingest stream
|
||||
assert(not s.finishImpl.isNil)
|
||||
|
|
Loading…
Reference in New Issue