class

Matter::Storage::JsonFileBackend

Inherits Matter::Storage::Base < Reference < Object

A simple JSON file backed storage implementation.

Persists the same context-key model as MemoryBackend to a single JSON file. This is intended as a low-friction default for devices/examples and as the foundation for future DB-backed implementations.

Constants

TYPE_FIELD = "__type__"

Root JSON keys used to preserve non-JSON-native types

VALUE_FIELD = "value"

Constructors

new(path : String = "matter_storage.json")
Source

Instance methods

clear

Clears all stored contexts and keys.

Source
clear_all(contexts : Array(String)) : Nil
Source
contexts(contexts : Array(String)) : Array(String)

Get list of immediate subcontext names

Source
delete(contexts : Array(String), key : String) : Nil
Source
get(contexts : Array(String), key : String) : Type
Source
initialized?
Source
keys(contexts : Array(String)) : Array(String)
Source
path
Source
set(contexts : Array(String), key : String, value : Type) : Nil
Source
set(contexts : Array(String), values : Hash(String, Type)) : Nil

Set multiple key-value pairs at once

Source
start
Source
stop
Source
values(contexts : Array(String)) : Hash(String, Type)

Get all key-value pairs in a context

Source