aboutsummaryrefslogtreecommitdiff
path: root/src/flatfile.h
diff options
context:
space:
mode:
authorJim Posen <jim.posen@gmail.com>2019-01-06 10:14:35 -0800
committerJim Posen <jim.posen@gmail.com>2019-02-22 17:38:45 -0800
commite0380933e3745214331d358bda8c5e79299c84d2 (patch)
treeb3dc6b1ad203e1c19b7beceae88e9b3131e4025d /src/flatfile.h
parent992404b31ed2f8cabeed59d074552f0ae10fda94 (diff)
downloadbitcoin-e0380933e3745214331d358bda8c5e79299c84d2.tar.xz
validation: Refactor file flush logic into FlatFileSeq.
Diffstat (limited to 'src/flatfile.h')
-rw-r--r--src/flatfile.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/flatfile.h b/src/flatfile.h
index 1b5d83e8e6..eea41ddf84 100644
--- a/src/flatfile.h
+++ b/src/flatfile.h
@@ -45,6 +45,15 @@ public:
* @return The number of bytes successfully allocated.
*/
size_t Allocate(const CDiskBlockPos& pos, size_t add_size, bool& out_of_space);
+
+ /**
+ * Commit a file to disk, and optionally truncate off extra pre-allocated bytes if final.
+ *
+ * @param[in] pos The first unwritten position in the file to be flushed.
+ * @param[in] finalize True if no more data will be written to this file.
+ * @return true on success, false on failure.
+ */
+ bool Flush(const CDiskBlockPos& pos, bool finalize = false);
};
#endif // BITCOIN_FLATFILE_H