vintage_net v0.6.0 VintageNet.PropertyTable View Source
PropertyTables are in-memory key-value stores
Users can subscribe to keys or groups of keys to be notified of changes.
Keys are hierarchically layed out with each key being represented as a list
for the path to the key. For example, to get the current state of the network
interface eth0
, you would get the value of the key, ["net", "ethernet", "eth0"]
.
Values can be any Elixir data structure except for nil
. nil
is used to
identify non-existent keys. Therefore, setting a property to nil
deletes
the property.
Users can get and listen for changes in multiple keys by specifying prefix paths. For example, if you wants to get every network property, run:
PropertyTable.get_by_prefix(table, ["net"])
Likewise, you can subscribe to changes in the network status by running:
PropertyTable.subscribe(table, ["net"])
Properties can include metadata. PropertyTable
only specifies that metadata
is a map.
Link to this section Summary
Functions
Returns a specification to start a property_table under a supervisor.
See Supervisor
.
Clear out a property
Clear out all properties under a prefix
Get the current value of a property
Get a list of all properties matching the specified prefix
Update a property and notify listeners
Subscribe to receive events
Stop subscribing to a property
Link to this section Types
Properties
A table_id identifies a group of properties
Link to this section Functions
Returns a specification to start a property_table under a supervisor.
See Supervisor
.
Clear out a property
Clear out all properties under a prefix
Get the current value of a property
Get a list of all properties matching the specified prefix
Update a property and notify listeners
Subscribe to receive events
Stop subscribing to a property