Add gcsafe pragma
This commit is contained in:
parent
34f5e0071c
commit
7c9b607e38
|
@ -48,7 +48,7 @@ when isMainModule:
|
||||||
let config = CodexConf.load(
|
let config = CodexConf.load(
|
||||||
version = codexFullVersion,
|
version = codexFullVersion,
|
||||||
envVarsPrefix = "codex",
|
envVarsPrefix = "codex",
|
||||||
secondarySources = proc (config: CodexConf, sources: auto) =
|
secondarySources = proc (config: CodexConf, sources: auto) {.gcsafe, raises: [ConfigurationError].} =
|
||||||
if configFile =? config.configFile:
|
if configFile =? config.configFile:
|
||||||
sources.addConfigFile(Toml, configFile)
|
sources.addConfigFile(Toml, configFile)
|
||||||
)
|
)
|
||||||
|
|
|
@ -8,7 +8,7 @@ type
|
||||||
SecondsSince1970* = int64
|
SecondsSince1970* = int64
|
||||||
Timeout* = object of CatchableError
|
Timeout* = object of CatchableError
|
||||||
|
|
||||||
method now*(clock: Clock): SecondsSince1970 {.base, upraises: [].} =
|
method now*(clock: Clock): SecondsSince1970 {.base, gcsafe, upraises: [].} =
|
||||||
raiseAssert "not implemented"
|
raiseAssert "not implemented"
|
||||||
|
|
||||||
method waitUntil*(clock: Clock, time: SecondsSince1970) {.base, async.} =
|
method waitUntil*(clock: Clock, time: SecondsSince1970) {.base, async.} =
|
||||||
|
|
|
@ -124,7 +124,7 @@ method provide*(d: Discovery, host: ca.Address) {.async, base.} =
|
||||||
|
|
||||||
method removeProvider*(
|
method removeProvider*(
|
||||||
d: Discovery,
|
d: Discovery,
|
||||||
peerId: PeerId): Future[void] {.base.} =
|
peerId: PeerId): Future[void] {.base, gcsafe.} =
|
||||||
## Remove provider from providers table
|
## Remove provider from providers table
|
||||||
##
|
##
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ type
|
||||||
EncoderBackend* = ref object of ErasureBackend
|
EncoderBackend* = ref object of ErasureBackend
|
||||||
DecoderBackend* = ref object of ErasureBackend
|
DecoderBackend* = ref object of ErasureBackend
|
||||||
|
|
||||||
method release*(self: ErasureBackend) {.base.} =
|
method release*(self: ErasureBackend) {.base, gcsafe.} =
|
||||||
## release the backend
|
## release the backend
|
||||||
##
|
##
|
||||||
raiseAssert("not implemented!")
|
raiseAssert("not implemented!")
|
||||||
|
@ -31,7 +31,7 @@ method encode*(
|
||||||
self: EncoderBackend,
|
self: EncoderBackend,
|
||||||
buffers,
|
buffers,
|
||||||
parity: var openArray[seq[byte]]
|
parity: var openArray[seq[byte]]
|
||||||
): Result[void, cstring] {.base.} =
|
): Result[void, cstring] {.base, gcsafe.} =
|
||||||
## encode buffers using a backend
|
## encode buffers using a backend
|
||||||
##
|
##
|
||||||
raiseAssert("not implemented!")
|
raiseAssert("not implemented!")
|
||||||
|
@ -41,7 +41,7 @@ method decode*(
|
||||||
buffers,
|
buffers,
|
||||||
parity,
|
parity,
|
||||||
recovered: var openArray[seq[byte]]
|
recovered: var openArray[seq[byte]]
|
||||||
): Result[void, cstring] {.base.} =
|
): Result[void, cstring] {.base, gcsafe.} =
|
||||||
## decode buffers using a backend
|
## decode buffers using a backend
|
||||||
##
|
##
|
||||||
raiseAssert("not implemented!")
|
raiseAssert("not implemented!")
|
||||||
|
|
|
@ -33,13 +33,13 @@ type
|
||||||
BlockStore* = ref object of RootObj
|
BlockStore* = ref object of RootObj
|
||||||
onBlockStored*: ?CidCallback
|
onBlockStored*: ?CidCallback
|
||||||
|
|
||||||
method getBlock*(self: BlockStore, cid: Cid): Future[?!Block] {.base.} =
|
method getBlock*(self: BlockStore, cid: Cid): Future[?!Block] {.base, gcsafe.} =
|
||||||
## Get a block from the blockstore
|
## Get a block from the blockstore
|
||||||
##
|
##
|
||||||
|
|
||||||
raiseAssert("getBlock by cid not implemented!")
|
raiseAssert("getBlock by cid not implemented!")
|
||||||
|
|
||||||
method getBlock*(self: BlockStore, treeCid: Cid, index: Natural): Future[?!Block] {.base.} =
|
method getBlock*(self: BlockStore, treeCid: Cid, index: Natural): Future[?!Block] {.base, gcsafe.} =
|
||||||
## Get a block from the blockstore
|
## Get a block from the blockstore
|
||||||
##
|
##
|
||||||
|
|
||||||
|
@ -50,13 +50,13 @@ method getCid*(self: BlockStore, treeCid: Cid, index: Natural): Future[?!Cid] {.
|
||||||
##
|
##
|
||||||
raiseAssert("getCid by treecid not implemented!")
|
raiseAssert("getCid by treecid not implemented!")
|
||||||
|
|
||||||
method getBlock*(self: BlockStore, address: BlockAddress): Future[?!Block] {.base.} =
|
method getBlock*(self: BlockStore, address: BlockAddress): Future[?!Block] {.base, gcsafe.} =
|
||||||
## Get a block from the blockstore
|
## Get a block from the blockstore
|
||||||
##
|
##
|
||||||
|
|
||||||
raiseAssert("getBlock by addr not implemented!")
|
raiseAssert("getBlock by addr not implemented!")
|
||||||
|
|
||||||
method getBlockAndProof*(self: BlockStore, treeCid: Cid, index: Natural): Future[?!(Block, CodexProof)] {.base.} =
|
method getBlockAndProof*(self: BlockStore, treeCid: Cid, index: Natural): Future[?!(Block, CodexProof)] {.base, gcsafe.} =
|
||||||
## Get a block and associated inclusion proof by Cid of a merkle tree and an index of a leaf in a tree
|
## Get a block and associated inclusion proof by Cid of a merkle tree and an index of a leaf in a tree
|
||||||
##
|
##
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ method getBlockAndProof*(self: BlockStore, treeCid: Cid, index: Natural): Future
|
||||||
method putBlock*(
|
method putBlock*(
|
||||||
self: BlockStore,
|
self: BlockStore,
|
||||||
blk: Block,
|
blk: Block,
|
||||||
ttl = Duration.none): Future[?!void] {.base.} =
|
ttl = Duration.none): Future[?!void] {.base, gcsafe.} =
|
||||||
## Put a block to the blockstore
|
## Put a block to the blockstore
|
||||||
##
|
##
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ method putCidAndProof*(
|
||||||
treeCid: Cid,
|
treeCid: Cid,
|
||||||
index: Natural,
|
index: Natural,
|
||||||
blockCid: Cid,
|
blockCid: Cid,
|
||||||
proof: CodexProof): Future[?!void] {.base.} =
|
proof: CodexProof): Future[?!void] {.base, gcsafe.} =
|
||||||
## Put a block proof to the blockstore
|
## Put a block proof to the blockstore
|
||||||
##
|
##
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ method putCidAndProof*(
|
||||||
method getCidAndProof*(
|
method getCidAndProof*(
|
||||||
self: BlockStore,
|
self: BlockStore,
|
||||||
treeCid: Cid,
|
treeCid: Cid,
|
||||||
index: Natural): Future[?!(Cid, CodexProof)] {.base.} =
|
index: Natural): Future[?!(Cid, CodexProof)] {.base, gcsafe.} =
|
||||||
## Get a block proof from the blockstore
|
## Get a block proof from the blockstore
|
||||||
##
|
##
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ method getCidAndProof*(
|
||||||
method ensureExpiry*(
|
method ensureExpiry*(
|
||||||
self: BlockStore,
|
self: BlockStore,
|
||||||
cid: Cid,
|
cid: Cid,
|
||||||
expiry: SecondsSince1970): Future[?!void] {.base.} =
|
expiry: SecondsSince1970): Future[?!void] {.base, gcsafe.} =
|
||||||
## Ensure that block's assosicated expiry is at least given timestamp
|
## Ensure that block's assosicated expiry is at least given timestamp
|
||||||
## If the current expiry is lower then it is updated to the given one, otherwise it is left intact
|
## If the current expiry is lower then it is updated to the given one, otherwise it is left intact
|
||||||
##
|
##
|
||||||
|
@ -105,7 +105,7 @@ method ensureExpiry*(
|
||||||
self: BlockStore,
|
self: BlockStore,
|
||||||
treeCid: Cid,
|
treeCid: Cid,
|
||||||
index: Natural,
|
index: Natural,
|
||||||
expiry: SecondsSince1970): Future[?!void] {.base.} =
|
expiry: SecondsSince1970): Future[?!void] {.base, gcsafe.} =
|
||||||
## Ensure that block's associated expiry is at least given timestamp
|
## Ensure that block's associated expiry is at least given timestamp
|
||||||
## If the current expiry is lower then it is updated to the given one, otherwise it is left intact
|
## If the current expiry is lower then it is updated to the given one, otherwise it is left intact
|
||||||
##
|
##
|
||||||
|
@ -124,13 +124,13 @@ method delBlock*(self: BlockStore, treeCid: Cid, index: Natural): Future[?!void]
|
||||||
|
|
||||||
raiseAssert("delBlock not implemented!")
|
raiseAssert("delBlock not implemented!")
|
||||||
|
|
||||||
method hasBlock*(self: BlockStore, cid: Cid): Future[?!bool] {.base.} =
|
method hasBlock*(self: BlockStore, cid: Cid): Future[?!bool] {.base, gcsafe.} =
|
||||||
## Check if the block exists in the blockstore
|
## Check if the block exists in the blockstore
|
||||||
##
|
##
|
||||||
|
|
||||||
raiseAssert("hasBlock not implemented!")
|
raiseAssert("hasBlock not implemented!")
|
||||||
|
|
||||||
method hasBlock*(self: BlockStore, tree: Cid, index: Natural): Future[?!bool] {.base.} =
|
method hasBlock*(self: BlockStore, tree: Cid, index: Natural): Future[?!bool] {.base, gcsafe.} =
|
||||||
## Check if the block exists in the blockstore
|
## Check if the block exists in the blockstore
|
||||||
##
|
##
|
||||||
|
|
||||||
|
@ -138,13 +138,13 @@ method hasBlock*(self: BlockStore, tree: Cid, index: Natural): Future[?!bool] {.
|
||||||
|
|
||||||
method listBlocks*(
|
method listBlocks*(
|
||||||
self: BlockStore,
|
self: BlockStore,
|
||||||
blockType = BlockType.Manifest): Future[?!AsyncIter[?Cid]] {.base.} =
|
blockType = BlockType.Manifest): Future[?!AsyncIter[?Cid]] {.base, gcsafe.} =
|
||||||
## Get the list of blocks in the BlockStore. This is an intensive operation
|
## Get the list of blocks in the BlockStore. This is an intensive operation
|
||||||
##
|
##
|
||||||
|
|
||||||
raiseAssert("listBlocks not implemented!")
|
raiseAssert("listBlocks not implemented!")
|
||||||
|
|
||||||
method close*(self: BlockStore): Future[void] {.base.} =
|
method close*(self: BlockStore): Future[void] {.base, gcsafe.} =
|
||||||
## Close the blockstore, cleaning up resources managed by it.
|
## Close the blockstore, cleaning up resources managed by it.
|
||||||
## For some implementations this may be a no-op
|
## For some implementations this may be a no-op
|
||||||
##
|
##
|
||||||
|
|
|
@ -40,7 +40,7 @@ proc timerLoop(timer: Timer) {.async.} =
|
||||||
except CatchableError as exc:
|
except CatchableError as exc:
|
||||||
error "Timer caught unhandled exception: ", name=timer.name, msg=exc.msg
|
error "Timer caught unhandled exception: ", name=timer.name, msg=exc.msg
|
||||||
|
|
||||||
method start*(timer: Timer, callback: TimerCallback, interval: Duration) {.base.} =
|
method start*(timer: Timer, callback: TimerCallback, interval: Duration) {.gcsafe, base.} =
|
||||||
if timer.loopFuture != nil:
|
if timer.loopFuture != nil:
|
||||||
return
|
return
|
||||||
trace "Timer starting: ", name=timer.name
|
trace "Timer starting: ", name=timer.name
|
||||||
|
|
Loading…
Reference in New Issue