cleanup results import and some warnings (#64)
* cleanup results import and some warnings * add some more push raises
This commit is contained in:
parent
0ee88a2a9b
commit
962c08c101
|
@ -9,3 +9,5 @@ coverage
|
|||
datastore.nims
|
||||
nimcache
|
||||
TODO
|
||||
nimble.develop
|
||||
nimble.paths
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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!")
|
||||
raiseAssert("Not implemented!")
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
{.push raises: [].}
|
||||
|
||||
import pkg/chronos
|
||||
import pkg/questionable
|
||||
import pkg/questionable/results
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
{.push raises: [].}
|
||||
|
||||
import std/hashes
|
||||
|
||||
import pkg/questionable
|
||||
import pkg/questionable/results
|
||||
import pkg/upraises
|
||||
|
||||
push: {.upraises: [].}
|
||||
|
||||
const
|
||||
Delimiter* = ":"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
{.push raises: [].}
|
||||
|
||||
import std/options
|
||||
import std/macros
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
import std/options
|
||||
|
||||
import pkg/asynctest
|
||||
import pkg/chronos
|
||||
import pkg/stew/results
|
||||
|
||||
import pkg/datastore
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.} =
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -2,7 +2,6 @@ import std/options
|
|||
|
||||
import pkg/asynctest/unittest2
|
||||
import pkg/chronos
|
||||
import pkg/stew/results
|
||||
|
||||
import pkg/datastore
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue