While this release introduces a breaking change, most of the API has been pretty stable for a long time. Consider this a 1.0.0 release candidate.
-
Breaking changes
- Persistence functions raise an exception rather than return
:noop
when persistence has been disabled. - Error tuples all return Exception structs rather than atoms. This cleans up some error handling inconsistences, but will require changes to any code that tries to interpret the error atoms.
- Persistence functions raise an exception rather than return
-
New features
- Add raising versions (e.g., bang versions) of persistence functions
-
New feature
- Added
:event_transformer
option that takes a function to transform aPropertyTable.Event.t()
into a custom data structure for subscribers. This lets users abstract away the use ofPropertyTable
.
- Added
-
Fixes
- The
:previous_timestamp
field in change events had been set tonil
when no information was known about the previous state of the property. It's now set to thePropertyTable
's start time to fix the typespec violation (nil
wasn't valid) and help differentiate unknown properties due to app restarts vs. not being set. - Properties set at initialization, including restored ones, all have the same timestamp.
- The
- Fix incorrect typespec for
PropertyTable.options()
- Updates
- Fix unintended exceptions being raised when the filesystem updates start failing when table persistence is enabled
- Reduce time when an unexpected VM exit could result in a corrupt persisted file. The backup would be usable, but now the critical steps only involve renaming or deleting files.
- Updates
- Fix compiler warnings with Elixir 1.15
- Updates
- Fixed missing
:crypto
dependency warning.
- Fixed missing
- New features
- Automatic persistence and snapshots for PropertyTables. This makes it
possible to use
PropertyTable
for small key/value stores like those for storing runtime settings especially for Nerves devices. PropertyTable protects against corruption and unexpected reboots that happen mid-write.
- Automatic persistence and snapshots for PropertyTables. This makes it
possible to use
-
Backwards incompatible changes
nil
no longer deletes a property from the table. In other words, it's ok to for properties to benil
now.PropertyTable.clear/2
andPropertyTable.clear_all/2
were renamed toPropertyTable.delete/2
andPropertyTable.delete_matches/2
respectively.PropertyTable.put/3
raises if you give it an invalid property rather than returning an error tuple. Since these are usually programming errors anyway, this change removes the need for a return value check for Dialyzer.
-
New features
- Added
PropertyTable.put_many/2
. It's possible to add many properties to the table atomically. Change notifications still only get sent for properties that really changed.
- Added
Initial release
This code was extracted from vintage_net
, simplified and modified to support
more use cases.