yog-storage 0.1.0

Yog persistent key-value storage for mod data.
Documentation
  • Coverage
  • 51.22%
    21 out of 41 items documented1 out of 31 items with examples
  • Size
  • Source code size: 15.18 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 517.48 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3s Average build duration of successful builds.
  • all releases: 3s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • F000NKKK

Scoped, typed, auto-flushing persistent key-value storage for Yog mods.

Quick start

use yog_storage::{Storage, Value};

// Global store — one file per mod
let mut store = Storage::open("/path/to/game", "mymod");
store.set("motd", "Hello!");
store.set("spawn_x", 0i64);

// Per-player store — one file per UUID
let mut ps = Storage::open_player("/path/to/game", "mymod", "player-uuid");
ps.set("coins", 100i64);
let coins = ps.get_int("coins").unwrap_or(0);

// Auto-flushed on drop.  Call flush() explicitly for earlier persistence.

File layout

<game_dir>/yog-data/<mod_id>/global.kv
<game_dir>/yog-data/<mod_id>/player/<uuid>.kv
<game_dir>/yog-data/<mod_id>/world/<dim_safe>.kv
<game_dir>/yog-data/<mod_id>/entity/<uuid>.kv
<game_dir>/yog-data/<mod_id>/chunk/<dim_safe>_<cx>_<cz>.kv

File format

Plain text, one entry per line: key\ttype\tvalue. Human-readable and diff-friendly. Lines starting with # are comments. Writes are atomic (write to .kv.tmp, then rename) so a crash mid-save leaves old data intact.