Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lordmike/mbw.utilities.journal
A Stream implementation with a journal that tracks changes. Allows Commit, Rollback and Replay to provide guaranteed writes.
https://github.com/lordmike/mbw.utilities.journal
journal transaction
Last synced: about 11 hours ago
JSON representation
A Stream implementation with a journal that tracks changes. Allows Commit, Rollback and Replay to provide guaranteed writes.
- Host: GitHub
- URL: https://github.com/lordmike/mbw.utilities.journal
- Owner: LordMike
- Created: 2024-09-13T08:40:52.000Z (about 2 months ago)
- Default Branch: master
- Last Pushed: 2024-11-04T20:42:54.000Z (1 day ago)
- Last Synced: 2024-11-04T21:32:23.302Z (1 day ago)
- Topics: journal, transaction
- Language: C#
- Homepage:
- Size: 65.4 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
## MBW.Utilities.Journal [![Generic Build](https://github.com/LordMike/MBW.Utilities.Journal/actions/workflows/dotnet.yml/badge.svg)](https://github.com/LordMike/MBW.Utilities.Journal/actions/workflows/dotnet.yml) [![NuGet](https://img.shields.io/nuget/v/MBW.Utilities.Journal.svg)](https://www.nuget.org/packages/MBW.Utilities.Journal)
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.
## Packages
| Package | Nuget | Alpha |
| ------------- |:----------------------------------------------------------------------------------------------------------------------------------------------------:|:-------------:|
| MBW.Utilities.Journal | [![NuGet](https://img.shields.io/nuget/v/MBW.Utilities.Journal.svg)](https://www.nuget.org/packages/MBW.Utilities.Journal) | [Alpha](https://github.com/LordMike/MBW.Utilities.Journal/packages/692005) |## How to use
Refer to this example in the tests: [JournaledStreamExamples.cs](src/MBW.Utilities.Journal.Tests/JournaledStreamExamples.cs).
### Features
* 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## Notes
* 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