Skip to content

content_filesystem_api

makr-code edited this page Dec 21, 2025 · 1 revision

Content Filesystem API

Stand: 5. Dezember 2025
Version: 1.0.0
Kategorie: Content


Datum: 19. Nov 2025 Status: Implementiert (Core), Server-Endpoints optional

Ziel

Einfaches Binär-Content-Storage über RocksDB mit konsistenten Metadaten, optionaler SHA‑256 Integrität und Range‑Reads.

Schlüsselkonzept

  • Datenlayout:
    • content:<pk>:meta → CBOR‑codiertes JSON { pk, mime, size, sha256_hex }
    • content:<pk>:blob → Binärdaten
  • Transaktionen: Einzel‑Writes (Meta dann Blob); für Multi‑Objekt‑Ingest können WriteBatch/Txn genutzt werden.

C++ API

class ContentFS {
public:
  ContentFS(RocksDBWrapper& db);
  struct Status { bool ok; std::string message; };

  Status put(const std::string& pk,
             const std::vector<uint8_t>& data,
             const std::string& mime,
             const std::optional<std::string>& sha256_expected_hex = std::nullopt);

  std::pair<Status, std::vector<uint8_t>> get(const std::string& pk) const;
  std::pair<Status, std::vector<uint8_t>> getRange(const std::string& pk, uint64_t offset, uint64_t length) const;
  std::pair<Status, ContentMeta> head(const std::string& pk) const;
  Status remove(const std::string& pk);

  static std::string sha256Hex(const std::vector<uint8_t>& data);
};

Beispiel

RocksDBWrapper db(cfg); db.open();
ContentFS fs(db);

std::vector<uint8_t> bytes = load_file("image.png");
auto hex = ContentFS::sha256Hex(bytes);
auto st = fs.put("img_123", bytes, "image/png", hex);
auto [hst, meta] = fs.head("img_123");
auto [gst, full] = fs.get("img_123");
auto [rst, part] = fs.getRange("img_123", 0, 1024);

Tests

  • tests/test_content_fs.cpp: Roundtrip, Range‑Reads, Checksum‑Mismatch, Delete → 4/4 PASS (MSVC Debug)

Performance & Grenzen

  • Kleine bis mittlere Blobs (KB–MB) performant direkt in RocksDB/BlobDB.
  • Für sehr große Objekte (>100MB) optionales Sharding/Streaming als Erweiterung (Future Work).

Server‑Endpoints (optional)

  • POST /content – Upload (Body), Header: Content-Type, optional X-Checksum-SHA256.
  • GET /content/{pk} – Download; unterstützt Range:.
  • HEAD /content/{pk} – Metadaten.
  • DELETE /content/{pk} – Löschen.

Hinweis: Endpoints sind aktuell nicht verdrahtet; Implementierung kann über themis_server Handler folgen.

ThemisDB Dokumentation

Version: 1.3.0 | Stand: Dezember 2025


📋 Schnellstart


🏗️ Architektur


🗄️ Basismodell


💾 Storage & MVCC


📇 Indexe & Statistiken


🔍 Query & AQL


💰 Caching


📦 Content Pipeline


🔎 Suche


⚡ Performance & Benchmarks


🏢 Enterprise Features


✅ Qualitätssicherung


🧮 Vektor & GNN


🌍 Geo Features


🛡️ Sicherheit & Governance

Authentication

Schlüsselverwaltung

Verschlüsselung

TLS & Certificates

PKI & Signatures

PII Detection

Vault & HSM

Audit & Compliance

Security Audits

Gap Analysis


🚀 Deployment & Betrieb

Docker

Observability

Change Data Capture

Operations


💻 Entwicklung

API Implementations

Changefeed

Security Development

Development Overviews


📄 Publikation & Ablage


🔧 Admin-Tools


🔌 APIs


📚 Client SDKs


📊 Implementierungs-Zusammenfassungen


📅 Planung & Reports


📖 Dokumentation


📝 Release Notes


📖 Styleguide & Glossar


🗺️ Roadmap & Changelog


💾 Source Code Documentation

Main Programs

Source Code Module


🗄️ Archive


🤝 Community & Support


Vollständige Dokumentation: https://makr-code.github.io/ThemisDB/

Clone this wiki locally