NetworkTables Persistence Specification

Is there a specification on how persistent entries in NetworkTables are to be saved on the server? Or is it up to the server to decide how to format the file containing the saved entries? The NetworkTables specification only briefly mentions persistent entries. I skimmed through what looks like the relevant CPP file but would rather not reverse engineer it.

We specified it but I didn’t get it ported from our working Google Doc to the design spec on GitHub. If I did it now, I would just use JSON, but hindsight is 20/20.

Persistent Storage Format

The format is a INI-style text format. The primary difference from normal INI files is that the values are typed and names are double-quoted and escaped. The file may use DOS or Unix style line endings.

The first line of the file shall be exactly:

[NetworkTables Storage 3.0]

The server shall always write this as the first line of the file.

The server shall reject a persistent entries file that does not start with this line.

Subsequent lines shall be of the format:

<type> <name>=<value>

or, for array types,

<type> <name>=<value>,<value> ...

<type> shall be formatted as per the following table. The server shall ignore lines that do not start with one of these types.

NetworkTables Type <type>
Boolean boolean
Double double
String string
Raw Data raw
Boolean Array array boolean
Double Array array double
String Array array string

<name> is formatted per String format for <value>. Note this means that it is always double-quoted.

<value>s shall be formatted as per the following table.

NetworkTables Type <value> formatting
Boolean true or false
Double Per C %g format (shorter of decimal and scientific notation)
String C source code style (escaped string). The string contents are surrounded by double quotes, and special characters are escaped using backslash (including double quotes; backslash is represented using two sequential backslashes).
Raw Data Base64-encoded (no line breaks)
Boolean Array Comma separated list; see Boolean for formatting of each in the list.
Double Array Comma separated list; see Double for formatting of each <value> in the list.
String Array Comma separated list; see String for formatting of each <value> in the list.
3 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.