Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

STORAGE Types

The STORAGE clause in the SELECT command, and the SUBSTRAT directive, accept one of the following identifiers. Each maps to a specific data-accessor class in the implementation.

Type table

KeywordC++ classRetentionShadowPurpose
DEFAULTgroupFile<posixBinaryFileWithShadow>yesyesDefault production mode; a .shadow file protects modifications
DIRECTgroupFile<posixBinaryFile>yesnoRetention without shadow protection
MEMORYmemoryFileyes (RAM)noData in memory only; circular buffer, never written to disk
POSIXposixBinaryFilenonoA single binary file; no retention
POSIXSHDposixBinaryFileWithShadownoyesA single file with shadow protection; no retention
GENERICgenericBinaryFilenonoGeneric binary file
DEVICEbinaryDeviceROnonoBinary device; read-only; looping depends on ONESHOT
TEXTSOURCEtextSourceROnonoText file; read-only; looping depends on ONESHOT

Retention — artifacts are rotated, older files are deleted automatically (requires RETENTION on SELECT).
Shadow — every modification is written to a separate .shadow file; historical data is protected from being overwritten.

For MEMORY, retention works in memory as a circular buffer: successive appends overwrite the oldest slot (index % capacity). Data is not segmented into files and never reaches disk.

NOTE: The MEMORY type (SUBSTRAT ‘memory’) is covered by the tests: issue61_tmpmem (serial and parallel), described in the appendix Integration Tests.

When to use which

The choice depends on the environment’s requirements:

  • Production environment, critical dataDEFAULT (retention + shadow)
  • Production environment, historically insignificant dataMEMORY (zero disk usage, retention in RAM)
  • Development and debuggingDEFAULT or DIRECT (data visible on disk)
  • Reading from a device or a text fileDEVICE / TEXTSOURCE (respectively)

Example

SELECT str1[0] STREAM str1 FROM core0 STORAGE MEMORY
SELECT str2[0] STREAM str2 FROM core0 RETENTION 100 STORAGE DIRECT

For substrates globally — the SUBSTRAT directive:

SUBSTRAT 'memory'