I am wanting to persist values on my ESP32 devices running Jaguar.
$ jag version
Version: v1.7.1
SDK version: v2.0.0-alpha.33
Build date: 2022-10-15T18:12:13Z
The best I could find was this in the documentation: https://libs.toit.io/system/storage/class-Bucket.
However, when I try to run a program with the import statement:
import system.storage
I get the following traceback:
$ jag run main.toit
Running 'main.toit' on 'mqtt' ...
main.toit:1:1: error: Failed to find import 'system.storage'
import system.storage
^~~~~~
main.toit:1:15: note: Missing library file. Tried '<sdk>/system/storage.toit' and '<sdk>/system/storage/storage.toit'
import system.storage
^~~~~~~
Compilation failed.
Is this a Toit only library and not compatible with Jaguar? If it does work with Jaguar, am I using the wrong version, or do I need to install some additional package?
Or are Buckets even the right way to do this? I just need to persist simple values is there another way of doing this?
Jaguar 1.7.1 is too old for the storage
library. The current release of Jaguar (as of August 2023) is v1.10.0, which is roughly 10 months more recent.
The storage library was added with SDK v2.0.0-alpha.53, but v1.7.1 only ships with alpha-33. The current SDK release is alpha-90.
Buckets are the correct way to persist data on the device.