← Назад к ресурсам

DataFly Lib

Simple lib for async I/O made originally for Adrenaline mod

Modrinth library utility

Описание

# Datafly A shared async I/O library for Fly's Minecraft mods providing centralized, high-performance disk persistence. ## Features - One shared thread pool across all mods — no wasted threads, no duplicated I/O code - Write data from any thread and get a result via DataTask — no blocking, no callback hell - Read-your-writes guarantee — reads always return the latest submitted value even before it hits disk - Coalesces burst writes to the same key — only the last value in a time window actually writes to disk - Atomic writes via tmp → fsync → rename — no half-written or corrupted files on crash - Emergency gzip compression when buffer memory runs low — trades CPU for heap headroom - Spill oversized writes to a temp spool directory instead of blocking or dropping data - Crash recovery — leftover spool files are re-drained to their destinations on next startup - Pluggable codec system — JSON, NBT, TOML, YAML, raw bytes, or bring your own - Per-mod writer configuration — each mod controls its own heap limit, codec, coalesce window, and cache size - Optional LRU read cache — skip disk entirely for hot keys - update() — atomic read-modify-write with the write lock held for the full cycle - computeIfAbsent() — create-or-update in one atomic call - World-agnostic — works from the main menu, client-side, dedicated server, anywhere