Class TransitionsJournal
- Namespace
- Foundation.Data.Doublets.Cli
- Assembly
- Foundation.Data.Doublets.Cli.dll
The append-only journal file clink keeps next to its database
(issue #195), and the one-time import of the older links-backed journal:
rust/src/transactions/journal_file.rs.
public static class TransitionsJournal
- Inheritance
-
TransitionsJournal
- Inherited Members
Remarks
Older versions stored each journal entry as the name of a fresh link in
<db>.transitions.links (plus
<db>.transitions.names.links). Every invocation re-read that
whole store, so each write got slower as the history grew. The journal is
now a plain text file, <db>.transitions.log, that a write
appends to. Opening the journal imports a legacy store once: its entries
are written to a temporary file that is synced and renamed into place
before the legacy files are removed, so a crash leaves either the legacy
store or a complete journal. An explicit --transactions-file that
still holds a links store is converted in place the same way.
Methods
ImportLinksJournal(string, string, bool)
Copies every entry of the links-backed journal at legacy
into the text journal at target, then removes the
legacy store. Returns whether anything was imported.
public static bool ImportLinksJournal(string legacy, string target, bool trace = false)
Parameters
Returns
Remarks
When target already exists (a crash after
publishing it), the legacy store is removed only if each of its
entries is already in target.
IsLinksJournal(string)
Whether path holds something other than a text
journal: a non-empty file whose first bytes are not (a prefix of) the
journal entry prefix.
public static bool IsLinksJournal(string path)
Parameters
pathstring
Returns
MakeLegacyTransitionsFilename(string)
Path of the links-backed journal older versions kept: <stem>.transitions.links.
public static string MakeLegacyTransitionsFilename(string databaseFilename)
Parameters
databaseFilenamestring
Returns
MakeTransitionsLogFilename(string)
Conventional journal path: <stem>.transitions.log next to the database.
public static string MakeTransitionsLogFilename(string databaseFilename)
Parameters
databaseFilenamestring
Returns
Open(string, string?, bool)
Opens the journal of database: explicitPath
when given, the conventional <stem>.transitions.log otherwise,
importing a legacy links-backed journal first.
public static FileTransitionLog Open(string database, string? explicitPath, bool trace = false)