change method signatures

This commit is contained in:
munna0908 2025-03-27 21:33:39 +05:30
parent 237f2d2b8a
commit 39c400a87c
No known key found for this signature in database
GPG Key ID: 2FFCD637E937D3E6
3 changed files with 2 additions and 13 deletions

View File

@ -25,9 +25,6 @@ method delete*(self: Datastore, key: Key): Future[?!void] {.base, gcsafe, locks:
method delete*(self: Datastore, keys: seq[Key]): Future[?!void] {.base, gcsafe, locks: "unknown".} = method delete*(self: Datastore, keys: seq[Key]): Future[?!void] {.base, gcsafe, locks: "unknown".} =
raiseAssert("Not implemented!") raiseAssert("Not implemented!")
method batchDelete*(self: Datastore, keys: seq[Key]): Future[?!void] {.base, gcsafe, locks: "unknown".} =
raiseAssert("Not implemented!")
method get*(self: Datastore, key: Key): Future[?!seq[byte]] {.base, gcsafe, locks: "unknown".} = method get*(self: Datastore, key: Key): Future[?!seq[byte]] {.base, gcsafe, locks: "unknown".} =
raiseAssert("Not implemented!") raiseAssert("Not implemented!")

View File

@ -34,13 +34,8 @@ method delete*(self: LevelDbDatastore, key: Key): Future[?!void] {.async.} =
except LevelDbException as e: except LevelDbException as e:
return failure("LevelDbDatastore.delete exception: " & e.msg) return failure("LevelDbDatastore.delete exception: " & e.msg)
method delete*(self: LevelDbDatastore, keys: seq[Key]): Future[?!void] {.async.} =
for key in keys:
if err =? (await self.delete(key)).errorOption:
return failure(err.msg)
return success()
method batchDelete*(self: LevelDbDatastore, keys: seq[Key]): Future[?!void] {.async.} = method delete*(self: LevelDbDatastore, keys: seq[Key]): Future[?!void] {.async.} =
try: try:
let b = newBatch() let b = newBatch()
for key in keys: for key in keys:
@ -48,7 +43,7 @@ method batchDelete*(self: LevelDbDatastore, keys: seq[Key]): Future[?!void] {.as
self.db.write(b) self.db.write(b)
return success() return success()
except LevelDbException as e: except LevelDbException as e:
return failure("LevelDbDatastore.batchDelete exception: " & e.msg) return failure("LevelDbDatastore.delete batch exception: " & e.msg)
method get*(self: LevelDbDatastore, key: Key): Future[?!seq[byte]] {.async.} = method get*(self: LevelDbDatastore, key: Key): Future[?!seq[byte]] {.async.} =
try: try:

View File

@ -83,9 +83,6 @@ proc delete*(self: TypedDatastore, key: Key): Future[?!void] {.async.} =
proc delete*(self: TypedDatastore, keys: seq[Key]): Future[?!void] {.async.} = proc delete*(self: TypedDatastore, keys: seq[Key]): Future[?!void] {.async.} =
await self.ds.delete(keys) await self.ds.delete(keys)
proc batchDelete*(self: TypedDatastore, keys: seq[Key]): Future[?!void] {.async.} =
await self.ds.batchDelete(keys)
proc close*(self: TypedDatastore): Future[?!void] {.async.} = proc close*(self: TypedDatastore): Future[?!void] {.async.} =
await self.ds.close() await self.ds.close()