all repos — litestore @ cdf8455e669b92b6396c612090bb72d9a548d3a5

A minimalist nosql document store.

Updated docs; minor fixes.
h3rald h3rald@h3rald.com
Sun, 06 Sep 2015 18:18:29 +0200
commit

cdf8455e669b92b6396c612090bb72d9a548d3a5

parent

553ded32396366407211f1ac90c57008a67da651

M admin/js/components/navbar.jsadmin/js/components/navbar.js

@@ -17,6 +17,7 @@ {path: "/guide/architecture", title: caret+"Architecture"},

{path: "/guide/data_model", title: caret+"Data Model"}, {path: "/guide/getting-started", title: "Getting Started"}, {path: "/guide/usage", title: "Usage"}, + {path: "/guide/admin_app", title: "Administration App"}, {path: "/guide/api", title: "API"}, {path: "/guide/api_info", title: caret+"info (LiteStore Information)"}, {path: "/guide/api_docs", title: caret+"docs (LiteStore Documents)"},
M admin/js/models.jsadmin/js/models.js

@@ -12,9 +12,13 @@ Page.get = function(id) {

var content = m.prop(""); return m.request({ method: "GET", - url: "md/"+id+".md", - deserialize: function(value) {return value;} - }).then(function(content){ return u.markdown(content);}); + url: host+"/docs/admin/md/"+id+".md", + deserialize: function(value) { + return value; + } + }).then(function(content){ + return u.markdown(content); + }); }; Info.get = function(){

@@ -113,4 +117,4 @@ data: ops

}); }); }; -}()); +}());
A admin/md/admin_app.md

@@ -0,0 +1,40 @@

+## Administration App + +A simple but fully-functional administration app can be used to manage LiteStore data stores. This app can simply be imported into a data store file and then run via LiteStore. + +### Obtaining and Running the Administration App + +There are two ways to get the Administration App: + +* Using a pre-populated data store file +* Manually importing the [admin](class:dir) directory into any data store file + +#### Using a Pre-populated Data Store File + +If you are using the [data.db](class:file) data store file distributed with the pre-built LiteStore binaries, you don't have to do anything: the Administration App is already bundled in the datastore file. You simply have to run LiteStore and access the app at the following address: <http://localhost:9500/docs/admin/index.html>. + +#### Importing the admin directory + +If you are using your own data store file, you can still import the Administration App in it by downloading the LiteStore source files or cloning the LiteStore repository from [Github](https://github.com/h3rald/litestore) and running LiteStore with the following arguments and options from the top-level directory of the LiteStore repository: + +[litestore -d:admin import](class:cmd) + +Once the import is completed, you can run litestore and access the app at the following address: <http://localhost:9500/docs/admin/index.html>. + +### Main Functionalities + +The LiteStore Administration App is a single-page application built using the [Mithril](https://lhorie.github.io/mithril/) Javascript framework and other open source software like [Bootstrap](http://getbootstrap.com/) and the [ACE Editor](http://ace.c9.io/). + +It can be used to easily access and explore any LiteStore data store (provided that it has been loaded in it) and access most of LiteStore functionalities via its HTTP API. + +#### View Data Store Information + +When first loaded, the app loads the _Info_ page by default. + +#### Read LiteStore Documentation + +#### Display Documents by Tag + +#### Search Documents + +#### View, Preview, Create and Edit Documents
M admin/md/architecture.mdadmin/md/architecture.md

@@ -19,4 +19,33 @@ * the RESTful HTTP API, which can be used as the primary way to perform CRUD operation on documents, and manage document tags.

