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