Suo (suomi: swamp) is document oriented DB.
[TOC]
!!! Important! Despite it's already using in production on some projects, it still in heavly development stage.
It means that API may changes, and currenty not tested as well as should.
Please keep it in mind.
There is a root repo that contains a two main repos inside:
suo- this librarysuo_generator- generator helper for declarative style DTOssimple_example- example usage of thge lib
It's platform agnostic DB is developing with dart language.
Main concept of this storage it's provide possibility to store any structures and make easy search by them, therefore in the docstorage we use indexing. Index is a structure that made for icrease datata retrieval speed, a bit detailed below.
Current index implementation allows us to retrieve a document with indexed value in O(1) access time. Cuz index storing implemented by the hash set of keys and pointers.
Physicaly index files stores in .idx files inside index direcory and have a structure like this.
entity_storage/
index/
index_name.idx
index_name2.idx
etc..
inside index file we have a following view:
index_value:link_1,link2,link3
index_value2:link_4,link_6,
index_valueN:link_x,link_z
etc..
where link_n is pointer (id) on exact document;
Index and IndexedEntity are classes that helps us to create this shit.
Index<V,I> is functional-based index. that keep two field inside name and indexFunction.
IndexEntity<V,I> is wrapper around your primary DTO, that consist value list of indicies and computable field id its field something like primary key. as is a computable it could be composed key. but in generarall it have to be id of your DTO.
Since it has not been published yet you should add it as git dependency in your pubspec.yaml
dependencies:
suo:
git:
url: git@github.com:NiKoTron/suo.git
path: suoIf you whant to use code generation feature you should also add a suo_generator in your dev_dependencies
dev_dependencies:
suo:
git:
url: git@github.com:NiKoTron/suo.git
path: suo_generatorBasic usage looks like this:
First of all we should create indexed wrapper for our DTO object.
class SomeObj {
String id;
String foo;
String bar;
String baz;
SomeObj.fromJson(String json) // create instance from json
toJson() => // convert to json...
}
class IndexedObj extends IndexedEntity<SomeObj, String> {
IndexedBike(value) : super(
value, // dto value
(v) => v.id, // id
[
Index('foo', (v) => '${v?.foo}'),
Index('foobaz', (v) => '${v?.foo}_${v?.baz}')
]);
}Initialisation of storage.
For each type of object, we have to create their own docstorage with a unique directory.
We should pass four parameters to create storage instance:
The directory where data files will managing.
Deserialiser and serialiser like in Suo above.
Indexed factory is a function that makes an IndexedEntity wrapper instance for our DTO.
This package is dveloping under MIT license
Main contributor: Nikolai Simonov nickolay.simonov@outlook.com
