Stroika Library 3.0d23
 
Loading...
Searching...
No Matches
LocalDocumentDB.h File Reference
#include "Stroika/Foundation/StroikaPreComp.h"
#include <filesystem>
#include <optional>
#include "Stroika/Foundation/Characters/String.h"
#include "Stroika/Foundation/Containers/Mapping.h"
#include "Stroika/Foundation/Containers/Sequence.h"
#include "Stroika/Foundation/DataExchange/Variant/JSON/Reader.h"
#include "Stroika/Foundation/DataExchange/Variant/JSON/Writer.h"
#include "Stroika/Foundation/DataExchange/VariantValue.h"
#include "Stroika/Foundation/Database/Document/Collection.h"
#include "Stroika/Foundation/Database/Document/Connection.h"
#include "Stroika/Foundation/Database/Document/EngineProperties.h"
#include "Stroika/Foundation/Database/Document/Transaction.h"
#include "Stroika/Foundation/Debug/AssertExternallySynchronizedMutex.h"
#include "Stroika/Foundation/Execution/Synchronized.h"
#include "LocalDocumentDB.inl"

Go to the source code of this file.

Classes

struct  Stroika::Foundation::Database::Document::LocalDocumentDB::Options
 
struct  Stroika::Foundation::Database::Document::LocalDocumentDB::Options::MemoryStorage
 
struct  Stroika::Foundation::Database::Document::LocalDocumentDB::Options::SingleFileStorage
 
struct  Stroika::Foundation::Database::Document::LocalDocumentDB::Options::DirectoryFileStorage
 

Namespaces

namespace  Stroika::Foundation
 

Functions

Ptr Stroika::Foundation::Database::Document::LocalDocumentDB::New (const Options &options)
 create an LocalDocumentDB database (and connection) object, guided by argument Options.
 

Detailed Description

Note
Code-Status: Alpha

LocalDocumentDB is a (typically filesystem, but can be RAM based) simple implementation of the DocumentDB API. You can use this to debug/test, and possibly for limited, or embedded, small scale uses.

Advantages:

  • Small, simple, easy to review code, and understand API
  • Very small dependency footprint
  • Lets you pick data format to store (when storing to disk), JSON, or BSON, or whatever you have serializers/de-serializers for.

Disadvantages

  • Performance on larger scale
  • Transactions NYI

Definition in file LocalDocumentDB.h.

Function Documentation

◆ New()

auto Stroika::Foundation::Database::Document::LocalDocumentDB::New ( const Options &  options)

create an LocalDocumentDB database (and connection) object, guided by argument Options.

Example Usage
// In memory DB can be used by multiple threads
Connection::Ptr internallySynchronizedMemoryDBConnection = LocalDocumentDB::New (LocalDocumentDB::Options{
.fInternallySynchronizedLetter = eInternallySynchronized, .fStorage = LocalDocumentDB::Options::MemoryStorage{}});
Example Usage
// only json file read-only using DocumentDB API
Connection::Ptr copyFrom = LocalDocumentDB::New (LocalDocumentDB::Options{
.fStorage = LocalDocumentDB::Options::SingleFileStorage{.fFile = loadFromStartupFile, .fReadOnly = true}});
Note
Thread-Safety C++-Standard-Thread-Safety-For-Envelope-But-Ambiguous-Thread-Safety-For-Letter/a> the internal synchronization of the resulting letter object is controlled by Options::fInternallySynchronizedLetter

Definition at line 858 of file LocalDocumentDB.cpp.