all repos — litestore @ 42f751b94e0a84816857a4764d0e40d1ab2029ac

A minimalist nosql document store.

Added configuration files.
h3rald h3rald@h3rald.com
Sat, 21 Feb 2015 13:59:53 +0100
commit

42f751b94e0a84816857a4764d0e40d1ab2029ac

parent

92d949bcfe330d342f8752a434f20018c44bcc7f

7 files changed, 83 insertions(+), 24 deletions(-)

jump to
M .gitignore.gitignore

@@ -1,4 +1,4 @@

*.log.txt nimcache -*.ls +*.db litestore
M doc/_md/api.mddoc/_md/api.md

@@ -2,7 +2,7 @@ ## REST API Reference

### info - LiteStore Information -This resource can be queried to obtain basic information and statistics on the {{LS -> LiteStore}} server. +This resource can be queried to obtain basic information and statistics on the {{LS}} server. #### OPTIONS info
M doc/_md/overview.mddoc/_md/overview.md

@@ -1,5 +1,7 @@

## Overview +{{LS -> LiteStore}} + ### Rationale ...
M lib/cli.nimlib/cli.nim

@@ -1,15 +1,57 @@

import parseopt2, + parsecfg, + streams, strutils, logging import types, utils +const cfgfile = "litestore.nimble".slurp -const - version* = "1.0" - usage* = " LiteStore v"& version & " - Lightweight REST Document Store" & """ +var + file*, address*, version*, appname*: string + port*: int + operation = opRun + directory = "" + readonly = false + purge = false + logLevel = lvlInfo + +var f = newStringStream(cfgfile) +if f != nil: + var p: CfgParser + open(p, f, "litestore.nimble") + while true: + var e = next(p) + case e.kind + of cfgEof: + break + of cfgKeyValuePair: + case e.key: + of "version": + version = e.value + of "appame": + appname = e.value + of "port": + port = e.value.parseInt + of "address": + address = e.value + of "file": + file = e.value + else: + discard + of cfgError: + fail(1, "Configuration error.") + else: + discard + close(p) +else: + fail(2, "Cannot process configuration file.") + +let + usage* = appname & " v" & version & " - Lightweight REST Document Store" & """ (c) 2015 Fabio Cevasco Usage:

@@ -26,17 +68,6 @@ --purge Delete exported files (used in conjunction with --export).

-r, --readonly Allow only data retrieval operations. -v, --version Display the program version. """ - -var - file = "data.ls" - port = 9500 - address = "0.0.0.0" - operation = opRun - directory = "" - readonly = false - purge = false - logLevel = lvlInfo - for kind, key, val in getOpt(): case kind:

@@ -94,7 +125,7 @@ LS.purge = purge

LS.directory = directory LS.appversion = version LS.readonly = readonly -LS.appname = "LiteStore" +LS.appname = appname # Initialize loggers
M litestore.nimlitestore.nim

@@ -38,12 +38,5 @@ LS.store.importDir(LS.directory)

of opExport: LS.store.exportDir(LS.directory, LS.purge) of opRun: - # STARTTEST - LS.store.destroyDatastore() - LS.file.createDatastore() - LS.store = LS.file.openDatastore() - LS.store.importDir("nimcache") - LS.store.importDir("lib") - # ENDTEST LS.serve runForever()
A litestore.nim.cfg

@@ -0,0 +1,17 @@

+define: "release" +dynlibOverride:sqlite3 + +# http://crossgcc.rts-software.org/doku.php?id=compiling_for_win32 +i386.windows.gcc.path = "/usr/local/gcc-4.8.0-qt-4.8.4-for-mingw32/win32-gcc/bin" +i386.windows.gcc.exe = "i586-mingw32-gcc" +i386.windows.gcc.linkerexe = "i586-mingw32-gcc" + +# http://crossgcc.rts-software.org/doku.php?id=compiling_for_linux +i386.linux.gcc.path = "/usr/local/gcc-4.8.1-for-linux32/bin" +i386.linux.gcc.exe = "i586-pc-linux-gcc" +i386.linux.gcc.linkerexe = "i586-pc-linux-gcc" + +# http://www.jaredwolff.com/toolchains/ +arm.linux.gcc.path = "/usr/local/arm-none-linux-gnueabi/bin" +arm.linux.gcc.exe = "arm-none-linux-gnueabi-gcc" +arm.linux.gcc.linkerexe = "arm-none-linux-gnueabi-gcc"
A litestore.nimble

@@ -0,0 +1,16 @@

+[Package] +name = "litestore" +appame = "LiteStore" +version = "1.0.0" +author = "Fabio Cevasco" +description = "Self-contained, lightweight, RESTful document store." +license = "MIT" +bin = "litestore" + +[Defaults] +file = "data.db" +address = "127.0.0.1" +port = 9500 + +[Deps] +requires: "nimrod >= 0.10.2"