Grizzly.Storage (grizzly v8.15.3)

View Source

Persistent storage for device information and other Grizzly internals.

Summary

Functions

Returns a child spec to start the storage process under a supervisor. See Supervisor.

Delete everything from storage.

Delete keys matching a pattern using the configured adapter.

Get a value from storage by key using the configured adapter.

Retrieves a node's command class version.

Returns a node's stored DSK.

Retrieves information about a node's inclusion process.

Retrieves a node's basic info.

Retrieves a node's last awake time.

Returns the node's wakeup interval in seconds.

Match keys in storage against a pattern using the configured adapter.

Puts a key-value pair into storage using the configured adapter.

Puts multiple key-value pairs into storage using the configured adapter.

Store a node's DSK.

Stores information about a node's inclusion process.

Stores node information.

Stores a node's last awake time.

Stores a node's wakeup interval in seconds.

Types

key()

@type key() :: PropertyTable.property()

See PropertyTable.property/0.

node_inclusion_info()

@type node_inclusion_info() :: %{
  status:
    Grizzly.ZWave.CommandClasses.NetworkManagementInclusion.node_add_status(),
  granted_keys: [Grizzly.ZWave.Security.key()],
  kex_fail_type: Grizzly.ZWave.Security.key_exchange_fail_type() | nil,
  smartstart?: boolean()
}

node_info()

@type node_info() :: %{
  listening?: boolean(),
  basic_device_class: Grizzly.ZWave.DeviceClasses.basic_device_class(),
  generic_device_class: Grizzly.ZWave.DeviceClasses.generic_device_class(),
  specific_device_class: Grizzly.ZWave.DeviceClasses.specific_device_class(),
  command_classes: Grizzly.ZWave.CommandClasses.command_class_list()
}

pattern()

@type pattern() :: PropertyTable.pattern()

See PropertyTable.pattern/0.

put_node_info_opt()

@type put_node_info_opt() :: {:overwrite_command_classes, boolean()}

value()

@type value() :: PropertyTable.value()

See PropertyTable.value/0.

Functions

child_spec(opts)

@spec child_spec(PropertyTable.options()) :: Supervisor.child_spec()

Returns a child spec to start the storage process under a supervisor. See Supervisor.

delete_all()

@spec delete_all() :: :ok

Delete everything from storage.

delete_matches(pattern)

@spec delete_matches(pattern()) :: :ok

Delete keys matching a pattern using the configured adapter.

get(key)

@spec get(key()) :: value()

Get a value from storage by key using the configured adapter.

get_node_command_class_version(node_id, command_class)

@spec get_node_command_class_version(Grizzly.ZWave.node_id(), atom()) ::
  pos_integer() | nil

Retrieves a node's command class version.

get_node_dsk(node_id)

@spec get_node_dsk(Grizzly.ZWave.node_id()) :: Grizzly.ZWave.DSK.t() | nil

Returns a node's stored DSK.

get_node_inclusion_info(node_id)

@spec get_node_inclusion_info(Grizzly.ZWave.node_id()) :: node_inclusion_info() | nil

Retrieves information about a node's inclusion process.

get_node_info(node_id)

@spec get_node_info(Grizzly.ZWave.node_id()) :: node_info() | nil

Retrieves a node's basic info.

get_node_last_awake(node_id)

@spec get_node_last_awake(Grizzly.ZWave.node_id()) :: DateTime.t() | nil

Retrieves a node's last awake time.

get_node_wakeup_interval(node_id)

@spec get_node_wakeup_interval(Grizzly.ZWave.node_id()) :: non_neg_integer() | nil

Returns the node's wakeup interval in seconds.

match(pattern)

@spec match(pattern()) :: [{key(), value()}]

Match keys in storage against a pattern using the configured adapter.

put(key, value)

@spec put(key(), value()) :: :ok

Puts a key-value pair into storage using the configured adapter.

put_many(properties)

@spec put_many([{key(), value()}]) :: :ok

Puts multiple key-value pairs into storage using the configured adapter.

put_node_command_class_version(node_id, command_class, version)

@spec put_node_command_class_version(Grizzly.ZWave.node_id(), atom(), pos_integer()) ::
  :ok

Stores a node's command class version.

put_node_dsk(node_id, dsk)

@spec put_node_dsk(Grizzly.ZWave.node_id(), Grizzly.ZWave.DSK.t()) :: :ok

Store a node's DSK.

put_node_inclusion_info(node_id, info)

@spec put_node_inclusion_info(Grizzly.ZWave.node_id(), node_inclusion_info()) :: :ok

Stores information about a node's inclusion process.

put_node_info(node_id, info, opts \\ [])

@spec put_node_info(
  Grizzly.ZWave.node_id(),
  Grizzly.ZWave.Command.t() | node_info(),
  [
    put_node_info_opt()
  ]
) :: :ok

Stores node information.

By default, command classes are merged using CommandClasses.merge/2 to prevent loss of data due to Z/IP Gateway quirks. To force the use of the new command class list, use the :overwrite_command_classes option.

put_node_last_awake(node_id, last_awake)

@spec put_node_last_awake(Grizzly.ZWave.node_id(), DateTime.t()) :: :ok

Stores a node's last awake time.

put_node_wakeup_interval(node_id, interval)

@spec put_node_wakeup_interval(Grizzly.ZWave.node_id(), non_neg_integer()) :: :ok

Stores a node's wakeup interval in seconds.