aboutsummaryrefslogtreecommitdiff
path: root/src/flatfile.h
diff options
context:
space:
mode:
authorJim Posen <jim.posen@gmail.com>2019-01-06 11:27:31 -0800
committerJim Posen <jim.posen@gmail.com>2019-02-22 17:38:45 -0800
commit992404b31ed2f8cabeed59d074552f0ae10fda94 (patch)
tree3213de9eb432c4ce86c87970dd2bde8905d1042d /src/flatfile.h
parente2d2abb99fe353ffc2ff3bc1ff578fad31065335 (diff)
validation: Refactor block file pre-allocation into FlatFileSeq.
Diffstat (limited to 'src/flatfile.h')
-rw-r--r--src/flatfile.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/flatfile.h b/src/flatfile.h
index b1eea93140..1b5d83e8e6 100644
--- a/src/flatfile.h
+++ b/src/flatfile.h
@@ -34,6 +34,17 @@ public:
/** Open a handle to the file at the given position. */
FILE* Open(const CDiskBlockPos& pos, bool fReadOnly = false);
+
+ /**
+ * Allocate additional space in a file after the given starting position. The amount allocated
+ * will be the minimum multiple of the sequence chunk size greater than add_size.
+ *
+ * @param[in] pos The starting position that bytes will be allocated after.
+ * @param[in] add_size The minimum number of bytes to be allocated.
+ * @param[out] out_of_space Whether the allocation failed due to insufficient disk space.
+ * @return The number of bytes successfully allocated.
+ */
+ size_t Allocate(const CDiskBlockPos& pos, size_t add_size, bool& out_of_space);
};
#endif // BITCOIN_FLATFILE_H