Skip to content
/ zettings Public

A simple peristence layer for open62541 based OPC/UA servers in Zig

License

Notifications You must be signed in to change notification settings

ntd/zettings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zettings is the simplest persistence layer I can think of. Its name is a portmanteau of 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 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.

# 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

About

A simple peristence layer for open62541 based OPC/UA servers in Zig

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published