Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ntd/zettings
A simple peristence layer for Zig
https://github.com/ntd/zettings
linux mmap persistence zig
Last synced: 3 months ago
JSON representation
A simple peristence layer for Zig
- Host: GitHub
- URL: https://github.com/ntd/zettings
- Owner: ntd
- License: mit
- Created: 2024-10-16T15:04:35.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-10-24T15:00:26.000Z (3 months ago)
- Last Synced: 2024-10-25T03:35:36.530Z (3 months ago)
- Topics: linux, mmap, persistence, zig
- Language: Zig
- Homepage:
- Size: 43.9 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
*Zettings* is the simplest persistence layer I can think of. Its name is
a portmanteau of [Zig](https://github.com/ziglang/zig), the language I
used to implement it, and **settings**.At its core, it maps (via POSIX `mmap`) a struct with fixed-length
members to a fixed-length file. It is intended to be used as the base
for a basic persistence layer for OPC/UA servers, i.e. a port of the
[XSettings project](https://github.com/ntd/xsettings) from the C world.The demo program shows how this is supposed to work. It handles a set of
settings (boolean, numeric and string types) and allow to perform some
basic operations from command line.```sh
# Show usage info
zig build run -- -h# Create (-r) the schema file (demo.zettings) and dump (-d) its default values
zig build run -- -r -d demo.zettings# Toggle all booleans (-t) and dump the new values
zig build run -- -t -d demo.zettings# Now increment all numeric settings (-i) and dump the new values
zig build run -- -i -d demo.zettings# Further dumps show that the last values are retained
zig build run -- -d demo.zettings# Reset (-r) to the default values
zig build run -- -r -d demo.zettings
```