#### Database Schema -![LiteStore Database](images/litestore_db.png)+The database schema of LiteStore data store file is very simple, as shown in the following diagram: + +![LiteStore Database](images/litestore_db.png) + +##### info Table + +The [info](class:kwd) table currently contains just two INT columns used to keep track of: + +* The version of the database schema +* The total number of documents stored in the database + +##### documents Table + +The [documents](class:kwd) table is the most important table of the data store, as it contains all the documents stored in it. The following information is stored for each document: + +* **docid** &ndash; The internal unique document identifier. +* **id** &ndash; The public unique document identifier, used to access the document via the HTTP API. +* **data** &ndash; The contents of the document (or their base64-encoded representation in case of binary documents). +* **binary** &ndash; Whether the document is binary (1) or textual (0). +* **searchable** &ndash; Whether the document is searchable (1) or not (0). Currently, textual documents are searchable and binary documents are not. +* **created** &ndash; When the document was created. +* **modified** &ndash; When the document was last modified. + +##### tags Table + +The [tags](class:kwd) table is used to store the associations between tags and documents. Tags can be added by users or add automatically by the system when a document is imported into the data store. + +##### searchdata Table + +This table is used as full-text index for searchable documents.
M admin/md/data_model.mdadmin/md/data_model.md

@@ -1,5 +1,23 @@

### Data Model +LiteStore manages only two basic entities, Documents and Tags. + #### Documents -#### Tags+A *document* is the minimum (and only) unit of content managed by LiteStore. Unlike other data stores, LiteStore documents are not constrained to a specific content type like JSON, but can be of virtually *any* content type, both textual and binary. + +When you store a document into a data store using the [import](class:cwd) command or the HTTP API, LiteStore attempts to determine whether the document is binary or not based on its content type. If the content type of a document is not known by LiteStore, the document will be considered binary. + +Textual documents are also searchable, and their ID and contents are immediately indexed when they are stored into the data store and re-indexed when they are updated. + +#### Tags + +Tags are a way to categorize documents. Because LiteStore does not make any assumption on the content type and the structure of a document, tags can become really useful when retrieving documents. + +Tags can contain letters, numbers and any of the following special characters: [_-?~:.@#^!+](class:kwd) + +All system tags are prefixed by a [$](class:kwd) characters, and are used to identify the following document metadata. More specifically: + +* **$dir:*directory*** &ndash; System tags starting with [$dir:](class:kwd) identify the name of a directory whose contents were imported into a data store. All files within the specified directory will be tagged with a [$dir:](class:kwd) system tag. Example: If a directory called **admin** is imported, imported files will be tagged with [$dir:admin](class:kwd). +* **$type:*type*** &ndash; System tags starting with [$type:](class:kwd) identify the type of a document (i.e. the first portion of its content type). Example: Documents whose content type is **text/plain** will be tagged with [$type:text](class:kwd). +* **$subtype:*subtype*** &ndash; System tags starting with [$subtype:](class:kwd) identify the subtype of a document (i.e. the second portion of its content type). Example: Documents whose content type is **text/plain** will be tagged with [$subtype:plain](class:kwd).
M admin/md/usage.mdadmin/md/usage.md

@@ -42,7 +42,7 @@ [litestore -r -l:debug](class:cmd)

* mouting a directory called **admin** (changes will be mirrored to filesystem): - [litestore -m:admin](class:cmd) + [litestore -d:admin -m](class:cmd) #### Importing a directory

@@ -54,17 +54,17 @@ #### Exporting a directory

Export all documents tagged with **$dir:admin** to a local directory called **admin**: -[litestore -e:admin](class:cmd) +[litestore export -d:admin](class:cmd) #### Deleting documents within a directory Delete all documents tagged with **$dir:admin**: -[litestore -d:admin](class:cmd) +[litestore delete -d:admin](class:cmd) #### Performing maintenance operations -* vacuum: +* vacuum SQlite database: [litestore vacuum](class:cmd)
M admin/md/use-cases.mdadmin/md/use-cases.md

@@ -4,7 +4,7 @@ While LiteStore may not be the best choice for large data-intensive applications, it definitely shines when used for rapid prototyping and as a backend for small/lightweight applications.

#### Lightweight Document Store -LiteStore is, first and foremost a _document store_. Although it uses a relational database ([SQlite](http://www.sqlite.org)) as a storage medium, it is NoSQL document store accessible via a rest API. +LiteStore is, first and foremost a _document store_. Although it uses a relational database ([SQlite](http://www.sqlite.org)) as a storage medium, it is a NoSQL document store accessible via a RESTful API. As a document store, LiteStore provides the following features
M build_guidebuild_guide

@@ -6,6 +6,7 @@ md/use-cases.md

md/architecture.md md/getting-started.md md/usage.md + md/admin_app.md md/api.md md/credits.md )