all repos — litestore @ 9c120788aaa80c875ec0ec722e46346b53771eab

A minimalist nosql document store.

Renamed 'mirror' in 'mount'.
h3rald h3rald@h3rald.com
Sat, 21 Mar 2015 10:06:22 +0100
commit

9c120788aaa80c875ec0ec722e46346b53771eab

parent

2f78123709b0151b27276a8997148777061cfce8

6 files changed, 16 insertions(+), 16 deletions(-)

jump to
M lib/api_v1.nimlib/api_v1.nim

@@ -183,7 +183,7 @@ content["version"] = %(LS.appname & " v" & LS.appversion)

content["size"] = %($((LS.file.getFileSize().float/(1024*1024)).formatFloat(ffDecimal, 2)) & " MB") content["read_only"] = %LS.readonly content["directory"] = %LS.directory - content["mirror"] = %LS.mirror + content["mount"] = %LS.mount content["total_documents"] = %total_docs content["total_tags"] = %total_tags content["tags"] = tags
M lib/cli.nimlib/cli.nim

@@ -18,7 +18,7 @@ operation = opRun

directory = "" readonly = false logLevel = lvlInfo - mirror = false + mount = false reset = false var f = newStringStream(cfgfile)

@@ -68,8 +68,8 @@ --import Import the specified directory (Store all its contents).

-l, --log Specify the log level: debug, info, warn, error, fatal, none (default: info) -p, --port Specify port number (default: 9500). -r, --readonly Allow only data retrieval operations. - -m, --mirror Import the specified directory, run server and mirror database changes to filesystem. - --reset If --mirror is specified, resets (deletes) any previously imported directory data. + -m, --mount Run server and mirror database changes to the specified directory on the filesystem. + --reset If --mount is specified, resets (deletes) any previously imported directory data. -v, --version Display the program version. """

@@ -97,12 +97,12 @@ if val == "":

fail(104, "Directory to import not specified.") operation = opImport directory = val - of "mirror", "m": + of "mount", "m": if val == "": - fail(104, "Directory to mirror not specified.") + fail(104, "Directory to mount not specified.") operation = opRun directory = val - mirror = true + mount = true of "reset": reset = true of "export":

@@ -139,7 +139,7 @@ LS.appversion = version

LS.readonly = readonly LS.appname = appname LS.favicon = favicon -LS.mirror = mirror +LS.mount = mount LS.reset = reset # Initialize loggers
M lib/core.nimlib/core.nim

@@ -45,12 +45,12 @@ raise newException(EDatastoreDoesNotExist, "Datastore '$1' does not exists." % file)

try: result.db = db.open(file, "", "", "") result.path = file - result.mirror = "" + result.mount = "" except: raise newException(EDatastoreUnavailable, "Datastore '$1' cannot be opened." % file) proc hasMirror(store: Datastore): bool = - return store.mirror.len > 0 + return store.mount.len > 0 # Manage Tags

@@ -123,7 +123,7 @@ store.db.exec(SQL_INSERT_SEARCHCONTENT, id, data)

store.addDocumentSystemTags(id, contenttype) if store.hasMirror: # Add dir tag - store.createTag("$dir:"&store.mirror, id, true) + store.createTag("$dir:"&store.mount, id, true) var filename = id.unixToNativePath if not fileExists(filename): filename.parentDir.createDir

@@ -241,7 +241,7 @@ raise newException(EDirectoryNotFound, "Directory '$1' not found." % dir)

if reset: store.deleteDir(dir) store.importDir(dir) - store.mirror = dir + store.mount = dir proc destroyDocumentsByTag*(store: Datastore, tag: string): int64 = result = 0
M lib/server.nimlib/server.nim

@@ -53,7 +53,7 @@ info(getReqInfo(req).replace("$", "$$"))

let res = req.route(LS) await req.respond(res.code, res.content, res.headers) info(LS.appname & " v" & LS.appversion & " started on " & LS.address & ":" & $LS.port & ".") - if LS.mirror: + if LS.mount: info("Mirroring datastore changes to: " & LS.directory) asyncCheck server.serve(LS.port.Port, handleHttpRequest, LS.address)
M lib/types.nimlib/types.nim

@@ -12,7 +12,7 @@ EInvalidRequest* = object of Exception

Datastore* = object db*: TDbConn path*: string - mirror*: string + mount*: string QueryOptions* = object select*: string single*:bool

@@ -34,7 +34,7 @@ port*: int

operation*: Operation directory*: string file*: string - mirror*: bool + mount*: bool readonly*: bool appname*: string appversion*: string
M litestore.nimlitestore.nim

@@ -31,7 +31,7 @@ except:

fail(200, "Unable to create datastore '$1'" % [LS.file]) try: LS.store = LS.file.openDatastore() - if LS.mirror: + if LS.mount: try: LS.store.mountDir(LS.directory, LS.reset) except: