LeviLamina
Loading...
Searching...
No Matches
FileStorageArea.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/file/FileAccessType.h"
7#include "mc/deps/core/file/WriteOperation.h"
8#include "mc/deps/core/file/file_system/TransactionFlags.h"
9#include "mc/deps/core/threading/BasicLockbox.h"
10#include "mc/deps/core/utility/NonOwnerPointer.h"
11
12// auto generated forward declare list
13// clang-format off
14namespace Bedrock::Threading { class Mutex; }
15namespace Core { class FileIndexLru; }
16namespace Core { class FileStats; }
17namespace Core { class FileSystemImpl; }
18namespace Core { class PathView; }
19namespace Core { class Result; }
20namespace Core { class StorageAreaStateListener; }
21namespace Core { class StorageAreasTree; }
22// clang-format on
23
24namespace Core {
25
26class FileStorageArea : public ::std::enable_shared_from_this<::Core::FileStorageArea> {
27public:
28 // FileStorageArea inner types declare
29 // clang-format off
31 // clang-format on
32
33 // FileStorageArea inner types define
34 enum class FlushableLevelDbEnvType : int {
35 None = 0,
36 InMemory = 1,
37 StorageArea = 2,
38 };
39
40 struct StorageAreaSpaceInfo {
41 public:
42 // member variables
43 // NOLINTBEGIN
48 // NOLINTEND
49
50 public:
51 // prevent constructor by default
52 StorageAreaSpaceInfo& operator=(StorageAreaSpaceInfo const&);
53 StorageAreaSpaceInfo(StorageAreaSpaceInfo const&);
54 StorageAreaSpaceInfo();
55 };
56
57public:
58 // member variables
59 // NOLINTBEGIN
77 // NOLINTEND
78
79public:
80 // prevent constructor by default
81 FileStorageArea& operator=(FileStorageArea const&);
82 FileStorageArea(FileStorageArea const&);
83 FileStorageArea();
84
85public:
86 // virtual functions
87 // NOLINTBEGIN
88 virtual ~FileStorageArea();
89
90 virtual ::std::unique_ptr<::Core::FileSystemImpl> createTransaction(::Core::FileAccessType) = 0;
91
92 virtual ::std::unique_ptr<::Core::FileSystemImpl>
93 createTransaction(::Core::FileAccessType fileAccessType, ::Core::TransactionFlags);
94
95 virtual bool supportsSizeQuery() const = 0;
96
97 virtual uint64 getTotalSize() const = 0;
98
99 virtual ::Core::Result getUsedSize(uint64&) = 0;
100
101 virtual void setUsedSizeOverride(uint64);
102
103 virtual void clearUsedSizeOverride();
104
105 virtual void notifyChangeInFileSize(int64 changeInSize, int64 changeInAllocatedSize);
106
107 virtual bool handlesPendingWrites() const;
108
109 virtual void informPendingWriteSize(uint64 numBytesWritePending, bool const fromResourcePack);
110
111 virtual uint64 estimatePendingWriteDiskSize(uint64 rawFileSize) const;
112
113 virtual void informStorageAreaCopy(uint64 storageAreaSize);
114
115 virtual bool supportsExtendSize() const;
116
117 virtual bool canExtendSize() const;
118
119 virtual void resetCanAttemptExtendSize();
120
121 virtual ::Core::Result getExtendSizeThreshold(uint64&) const;
122
123 virtual void attemptExtendSize(int64 const& currentFreeSpace, ::std::function<void()> onCompleteCallback);
124
125 virtual void preemptiveExtendSize(
126 uint64 const expectedContentSize,
127 ::std::function<void()> successCallback,
128 ::std::function<void()> failureCallback
129 );
130
131 virtual uint64 getAvailableUserStorageSize();
132
133 virtual void unloadFlatFileManifests(bool shouldClearManifests);
134
135 virtual void tick();
136
137 virtual void flushImmediately();
138
139 virtual void enableFlushToDisk(bool);
140
141 virtual void enableSequentialWrites(bool);
142
143 virtual bool checkCorrupt(bool handleCorruption);
144
145 virtual ::Bedrock::NonOwnerPointer<::Core::FileIndexLru> getFileIndexLru();
146
147 virtual ::Core::FileStorageArea::FlushableLevelDbEnvType getFlushableLevelDbEnvType() const;
148
149 virtual uint64 getTransactionWriteSizeLimit() const;
150
151 virtual ::Core::Result setSaveDataIcon(::Core::PathView);
152
153 virtual bool shouldAllowCommit() const;
154
155 virtual void trackBytesWritten(::Core::PathView targetPath, uint64 amount, ::Core::WriteOperation writeOperation);
156
157 virtual void trackWriteOperation(::Core::PathView targetPath, ::Core::WriteOperation writeOperation);
158
159 virtual ::Core::FileStorageArea::StorageAreaSpaceInfo getStorageAreaSpaceInfo();
160
161 virtual bool shouldRecordFileError(::Core::PathView, ::std::error_code) const;
162
163 virtual ::Core::Result _commit();
164
165 virtual ::Core::Result _onTransactionsEmpty(bool fromChild);
166
167 virtual void _onTeardown();
168 // NOLINTEND
169
170public:
171 // member functions
172 // NOLINTBEGIN
174 ::Core::FileAccessType type,
175 ::Core::PathView rootPath,
176 bool usesFlatFiles,
177 bool isAccessedDirectly,
178 ::std::shared_ptr<::Core::FileStorageArea> parent
179 );
180
181 MCNAPI void _addReadOperation(bool succeeded, uint64 numBytesRead);
182
183 MCNAPI void _addWriteOperation(bool succeeded, uint64 numBytesWritten);
184
185 MCNAPI void _beginTransaction(::Core::FileSystemImpl* pTransaction, bool fromChild);
186
187 MCNAPI ::Core::Result _endTransaction(::Core::FileSystemImpl* pTransaction, bool fromChild);
188
189 MCNAPI_C void addStateListener(::Core::StorageAreaStateListener* l);
190
191 MCNAPI bool canWrite() const;
192
193 MCNAPI void checkUserStorage();
194
196 // NOLINTEND
197
198public:
199 // static functions
200 // NOLINTBEGIN
201 MCNAPI static ::Core::Result
202 _getStorageAreaForPathImpl(::std::shared_ptr<::Core::FileStorageArea>& fileStorageArea, ::Core::PathView path);
203
204 MCNAPI_C static ::Core::Result
205 getStorageAreaForPath(::std::shared_ptr<::Core::FileStorageArea>& fileStorageArea, ::Core::PathView path);
206 // NOLINTEND
207
208public:
209 // static variables
210 // NOLINTBEGIN
211 MCNAPI static ::Bedrock::Threading::BasicLockbox<::std::vector<::Core::FileStats*>, ::Bedrock::Threading::Mutex>&
213
214 MCNAPI static ::Core::StorageAreasTree& sStorageAreas();
215 // NOLINTEND
216
217public:
218 // constructor thunks
219 // NOLINTBEGIN
220 MCNAPI void* $ctor(
221 ::Core::FileAccessType type,
222 ::Core::PathView rootPath,
223 bool usesFlatFiles,
224 bool isAccessedDirectly,
225 ::std::shared_ptr<::Core::FileStorageArea> parent
226 );
227 // NOLINTEND
228
229public:
230 // destructor thunk
231 // NOLINTBEGIN
232 MCNAPI void $dtor();
233 // NOLINTEND
234
235public:
236 // virtual function thunks
237 // NOLINTBEGIN
238 MCNAPI ::std::unique_ptr<::Core::FileSystemImpl>
239 $createTransaction(::Core::FileAccessType fileAccessType, ::Core::TransactionFlags);
240
241 MCNAPI void $setUsedSizeOverride(uint64);
242
244
245 MCNAPI void $notifyChangeInFileSize(int64 changeInSize, int64 changeInAllocatedSize);
246
247 MCNAPI bool $handlesPendingWrites() const;
248
249 MCNAPI void $informPendingWriteSize(uint64 numBytesWritePending, bool const fromResourcePack);
250
251 MCNAPI uint64 $estimatePendingWriteDiskSize(uint64 rawFileSize) const;
252
253 MCNAPI void $informStorageAreaCopy(uint64 storageAreaSize);
254
255 MCNAPI bool $supportsExtendSize() const;
256
257 MCNAPI bool $canExtendSize() const;
258
260
261 MCNAPI ::Core::Result $getExtendSizeThreshold(uint64&) const;
262
263 MCNAPI void $attemptExtendSize(int64 const& currentFreeSpace, ::std::function<void()> onCompleteCallback);
264
266 uint64 const expectedContentSize,
267 ::std::function<void()> successCallback,
268 ::std::function<void()> failureCallback
269 );
270
272
273 MCNAPI void $unloadFlatFileManifests(bool shouldClearManifests);
274
275 MCNAPI void $tick();
276
277 MCNAPI void $flushImmediately();
278
279 MCNAPI void $enableFlushToDisk(bool);
280
281 MCNAPI void $enableSequentialWrites(bool);
282
283 MCNAPI bool $checkCorrupt(bool handleCorruption);
284
285 MCNAPI ::Bedrock::NonOwnerPointer<::Core::FileIndexLru> $getFileIndexLru();
286
287 MCNAPI ::Core::FileStorageArea::FlushableLevelDbEnvType $getFlushableLevelDbEnvType() const;
288
289 MCNAPI uint64 $getTransactionWriteSizeLimit() const;
290
291 MCNAPI ::Core::Result $setSaveDataIcon(::Core::PathView);
292
293 MCNAPI bool $shouldAllowCommit() const;
294
295 MCNAPI void $trackBytesWritten(::Core::PathView targetPath, uint64 amount, ::Core::WriteOperation writeOperation);
296
297 MCNAPI void $trackWriteOperation(::Core::PathView targetPath, ::Core::WriteOperation writeOperation);
298
299 MCNAPI ::Core::FileStorageArea::StorageAreaSpaceInfo $getStorageAreaSpaceInfo();
300
301 MCNAPI bool $shouldRecordFileError(::Core::PathView, ::std::error_code) const;
302
303 MCNAPI ::Core::Result $_commit();
304
305 MCNAPI ::Core::Result $_onTransactionsEmpty(bool fromChild);
306
307 MCNAPI void $_onTeardown();
308
309
310 // NOLINTEND
311
312public:
313 // vftables
314 // NOLINTBEGIN
315 MCNAPI static void** $vftable();
316 // NOLINTEND
317};
318
319} // namespace Core
Definition Mutex.h:10
Definition FileIndexLru.h:13
Definition FileStats.h:7
MCAPI::Core::Result $setSaveDataIcon(::Core::PathView)
MCAPI void _addWriteOperation(bool succeeded, uint64 numBytesWritten)
MCAPI void $_onTeardown()
MCAPI void $trackWriteOperation(::Core::PathView targetPath, ::Core::WriteOperation writeOperation)
MCAPI void $clearUsedSizeOverride()
MCAPI::Core::FileStorageArea::StorageAreaSpaceInfo $getStorageAreaSpaceInfo()
MCAPI ::Bedrock::NonOwnerPointer<::Core::FileIndexLru > $getFileIndexLru()
MCAPI uint64 $getAvailableUserStorageSize()
MCAPI void $preemptiveExtendSize(uint64 const expectedContentSize, ::std::function< void()> successCallback, ::std::function< void()> failureCallback)
MCAPI void $informStorageAreaCopy(uint64 storageAreaSize)
MCAPI bool $shouldAllowCommit() const
MCAPI::Core::FileStorageArea::FlushableLevelDbEnvType $getFlushableLevelDbEnvType() const
MCAPI void $attemptExtendSize(int64 const &currentFreeSpace, ::std::function< void()> onCompleteCallback)
MCAPI::Core::Result _endTransaction(::Core::FileSystemImpl *pTransaction, bool fromChild)
MCAPI bool $shouldRecordFileError(::Core::PathView, ::std::error_code) const
MCAPI::Core::Result $getExtendSizeThreshold(uint64 &) const
MCAPI bool $canExtendSize() const
MCAPI void $informPendingWriteSize(uint64 numBytesWritePending, bool const fromResourcePack)
MCAPI::Core::Result $_commit()
MCAPI void $enableFlushToDisk(bool)
MCAPI bool canWrite() const
MCAPI void $setUsedSizeOverride(uint64)
MCAPI void $trackBytesWritten(::Core::PathView targetPath, uint64 amount, ::Core::WriteOperation writeOperation)
static MCAPI ::Core::StorageAreasTree & sStorageAreas()
MCAPI uint64 $estimatePendingWriteDiskSize(uint64 rawFileSize) const
MCAPI bool $handlesPendingWrites() const
MCAPI void $notifyChangeInFileSize(int64 changeInSize, int64 changeInAllocatedSize)
MCAPI void $flushImmediately()
MCAPI FileStorageArea(::Core::FileAccessType type, ::Core::PathView rootPath, bool usesFlatFiles, bool isAccessedDirectly, ::std::shared_ptr<::Core::FileStorageArea > parent)
MCAPI bool $checkCorrupt(bool handleCorruption)
MCAPI void * $ctor(::Core::FileAccessType type, ::Core::PathView rootPath, bool usesFlatFiles, bool isAccessedDirectly, ::std::shared_ptr<::Core::FileStorageArea > parent)
MCAPI::Core::Result $_onTransactionsEmpty(bool fromChild)
MCAPI void _beginTransaction(::Core::FileSystemImpl *pTransaction, bool fromChild)
static MCAPI void ** $vftable()
MCAPI void _addReadOperation(bool succeeded, uint64 numBytesRead)
MCAPI void $resetCanAttemptExtendSize()
MCAPI void $enableSequentialWrites(bool)
MCAPI uint64 $getTransactionWriteSizeLimit() const
MCAPI void removeStateListener(::Core::StorageAreaStateListener *l)
MCAPI void $unloadFlatFileManifests(bool shouldClearManifests)
MCAPI void checkUserStorage()
MCAPI ::std::unique_ptr<::Core::FileSystemImpl > $createTransaction(::Core::FileAccessType fileAccessType, ::Core::TransactionFlags)
static MCAPI ::Core::Result _getStorageAreaForPathImpl(::std::shared_ptr<::Core::FileStorageArea > &fileStorageArea, ::Core::PathView path)
static MCAPI ::Bedrock::Threading::BasicLockbox<::std::vector<::Core::FileStats * >, ::Bedrock::Threading::Mutex > & sStorageAreaFileStats()
MCAPI bool $supportsExtendSize() const
Definition FileSystemImpl.h:30
Definition PathView.h:17
Definition Result.h:11
Definition StorageAreaStateListener.h:16
Definition StorageAreasTree.h:16
Definition FileStorageArea.h:40
Definition Alias.h:14