Crates.io | dscfg-cached_file_storage |
lib.rs | dscfg-cached_file_storage |
version | 0.1.0 |
source | src |
created_at | 2018-12-03 17:11:35.390227 |
updated_at | 2018-12-03 17:11:35.390227 |
description | Storage implementation for dynamic shared configuration |
homepage | https://github.com/Kixunil/dscfg |
repository | https://github.com/Kixunil/dscfg |
max_upload_size | |
id | 99874 |
size | 6,138 |
Basic implementation of dscfg file storage using file to store configuration and a hash map to cache it in memory.
Dscfg doesn't dictate how the configuration is stored. Instead, it defines the
Storage
trait which specifies required operations. This crate implements
Storage
for a type by storing data in file as a Json map.
The file is updated atomically by writing to temp file first and moving it over the old one. It's ensured that all data is written to file prior to moving, so the file can never get corrupted - at worst it'll contain old configuration.
The whole configuration is cached in memory using hash map, so reading is fast.
MITNFA