mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-02 13:43:11 +00:00
rename toSeq to toSequence to avoid conflicting with system.toSeq
This commit is contained in:
parent
5dcd8ce628
commit
48157960f4
@ -87,7 +87,7 @@ proc setData*[T: byte | char](db: DataBuffer, data: openArray[T]) =
|
||||
copyMem(db[].buf, baseAddr data, data.len())
|
||||
db[].size = data.len()
|
||||
|
||||
proc toSeq*(self: DataBuffer): seq[byte] =
|
||||
proc toSequence*(self: DataBuffer): seq[byte] =
|
||||
## convert buffer to a seq type using copy and either a byte or char
|
||||
##
|
||||
|
||||
@ -100,7 +100,7 @@ proc `@`*(self: DataBuffer): seq[byte] =
|
||||
## either a byte or char
|
||||
##
|
||||
|
||||
self.toSeq()
|
||||
self.toSequence()
|
||||
|
||||
proc toString*(data: DataBuffer): string =
|
||||
## convert buffer to string type using copy
|
||||
|
||||
@ -242,7 +242,7 @@ proc get*[BT](self: ThreadProxy[BT],
|
||||
let key = KeyId.new key.id()
|
||||
self.tp.spawn getTask(ctx, ds, key)
|
||||
|
||||
return ctx[].res.toRes(v => v.toSeq())
|
||||
return ctx[].res.toRes(v => v.toSequence())
|
||||
|
||||
proc close*[BT](self: ThreadProxy[BT]): Future[?!void] {.async.} =
|
||||
await self.semaphore.closeAll()
|
||||
@ -352,7 +352,7 @@ proc query*[BT](self: ThreadProxy[BT],
|
||||
else:
|
||||
let qres = ctx[].res.get()
|
||||
let key = qres.key.map(proc (k: KeyId): Key = k.toKey())
|
||||
let data = qres.data.toSeq()
|
||||
let data = qres.data.toSequence()
|
||||
return (?!QueryResponse).ok((key: key, data: data))
|
||||
except CancelledError as exc:
|
||||
trace "Cancelling thread future!", exc = exc.msg
|
||||
|
||||
@ -45,7 +45,7 @@ proc thread2(val: int) {.thread.} =
|
||||
echo "thread2: receiving "
|
||||
let msg: DataBuffer = shareVal
|
||||
echo "thread2: received: ", msg
|
||||
check string.fromBytes(msg.toSeq()) == "hello world"
|
||||
check string.fromBytes(msg.toSequence()) == "hello world"
|
||||
# os.sleep(100)
|
||||
|
||||
proc runBasicTest() =
|
||||
@ -104,10 +104,10 @@ suite "Share buffer test":
|
||||
check Key.init($a).tryGet == k1
|
||||
|
||||
test "seq conversion":
|
||||
check string.fromBytes(a.toSeq()) == "/a/b"
|
||||
check string.fromBytes(a.toSequence()) == "/a/b"
|
||||
|
||||
test "seq conversion":
|
||||
check a.toSeq() == "/a/b".toBytes
|
||||
check a.toSequence() == "/a/b".toBytes
|
||||
|
||||
test "basic null terminate test":
|
||||
let cstr = DataBuffer.new("test", {dbNullTerminate})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user