|
NetBurner 3.5.8
PDF Version |
Example Path: examples/Configuration/Application/AppData/FS_BulkStore
This example demonstrates the config_fs_bulkstore configuration object. A bulkstore behaves like an ordinary configuration value – you read and write it through the Configuration system – but its contents are stored in a file on the EFFS Std filesystem instead of in the (size-limited) configuration blob.
That makes it useful for data that is too large for the normal config space, or that you simply do not want to consume config space with: certificates, key blobs, large JSON documents, calibration tables, and so on. The data is still managed, versioned, and persisted through the same Configuration tooling as every other config value.
Two bulkstore objects are declared at global scope in main.cpp:
Constructor arguments:
appdata node)On startup the application:
You can set and read the bulkstore values two ways:
MyBulkStore / MyMovableBulkStore values under the appdata node. The value you enter is written to the backing file on the filesystem.help for the list of commands.To confirm the data actually landed on the filesystem, use the file commands below.
In addition to the standard Configuration commands, this example registers three filesystem helpers (see console_cmds.cpp):
cat <file_path> – print the contents of a file. For example, after setting MyBulkStore, run cat /MyBulkStore.bin to see the stored bytes.rm <file_path> – delete a file from the filesystem.fsls – list every file and directory on the filesystem as a tree.The example includes a small reusable command-line argument parser (argparse.cpp / argparse.h) used by the console commands. It supports positional string arguments, quoted arguments (single and double quotes), backslash escapes, and optional flags, and reports descriptive errors for missing or malformed arguments.
-cflag C:3); on the ColdFire parts it reserves a 1 MB region for EFFS Std.