User Tools

Site Tools


soft:node-persistent-data

Node persistent data

This document describes a proposal for the storage of persistent data sets (like basic node configuration and state) to be shared across node images. Several versions of each data set can be stored in the node, with each version having a (monotonically increasing) serial number. For each data set there is one version selected as the current one.

Storage

This mechanism relies on the existence of a system partition as described in Node storage layout. The partition shall contain:

confine/persist-v1/
The different persistent data sets, arranged according to the format defined in version 1 of this specification.
confine/persist-v1/conf.SERIAL/
A directory with the node's persistent configuration files, with a given SERIAL number.
confine/persist-v1/conf -> conf.SERIAL1
A symbolic link pointing to the current persistent configuration.
confine/persist-v1/state.SERIAL/
A directory with the node's persistent state files, with a given SERIAL number.
confine/persist-v1/state -> conf.SERIAL2
A symbolic link pointing to the current persistent state.

Programs

confine-node-persist

This program manages persistent data sets in the node. It offers the following commands:

help
Print program help to standard output and exit successfully.
list [DATA_SET]…
List the stored versions of each DATA_SET.

For each stored version of the DATA_SET, a line is printed showing the name of the data set and its serial number. A field containing the string current is appended to the line of the version selected as the current one for that data set. Fields in the line are whitespace-separated.

If some specified DATA_SET does not exist, no data set is listed and the program returns an error code.

If no DATA_SET is specified, all data sets are listed.
load [SERIAL [DATA_SET]…]
Load the specified SERIAL number version of each DATA_SET.

If no such SERIAL number version exists for some specified DATA_SET, or the DATA_SET itself does not exist, no data set is loaded and the program returns an error code. If some (existing) data set fails to be loaded, the program still tries to load the rest of data sets and returns an error code.

The string current can be specified as a SERIAL number to use the current version of each data set. If the SERIAL number is not specified, current is used.

If no DATA_SET is specified, the specified serial number version of all data sets is loaded.
store [DATA_SET]…
Store a new version of each DATA_SET and print the serial number.

All the specified data sets are stored with the same serial number. If some data set failed to be stored, the program returns an error code but the successfully stored data sets are still kept and the serial number printed, so they are not accidentally lost.

If some specified DATA_SET does not exist, no data set is stored and the program returns an error code.

If no DATA_SET is specified, all data sets are stored.

The serial number has the format YYYYMMDDNN. It is computed as the UTC date of the node plus 00, but it is also ensured to be monotonically increasing, i.e. if the computed number is not greater than the greatest serial of the DATA_SET (or all the data sets when using all), then the latter is increased by one and used instead. This allows storing several versions per day and avoids problems with non-working clocks.
delete SERIAL [DATA_SET]…
Delete the specified SERIAL number version of each DATA_SET.

If some specified DATA_SET does not exist, no data set is deleted and the program returns an error code. If the version to be deleted happens to be the current one for a data set, or if some (existing) data set fails to be deleted, the program still tries to delete the rest of data sets and returns an error code.

If no DATA_SET is specified, the specified serial number version of all data sets is deleted.
select-current SERIAL [DATA_SET]…
Select the specified SERIAL number version of each DATA_SET as current.

If no such SERIAL number version exists for some specified DATA_SET, or the DATA_SET itself does not exist, no data set has its current version changed and the program returns an error code. If the version of some (existing) data set fails to be selected, the program still tries to change the current version of the rest of data sets and returns an error code.

If no DATA_SET is specified, the current version of all data sets is changed.
This program works by mounting the system filesystem, operating on data sets, and finally unmounting that filesystem. Load and store operations may be delegated to helper programs specific to data sets.

soft/node-persistent-data.txt · Last modified: 2014/12/29 11:41 by ivilata