30class FileStorageArea :
public ::std::enable_shared_from_this<::Core::FileStorageArea> {
38 enum class FlushableLevelDbEnvType :
int {
44 struct StorageAreaSpaceInfo {
56 StorageAreaSpaceInfo& operator=(StorageAreaSpaceInfo
const&);
57 StorageAreaSpaceInfo(StorageAreaSpaceInfo
const&);
58 StorageAreaSpaceInfo();
64 ::ll::TypedStorage<8, 80, ::std::recursive_mutex> mLock;
65 ::ll::TypedStorage<8, 24, ::std::vector<::Core::FileSystemImpl*>> mAllTransactions;
66 ::ll::TypedStorage<1, 1, bool> mCanAttemptExtendSave;
67 ::ll::TypedStorage<1, 1, bool> mCachedFileUsageSize;
68 ::ll::TypedStorage<8, 64, ::Core::FileStats> mTransactionStats;
69 ::ll::TypedStorage<8, 64, ::Core::FileStats> mTotalStats;
70 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::Core::FileStorageArea>> mParent;
71 ::ll::TypedStorage<4, 4, ::Core::FileAccessType> mAccessType;
72 ::ll::TypedStorage<8, 32, ::Core::PathBuffer<::std::string>> mRootPath;
73 ::ll::TypedStorage<8, 24, ::std::vector<::Core::FileSystemImpl*>> mWriteTransactions;
74 ::ll::TypedStorage<8, 32, ::Core::Subject<::Core::FileStorageAreaObserver, ::Core::SingleThreadedLock>> mSubject;
75 ::ll::TypedStorage<8, 144, ::Core::StorageAreaState> mState;
76 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mFileIOSuspended;
77 ::ll::TypedStorage<8, 88, ::std::condition_variable_any> mResumeSignal;
78 ::ll::TypedStorage<1, 1, bool> mLoggingEnabled;
79 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::Core::FlatFileManifestTracker>> mManifestTracker;
80 ::ll::TypedStorage<1, 1, bool> mIsAccessedDirectly;
90 virtual ~FileStorageArea();
92 virtual ::std::unique_ptr<::Core::FileSystemImpl> createTransaction(::Core::FileAccessType accessType) = 0;
94 virtual ::std::unique_ptr<::Core::FileSystemImpl>
95 createTransaction(::Core::FileAccessType fileAccessType, ::Core::TransactionFlags);
97 virtual bool supportsSizeQuery()
const = 0;
99 virtual uint64 getTotalSize()
const = 0;
101 virtual ::Core::Result getUsedSize(uint64& outUsedSize) = 0;
103 virtual void setUsedSizeOverride(uint64 fileSize);
105 virtual void clearUsedSizeOverride();
107 virtual void notifyChangeInFileSize(int64 changeInSize, int64 changeInAllocatedSize);
109 virtual bool handlesPendingWrites()
const;
111 virtual void informPendingWriteSize(uint64,
bool const);
113 virtual uint64 estimatePendingWriteDiskSize(uint64 rawFileSize)
const;
115 virtual void informStorageAreaCopy(uint64);
117 virtual bool supportsExtendSize()
const;
119 virtual bool canExtendSize()
const;
121 virtual void resetCanAttemptExtendSize();
123 virtual ::Core::Result getExtendSizeThreshold(uint64& outExtendSizeThreshold)
const;
125 virtual void attemptExtendSize(int64
const& currentFreeSpace, ::std::function<
void()> onCompleteCallback);
127 virtual void preemptiveExtendSize(
128 uint64
const expectedContentSize,
129 ::std::function<
void()> successCallback,
130 ::std::function<
void()> failureCallback
133 virtual uint64 getAvailableUserStorageSize();
135 virtual void unloadFlatFileManifests(
bool shouldClearManifests);
141 virtual void enableFlushToDisk(
bool);
143 virtual void enableSequentialWrites(
bool);
145 virtual bool checkCorrupt(
bool);
147 virtual ::Bedrock::NonOwnerPointer<::Core::FileIndexLru> getFileIndexLru();
149 virtual ::Core::FileStorageArea::FlushableLevelDbEnvType getFlushableLevelDbEnvType()
const;
151 virtual uint64 getTransactionWriteSizeLimit()
const;
155 virtual bool shouldAllowCommit()
const;
157 virtual void trackBytesWritten(
::Core::PathView targetPath, uint64 amount, ::Core::WriteOperation writeOperation);
159 virtual void trackWriteOperation(
::Core::PathView targetPath, ::Core::WriteOperation writeOperation);
161 virtual ::Core::FileStorageArea::StorageAreaSpaceInfo getStorageAreaSpaceInfo();
163 virtual bool shouldRecordFileError(
::Core::PathView path, ::std::error_code error)
const;
165 virtual ::Core::Result _commit();
167 virtual ::Core::Result _onTransactionsEmpty(
bool);
169 virtual void _onTeardown();
176 ::Core::FileAccessType type,
179 bool isAccessedDirectly,
180 ::std::shared_ptr<::Core::FileStorageArea> parent
201 MCNAPI static ::Core::Result
205 MCNAPI
static void tickStorageAreas();
212 MCNAPI static ::Bedrock::Threading::BasicLockbox<::std::vector<::Core::FileStats*>, ::std::mutex>&
222 ::Core::FileAccessType type,
225 bool isAccessedDirectly,
226 ::std::shared_ptr<::Core::FileStorageArea> parent
239 MCNAPI ::std::unique_ptr<::Core::FileSystemImpl>
264 MCNAPI
void $attemptExtendSize(int64
const& currentFreeSpace, ::std::function<
void()> onCompleteCallback);
267 uint64
const expectedContentSize,
268 ::std::function<
void()> successCallback,
269 ::std::function<
void()> failureCallback