1. Introduction
...
crcPath
is used to store the CRC of the on-disk storage file. As CRC is a linear function, it is possible to recompute CRC after changing a part of the file by xoring the old value of CRC with the old part of the file and the new part of the file (i.e. newCrc = oldCrc ⊕ crc(oldPart) ⊕ crc(newPart)
). The file can be updated atomically by writing the new CRC value to a temporary file and replacing the old CRC file with a new one since renaming is an atomic operation. CRC file is used to detect corrupted data after a system crash.
...
LatestMessagesFileStorage
will be initialized in NodeRuntime.main
using the provided configuration. As SafetyOracle
depends on latest messages data structure, it will have to be initialized after LatestMessagesFileStorage
.
3.5 Operational aspects
3.5.1 Metrics
LatestMessagesFileStorage
will export the following metrics by reusing the existing class coop.rchain.metrics.Metrics
:
- Accessing the in-memory representation map by invoking
access
method will be reported with name"latest-messages-file-storage-access"
. - Appending a new key-value pair to the data file by invoking
insert
method will be reported with name"latest-messages-file-storage-insert"
. - Overwriting the value of an existing key-value pair in the data file by invoking
insert
method will be reported with name"latest-messages-file-storage-update"
.
By using this metrics data one could determine how often lookups/updates/inserts are performed by node.
3.5.2 Logs
LatestMessagesFileStorage
will not log anything.
3.6 Global software control
Both lookups and inserts/updates require acquiring the lock and are hence mutually exclusive. On the other hand, doing a bulk of lookups still requires taking only a single lock by using the access
method.
3.
...
7 Boundary conditions
- On node startup on-disk storage file is read into memory. In-memory representation and in-memory index are built from the read data.
- On node shutdown no additional actions are required as the system is always fully synchronized
- In case of node error, on startup the storage file is checked for corruptions by comparing the CRC to the actual check value of the storage file. In case of a corruption, the file is rebuilt from scratch using the information from persisted DAG.
...