diff --git a/.gitignore b/.gitignore index 1a87a99..5494ef9 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ coverage datastore.nims nimcache TODO +nimble.develop +nimble.paths diff --git a/config.nims b/config.nims index 052a576..ed3a531 100644 --- a/config.nims +++ b/config.nims @@ -10,3 +10,7 @@ when (NimMajor, NimMinor) == (1, 2): when (NimMajor, NimMinor) > (1, 2): switch("hint", "XCannotRaiseY:off") +# begin Nimble config (version 2) +when withDir(thisDir(), system.fileExists("nimble.paths")): + include "nimble.paths" +# end Nimble config diff --git a/datastore.nimble b/datastore.nimble index 4183fed..b0a61ff 100644 --- a/datastore.nimble +++ b/datastore.nimble @@ -13,8 +13,7 @@ requires "nim >= 1.2.0", "sqlite3_abi", "leveldbstatic >= 0.1.2", "stew", - "unittest2", - "upraises >= 0.1.0 & < 0.2.0" + "unittest2" task coverage, "generates code coverage report": var (output, exitCode) = gorgeEx("which lcov") diff --git a/datastore/datastore.nim b/datastore/datastore.nim index f664ec0..47f339b 100644 --- a/datastore/datastore.nim +++ b/datastore/datastore.nim @@ -1,7 +1,8 @@ +{.push raises: [].} + import pkg/chronos import pkg/questionable import pkg/questionable/results -import pkg/upraises import ./key import ./query @@ -9,8 +10,6 @@ import ./types export key, query, types -push: {.upraises: [].} - type BatchEntry* = tuple[key: Key, data: seq[byte]] Function*[T, U] = proc(value: T): U {.raises: [CatchableError], gcsafe, closure.} @@ -76,4 +75,4 @@ method modifyGet*(self: Datastore, key: Key, fn: ModifyGet): Future[?!seq[byte]] ## only the last auxillary value is returned. ## - raiseAssert("Not implemented!") \ No newline at end of file + raiseAssert("Not implemented!") diff --git a/datastore/defaultimpl.nim b/datastore/defaultimpl.nim index 1562263..be7178a 100644 --- a/datastore/defaultimpl.nim +++ b/datastore/defaultimpl.nim @@ -1,3 +1,5 @@ +{.push raises: [].} + import pkg/chronos import pkg/questionable import pkg/questionable/results diff --git a/datastore/fsds.nim b/datastore/fsds.nim index 2a58a99..7599fce 100644 --- a/datastore/fsds.nim +++ b/datastore/fsds.nim @@ -1,3 +1,5 @@ +{.push raises: [].} + import std/os import std/options import std/tables @@ -6,16 +8,12 @@ import std/strutils import pkg/chronos import pkg/questionable import pkg/questionable/results -from pkg/stew/results as stewResults import get, isErr -import pkg/upraises import ./defaultimpl import ./datastore export datastore -push: {.upraises: [].} - type FSDatastore* = ref object of Datastore root*: string diff --git a/datastore/key/key.nim b/datastore/key/key.nim index 83544d4..c66e0be 100644 --- a/datastore/key/key.nim +++ b/datastore/key/key.nim @@ -1,3 +1,5 @@ +{.push raises: [].} + import std/algorithm import std/hashes import std/oids @@ -7,15 +9,11 @@ import std/strformat import pkg/questionable import pkg/questionable/results -from pkg/stew/results as stewResults import get, isErr -import pkg/upraises import ./namespace export hashes, namespace -push: {.upraises: [].} - type Key* = object namespaces*: seq[Namespace] diff --git a/datastore/key/namespace.nim b/datastore/key/namespace.nim index 6613c09..bfad62b 100644 --- a/datastore/key/namespace.nim +++ b/datastore/key/namespace.nim @@ -1,11 +1,9 @@ +{.push raises: [].} import std/hashes import pkg/questionable import pkg/questionable/results -import pkg/upraises - -push: {.upraises: [].} const Delimiter* = ":" diff --git a/datastore/leveldb/leveldbds.nim b/datastore/leveldb/leveldbds.nim index daad558..29089ec 100644 --- a/datastore/leveldb/leveldbds.nim +++ b/datastore/leveldb/leveldbds.nim @@ -1,3 +1,5 @@ +{.push raises: [].} + import std/options import std/tables import std/os @@ -8,14 +10,10 @@ import pkg/chronos import pkg/questionable import pkg/questionable/results import pkg/stew/byteutils -from pkg/stew/results as stewResults import isErr -import pkg/upraises import ../datastore import ../defaultimpl -push: {.upraises: [].} - type LevelDbDatastore* = ref object of Datastore db: LevelDb diff --git a/datastore/mountedds.nim b/datastore/mountedds.nim index 9102e49..d1c51cd 100644 --- a/datastore/mountedds.nim +++ b/datastore/mountedds.nim @@ -1,9 +1,10 @@ +{.push raises: [].} + import std/tables import pkg/chronos import pkg/questionable import pkg/questionable/results -import pkg/upraises import ./key import ./query @@ -11,8 +12,6 @@ import ./datastore export key, query -push: {.upraises: [].} - type MountedStore* = object store*: Datastore @@ -28,7 +27,7 @@ method mount*(self: MountedDatastore, key: Key, store: Datastore): ?!void {.base if key in self.stores: return failure("Key already has store mounted!") - self.stores.add(key, MountedStore(store: store, key: key)) + self.stores[key] = MountedStore(store: store, key: key) return success() diff --git a/datastore/query.nim b/datastore/query.nim index 1c51a6e..94f1a83 100644 --- a/datastore/query.nim +++ b/datastore/query.nim @@ -1,4 +1,6 @@ -import pkg/upraises + +{.push raises: [].} + import pkg/chronos import pkg/questionable import pkg/questionable/results @@ -21,8 +23,8 @@ type QueryResponse* = tuple[key: ?Key, data: seq[byte]] QueryEndedError* = object of DatastoreError - GetNext* = proc(): Future[?!QueryResponse] {.upraises: [], gcsafe, closure.} - IterDispose* = proc(): Future[?!void] {.upraises: [], gcsafe.} + GetNext* = proc(): Future[?!QueryResponse] {.raises: [], gcsafe, closure.} + IterDispose* = proc(): Future[?!void] {.raises: [], gcsafe.} QueryIter* = ref object finished*: bool next*: GetNext @@ -32,7 +34,7 @@ iterator items*(q: QueryIter): Future[?!QueryResponse] = while not q.finished: yield q.next() -proc defaultDispose(): Future[?!void] {.upraises: [], gcsafe, async.} = +proc defaultDispose(): Future[?!void] {.gcsafe, async.} = return success() proc new*(T: type QueryIter, dispose = defaultDispose): T = diff --git a/datastore/sql/sqliteds.nim b/datastore/sql/sqliteds.nim index b966435..8f16f07 100644 --- a/datastore/sql/sqliteds.nim +++ b/datastore/sql/sqliteds.nim @@ -1,3 +1,5 @@ +{.push raises: [].} + import std/times import std/options @@ -5,8 +7,6 @@ import pkg/chronos import pkg/questionable import pkg/questionable/results import pkg/sqlite3_abi -from pkg/stew/results as stewResults import isErr -import pkg/upraises import ../datastore import ./sqlitedsdb @@ -14,8 +14,6 @@ import ./sqliteutils export datastore, sqlitedsdb -push: {.upraises: [].} - type SQLiteDatastore* = ref object of Datastore readOnly: bool diff --git a/datastore/sql/sqlitedsdb.nim b/datastore/sql/sqlitedsdb.nim index 3e34319..6e1d96f 100644 --- a/datastore/sql/sqlitedsdb.nim +++ b/datastore/sql/sqlitedsdb.nim @@ -1,17 +1,18 @@ +{.push raises: [].} + import std/os import std/strformat import pkg/questionable import pkg/questionable/results -import pkg/upraises import ./sqliteutils type - BoundIdCol* = proc (): string {.closure, gcsafe, upraises: [].} - BoundVersionCol* = proc (): int64 {.closure, gcsafe, upraises: [].} - BoundDataCol* = proc (): seq[byte] {.closure, gcsafe, upraises: [].} - BoundTimestampCol* = proc (): int64 {.closure, gcsafe, upraises: [].} + BoundIdCol* = proc (): string {.closure, gcsafe, raises: [].} + BoundVersionCol* = proc (): int64 {.closure, gcsafe, raises: [].} + BoundDataCol* = proc (): seq[byte] {.closure, gcsafe, raises: [].} + BoundTimestampCol* = proc (): int64 {.closure, gcsafe, raises: [].} # feels odd to use `void` for prepared statements corresponding to SELECT # queries but it fits with the rest of the SQLite wrapper adapted from diff --git a/datastore/sql/sqliteutils.nim b/datastore/sql/sqliteutils.nim index 6cdbabb..c86f707 100644 --- a/datastore/sql/sqliteutils.nim +++ b/datastore/sql/sqliteutils.nim @@ -1,7 +1,8 @@ +{.push raises: [].} + import pkg/questionable import pkg/questionable/results import pkg/sqlite3_abi -import pkg/upraises export sqlite3_abi @@ -14,8 +15,6 @@ export sqlite3_abi # e.g. `nimble test --forceBuild:on` {.passc: "-DSQLITE_ENABLE_COLUMN_METADATA".} -push: {.upraises: [].} - type AutoDisposed*[T: ptr|ref] = object val*: T @@ -34,7 +33,7 @@ type # see https://github.com/arnetheduck/nim-sqlite3-abi/issues/4 sqlite3_destructor_type_gcsafe = - proc (a1: pointer) {.cdecl, gcsafe, upraises: [].} + proc (a1: pointer) {.cdecl, gcsafe, raises: [].} const SQLITE_TRANSIENT_GCSAFE* = cast[sqlite3_destructor_type_gcsafe](-1) diff --git a/datastore/tieredds.nim b/datastore/tieredds.nim index 0bc0044..36cbc72 100644 --- a/datastore/tieredds.nim +++ b/datastore/tieredds.nim @@ -1,17 +1,15 @@ +{.push raises: [].} + import std/sequtils import pkg/chronos import pkg/questionable import pkg/questionable/results -from pkg/stew/results as stewResults import get, isErr -import pkg/upraises import ./datastore export datastore -push: {.upraises: [].} - type TieredDatastore* = ref object of Datastore stores: seq[Datastore] diff --git a/datastore/typedds.nim b/datastore/typedds.nim index dca1b9a..e194a32 100644 --- a/datastore/typedds.nim +++ b/datastore/typedds.nim @@ -1,3 +1,5 @@ +{.push raises: [].} + import std/options import std/macros diff --git a/tests/datastore/dscommontests.nim b/tests/datastore/dscommontests.nim index 1e0353c..8d7a218 100644 --- a/tests/datastore/dscommontests.nim +++ b/tests/datastore/dscommontests.nim @@ -1,8 +1,5 @@ -import std/options - import pkg/asynctest import pkg/chronos -import pkg/stew/results import pkg/datastore diff --git a/tests/datastore/leveldb/testleveldbds.nim b/tests/datastore/leveldb/testleveldbds.nim index 132b285..b059880 100644 --- a/tests/datastore/leveldb/testleveldbds.nim +++ b/tests/datastore/leveldb/testleveldbds.nim @@ -5,7 +5,6 @@ from std/algorithm import sort, reversed import pkg/asynctest import pkg/chronos -import pkg/stew/results import pkg/stew/byteutils import pkg/datastore diff --git a/tests/datastore/modifycommontests.nim b/tests/datastore/modifycommontests.nim index d512edc..ea010cd 100644 --- a/tests/datastore/modifycommontests.nim +++ b/tests/datastore/modifycommontests.nim @@ -2,7 +2,6 @@ import std/options import std/sugar import std/random import std/sequtils -import std/strutils import pkg/asynctest import pkg/chronos diff --git a/tests/datastore/querycommontests.nim b/tests/datastore/querycommontests.nim index e941464..c3ffd3b 100644 --- a/tests/datastore/querycommontests.nim +++ b/tests/datastore/querycommontests.nim @@ -1,12 +1,3 @@ -import std/options -import std/sequtils -from std/algorithm import sort, reversed - -import pkg/asynctest -import pkg/chronos -import pkg/stew/results -import pkg/stew/byteutils - import pkg/datastore template queryTests*(ds: Datastore, testLimitsAndOffsets = true, testSortOrder = true) {.dirty.} = diff --git a/tests/datastore/sql/testsqliteds.nim b/tests/datastore/sql/testsqliteds.nim index b48b6fe..c78b5c9 100644 --- a/tests/datastore/sql/testsqliteds.nim +++ b/tests/datastore/sql/testsqliteds.nim @@ -5,7 +5,6 @@ from std/algorithm import sort, reversed import pkg/asynctest import pkg/chronos -import pkg/stew/results import pkg/stew/byteutils import pkg/datastore/sql/sqliteds diff --git a/tests/datastore/testdatastore.nim b/tests/datastore/testdatastore.nim index 4361eef..5215673 100644 --- a/tests/datastore/testdatastore.nim +++ b/tests/datastore/testdatastore.nim @@ -2,7 +2,6 @@ import std/options import pkg/asynctest/unittest2 import pkg/chronos -import pkg/stew/results import pkg/datastore diff --git a/tests/datastore/testfsds.nim b/tests/datastore/testfsds.nim index 5791463..9a27173 100644 --- a/tests/datastore/testfsds.nim +++ b/tests/datastore/testfsds.nim @@ -5,7 +5,6 @@ from std/algorithm import sort, reversed import pkg/asynctest import pkg/chronos -import pkg/stew/results import pkg/stew/byteutils import pkg/datastore/fsds diff --git a/tests/datastore/testkey.nim b/tests/datastore/testkey.nim index e974a3a..2ed5a85 100644 --- a/tests/datastore/testkey.nim +++ b/tests/datastore/testkey.nim @@ -226,9 +226,6 @@ suite "Key": key.reverse.field == "a" test "key root": - let - key = Key.init("/a:b/c/d:e").tryGet() - check: Key.init(":b").tryGet().root not Key.init(":b/c").tryGet().root diff --git a/tests/datastore/testmountedds.nim b/tests/datastore/testmountedds.nim index 825a473..dc3a616 100644 --- a/tests/datastore/testmountedds.nim +++ b/tests/datastore/testmountedds.nim @@ -4,7 +4,6 @@ import std/tables import pkg/asynctest import pkg/chronos -import pkg/stew/results import pkg/stew/byteutils import pkg/datastore/mountedds diff --git a/tests/datastore/testtieredds.nim b/tests/datastore/testtieredds.nim index 1e924aa..aaab065 100644 --- a/tests/datastore/testtieredds.nim +++ b/tests/datastore/testtieredds.nim @@ -3,7 +3,6 @@ import std/os import pkg/asynctest import pkg/chronos -import pkg/stew/results import pkg/stew/byteutils import pkg/datastore/fsds