From 48157960f4836deb273101134ea31978dea6014f Mon Sep 17 00:00:00 2001 From: Jaremy Creechley Date: Mon, 23 Oct 2023 13:07:49 -0700 Subject: [PATCH] rename toSeq to toSequence to avoid conflicting with system.toSeq --- datastore/threads/databuffer.nim | 4 ++-- datastore/threads/threadproxy.nim | 4 ++-- tests/datastore/testdatabuffer.nim | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/datastore/threads/databuffer.nim b/datastore/threads/databuffer.nim index 5f80cbf..dc8b927 100644 --- a/datastore/threads/databuffer.nim +++ b/datastore/threads/databuffer.nim @@ -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 diff --git a/datastore/threads/threadproxy.nim b/datastore/threads/threadproxy.nim index a553894..3e2df5b 100644 --- a/datastore/threads/threadproxy.nim +++ b/datastore/threads/threadproxy.nim @@ -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 diff --git a/tests/datastore/testdatabuffer.nim b/tests/datastore/testdatabuffer.nim index eb97931..ee8bc11 100644 --- a/tests/datastore/testdatabuffer.nim +++ b/tests/datastore/testdatabuffer.nim @@ -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})