Content storage layer for local-first systems.
The store module is responsible for managing the actual data (file contents) in Softadastra.
It handles:
How data is stored, retrieved, and materialized on disk.
The goal of softadastra/store is simple:
Store and retrieve file content reliably, independently from how it is observed or synchronized.
Separate data from observation.
fsobserves filesstoremanages their content
The store module provides:
- Storage of file content (blobs)
- Reading and writing file data
- Materializing files on disk
- Preparing for chunk-based storage (future)
- No filesystem observation (fs module)
- No sync logic (sync module)
- No network communication (transport module)
- No operation durability (wal module)
π It manages content only.
The module focuses on:
- Bytes
- Blobs
- Data representation
Not on file events or sync decisions.
Even if it writes to disk:
- It does not observe filesystem changes
- It does not emit events
Must support future evolution:
- Chunking
- Deduplication
- Compression
Same input β same stored output.
modules/store/
βββ include/softadastra/store/
β βββ BlobStore.hpp
β βββ LocalStore.hpp
β βββ Chunker.hpp
β βββ FileMaterializer.hpp
βββ src/
Abstract interface.
Provides:
- Store data
- Retrieve data
- Identify content (hash-based)
Concrete implementation using local disk.
Responsibilities:
- Store blobs as files
- Manage local storage layout
Prepares for:
- Splitting large files into chunks
- Deduplication (future)
Responsible for:
- Reconstructing files from stored data
- Writing files to the filesystem
#include <softadastra/store/engine/StoreEngine.hpp>
using namespace softadastra::store;
int main()
{
core::StoreConfig config;
config.wal_path = "data/store.log";
engine::StoreEngine store(config);
// Create key
types::Key key;
key.value = "message";
// Create value
types::Value value;
value.data = {'H','e','l','l','o'};
// PUT
auto res = store.put(key, value);
if (!res.success)
return 1;
// GET
auto entry = store.get(key);
if (entry)
{
std::string content(entry->value.data.begin(), entry->value.data.end());
std::cout << content << "\n";
}
return 0;
}- Sync receives operation
- Store saves content
- Metadata updated
- File materialized (optional)
- Request for file content
- Store retrieves blob
- File reconstructed if needed
Used by:
- sync (primary)
- metadata (indirectly)
- app layer
Content is stored as:
- Immutable blobs
- Identified by hash
Files can be:
- Reconstructed from blobs
- Written to filesystem
- softadastra/core
- Filesystem APIs
- Full file storage (no chunking yet)
- Simple local disk layout
- No deduplication
- No compression
- Chunk-based storage
- Deduplication
- Compression
- Content-addressable storage
- Remote storage support
- Versioned storage
- Never depend on filesystem events
- Never include sync logic
- Never mutate stored blobs
- Always treat data as immutable
The store is not about files.
It is about data.
- Stores file content
- Retrieves data
- Supports file reconstruction
- Decoupled from sync and fs
vix add @softadastra/store
vix depsSee root LICENSE file.