An implementation of a generic transactional stream for .NET, with support for writing changes to a journal file. The journal can then be committed, rolled back or replayed to ensure consistent writes.
Package | Nuget | Alpha |
---|---|---|
MBW.Utilities.Journal | Alpha |
Refer to this example in the tests: JournaledStreamExamples.cs.
- Turn any read/write stream into a journaled stream which guarantees that writes complete fully, or can be retried
- Easy codepath for using a file as the journal
- Exchangeable journal file implementation, so the journal can be written other places than in files
- If you have a database file or similar you want to protect, it is important to always wrap streams for that in JournalStreams. The reason being that if a write happens that isn't fully written to the file, it will not be noticed by future readers, if they don't also use JournalStreams
- It is recommended to create a producer in your app, that produces the stream (wrapped in JournalStreams) for your datafile centrally, so all users get the same behavior
- JournalStreams does not create the journal, until a write happens, so the cost of creating a JournalStreams is a file exists check (to see if a past journal existed)
- This is not thread safe in any manner, like all other streams