Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split DatFile into multiple structs with specific purposes.
Now, instead of a general purpose DatFile that both reads and writes, there is DatFileReader and DatFileWriter. DatFile itself is now private and external consumers of this module only interact with the type necessary for the work their doing. Butterfly now owns a DatFileWriter, since that is primary what it does with this file. It creates a DatFileReader at startup to ingest existing rumors but doesn't hold onto this struct. rst-reader uses a DatFileReader, since that matches its reason for existing. Using this technique, only DatFileReader needs to hold onto the BufReader, which avoids the problem of atomically writing the file. Signed-off-by: Josh Black <raskchanky@gmail.com>
- Loading branch information
1 parent
bdcb816
commit 79e10ee
Showing
3 changed files
with
179 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.