Add gcsafe pragma

Signed-off-by: Arnaud <arnaud@status.im>
This commit is contained in:
Arnaud 2024-12-06 17:29:39 +01:00
parent 2461b514c5
commit 6c425d7a35
No known key found for this signature in database
GPG Key ID: 69D6CE281FCAE663
2 changed files with 9 additions and 9 deletions

View File

@ -16,22 +16,22 @@ type
Modify* = Function[?seq[byte], Future[?seq[byte]]]
ModifyGet* = Function[?seq[byte], Future[(?seq[byte], seq[byte])]]
method has*(self: Datastore, key: Key): Future[?!bool] {.base, locks: "unknown".} =
method has*(self: Datastore, key: Key): Future[?!bool] {.base, gcsafe, locks: "unknown".} =
raiseAssert("Not implemented!")
method delete*(self: Datastore, key: Key): Future[?!void] {.base, locks: "unknown".} =
method delete*(self: Datastore, key: Key): Future[?!void] {.base, gcsafe, locks: "unknown".} =
raiseAssert("Not implemented!")
method delete*(self: Datastore, keys: seq[Key]): Future[?!void] {.base, locks: "unknown".} =
method delete*(self: Datastore, keys: seq[Key]): Future[?!void] {.base, gcsafe, locks: "unknown".} =
raiseAssert("Not implemented!")
method get*(self: Datastore, key: Key): Future[?!seq[byte]] {.base, locks: "unknown".} =
method get*(self: Datastore, key: Key): Future[?!seq[byte]] {.base, gcsafe, locks: "unknown".} =
raiseAssert("Not implemented!")
method put*(self: Datastore, key: Key, data: seq[byte]): Future[?!void] {.base, locks: "unknown".} =
method put*(self: Datastore, key: Key, data: seq[byte]): Future[?!void] {.base, gcsafe, locks: "unknown".} =
raiseAssert("Not implemented!")
method put*(self: Datastore, batch: seq[BatchEntry]): Future[?!void] {.base, locks: "unknown".} =
method put*(self: Datastore, batch: seq[BatchEntry]): Future[?!void] {.base, gcsafe, locks: "unknown".} =
raiseAssert("Not implemented!")
method close*(self: Datastore): Future[?!void] {.base, async, locks: "unknown".} =
@ -46,7 +46,7 @@ method query*(
proc contains*(self: Datastore, key: Key): Future[bool] {.async.} =
return (await self.has(key)) |? false
method modify*(self: Datastore, key: Key, fn: Modify): Future[?!void] {.base, locks: "unknown".} =
method modify*(self: Datastore, key: Key, fn: Modify): Future[?!void] {.base, gcsafe, locks: "unknown".} =
## Concurrently safe way of modifying the value associated with the `key`.
##
## Same as `modifyGet`, but this takes `fn` that doesn't produce any auxillary value.
@ -54,7 +54,7 @@ method modify*(self: Datastore, key: Key, fn: Modify): Future[?!void] {.base, lo
raiseAssert("Not implemented!")
method modifyGet*(self: Datastore, key: Key, fn: ModifyGet): Future[?!seq[byte]] {.base, locks: "unknown".} =
method modifyGet*(self: Datastore, key: Key, fn: ModifyGet): Future[?!seq[byte]] {.base, gcsafe, locks: "unknown".} =
## Concurrently safe way of updating value associated with the `key`. Returns auxillary value on
## successful update.
##

View File

@ -20,7 +20,7 @@ type
MountedDatastore* = ref object of Datastore
stores*: Table[Key, MountedStore]
method mount*(self: MountedDatastore, key: Key, store: Datastore): ?!void {.base.} =
method mount*(self: MountedDatastore, key: Key, store: Datastore): ?!void {.base, gcsafe.} =
## Mount a store on a namespace - namespaces are only `/`
##