55 ::ll::TypedStorage<8, 112, ::leveldb::Options> options;
56 ::ll::TypedStorage<8, 24, ::leveldb::ReadOptions> read;
57 ::ll::TypedStorage<1, 1, ::leveldb::WriteOptions> write;
65 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::std::string const>> mLatestValue;
66 ::ll::TypedStorage<1, 1, bool> mIsDeleted;
86 ::ll::TypedStorage<8, 8, ::std::atomic<int>*> mRefCounter;
106 ::ll::TypedStorage<8, 32, ::std::string> mKey;
107 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::std::string>> mValue;
108 ::ll::TypedStorage<4, 4, ::DBHelpers::Category> mCategory;
109 ::ll::TypedStorage<1, 1, bool> mIsDelete;
128 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::DBStorageEnvironmentChain>> mEnvChain;
129 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::leveldb::Cache>> mCache;
130 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::leveldb::FilterPolicy const>> mFilterPolicy;
131 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::DBStorage::Options>> mOptions;
132 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::leveldb::DecompressAllocator>> mDecompressAllocator;
133 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::leveldb::DB>> mDb;
134 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::TaskGroup>> mIOTaskGroup;
135 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::TaskGroup>> mCompactionTaskGroup;
136 ::ll::TypedStorage<8, 16, ::Bedrock::Threading::Async<void>> mCompactionTask;
137 ::ll::TypedStorage<8, 16, ::Bedrock::Threading::Async<void>> mWriteTask;
138 ::ll::TypedStorage<8, 40, ::Core::LevelStorageResult> mState;
139 ::ll::TypedStorage<8, 8, ::ContentIdentity const*> mContentIdentity;
140 ::ll::TypedStorage<8, 32, ::Core::PathBuffer<::std::string>> mFullPath;
141 ::ll::TypedStorage<8, 32, ::Core::PathBuffer<::std::string>> mDbPath;
142 ::ll::TypedStorage<8, 32, ::std::string> mLevelId;
143 ::ll::TypedStorage<8, 80, ::Bedrock::Threading::Mutex> mCompactionMutex;
144 ::ll::TypedStorage<8, 8, ::std::shared_mutex> mWriteCacheMutex;
145 ::ll::TypedStorage<8, 80, ::Bedrock::Threading::Mutex> mCacheFlushMutex;
146 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastCompactionStartTime;
147 ::ll::TypedStorage<8, 8, ::std::chrono::nanoseconds> mCompactionInterval;
148 ::ll::TypedStorage<8, 8, ::std::chrono::nanoseconds> mWriteFlushInterval;
149 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mAllowFlush;
150 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mSavingInProgress;
151 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mSnapshotInProgress;
152 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mShutdownStarted;
153 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mNoMoreWrites;
154 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mShutdownDone;
155 ::ll::TypedStorage<4, 4, ::std::atomic<int>> mOutstandingJobs;
156 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::SaveTransactionManager>> mSaveTransactionManager;
157 ::ll::TypedStorage<8, 64, ::std::function<void()>> mCriticalSyncSaveCallback;
158 ::ll::TypedStorage<8, 64, ::std::function<void(::CompactionStatus)>> mExternallyRegisteredCompactionCallback;
164 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::LevelStorageObserver>>> mObservers;
165 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mDestructorInProgress;
166 ::ll::TypedStorage<1, 1, bool> mForceCorrupt;
167 ::ll::TypedStorage<1, 1, bool const> mStorageEnabled;
168 ::ll::TypedStorage<8, 32, ::Core::PathBuffer<::std::string>> mDbSubfolder;
169 ::ll::TypedStorage<8, 128, ::LevelStorageWriteBatch> mSingleKeyWrites;
170 ::ll::TypedStorage<8, 24, ::std::vector<::LevelStorageWriteBatch>> mBatchWrites;
171 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::LevelStorageEventing>> mEventing;
172 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::LevelDbEnv>> mLevelDbEnv;
173 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::DBStorageFolderWatcher>>> mFolderTelemetryWatcher;
174 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mNextSizeTelemetryCaptureTime;
175 ::ll::TypedStorage<8, 8, ::std::chrono::nanoseconds const> mSizeTelemetryCaptureInterval;
176 ::ll::TypedStorage<8, 192, ::DBStoragePerformanceTelemetry> mDBStoragePerformanceTelemetry;
190 virtual void addStorageObserver(::std::unique_ptr<::LevelStorageObserver> observer) ;
193 virtual bool loadedSuccessfully() const ;
196 virtual ::Core::LevelStorageResult getState() const ;
200 createChunkStorage(::
std::unique_ptr<::
ChunkSource> generator, ::StorageVersion) ;
203 virtual ::Core::PathBuffer<::
std::
string> const& getFullPath() const ;
206 virtual ::
std::unique_ptr<::
CompoundTag> getCompoundTag(::
std::
string const&, ::DBHelpers::Category) ;
209 virtual
bool hasKey(::
std::string_view, ::DBHelpers::Category) const ;
212 virtual
bool loadLevelData(::
LevelData& data) ;
215 virtual
void saveLevelData(::
LevelData const& levelData) ;
218 virtual ::Bedrock::Threading::Async<
void>
219 saveData(::
std::
string const&, ::
std::
string&&, ::DBHelpers::Category) ;
225 virtual ::Bedrock::Threading::Async<
void> deleteData(::
std::
string const&, ::DBHelpers::Category) ;
228 virtual
bool loadData(::
std::string_view key, ::
std::
string&
buffer, ::DBHelpers::Category category) const
232 virtual
void forEachKeyWithPrefix(
234 ::DBHelpers::Category,
235 ::
std::function<
void(::
std::string_view, ::
std::string_view)> const&
239 virtual ::Core::LevelStorageResult getLevelStorageState() const ;
245 virtual
void startShutdown() ;
248 virtual
bool isShuttingDown() const ;
251 virtual
bool checkShutdownDone() ;
254 virtual
void getStatistics(::
std::
string& outStats, ::
LevelStorage::StatsType statsType) const ;
258 createSnapshot(::
std::
string const& filePrefix,
bool flushWriteCache) ;
261 virtual
void releaseSnapshot() ;
264 virtual ::Bedrock::Threading::Async<
void> compactStorage() ;
267 virtual
void syncAndSuspendStorage() ;
270 virtual
void resumeStorage() ;
273 virtual
void setFlushAllowed(
bool flushAllowed) ;
276 virtual
void flushToPermanentStorage() ;
279 virtual
void freeCaches() ;
282 virtual
void setCompactionCallback(::
std::function<
void(::CompactionStatus)> callback) ;
285 virtual
void setCriticalSyncSaveCallback(::
std::function<
void()> callback) ;
293 MCAPI ::
TaskResult _flushWriteCacheToLevelDB();
297 MCAPI ::
std::
string _getTelemetryMessage(::leveldb::Status const& status) const;
299 MCAPI
void _handleErrorStatus(::leveldb::Status const& status);
301 MCAPI
void _markAsCorrupted(::
std::string_view message) const;
305 MCAPI
void _mergeIntoWriteCache(::
std::
string const& key, ::
std::
string&& data, ::DBHelpers::Category category);
307 MCAPI
void _queueSaveCallback(
bool invokeImmediately);
310 ::
std::string_view prefix,
311 ::DBHelpers::Category category,
312 ::
std::function<
void(::
std::string_view, ::
std::string_view)> const& callback
316 _readPendingWrite(::
std::
string const& key, ::DBHelpers::Category category) const;
318 MCAPI
void _scheduleNextAutoCompaction();
320 MCAPI
bool _suspendAndPerformSaveAction(
321 ::brstd::move_only_function<::
TaskResult()> action,
322 ::brstd::move_only_function<
void()> callback
325 MCAPI
bool tryRepair(::Core::
Path const& path) const;
345 MCFOLD
bool $loadedSuccessfully() const;
347 MCFOLD ::Core::LevelStorageResult $getState() const;
350 $createChunkStorage(::
std::unique_ptr<::
ChunkSource> generator, ::StorageVersion);
352 MCAPI ::Core::PathBuffer<::
std::
string> const& $getFullPath() const;
354 MCAPI
bool $loadLevelData(::
LevelData& data);
356 MCAPI
void $saveLevelData(::
LevelData const& levelData);
360 MCFOLD ::Core::LevelStorageResult $getLevelStorageState() const;
364 MCAPI
void $startShutdown();
366 MCAPI
bool $isShuttingDown() const;
368 MCAPI
bool $checkShutdownDone();
370 MCAPI
void $getStatistics(::
std::
string& outStats, ::
LevelStorage::StatsType statsType) const;
373 $createSnapshot(::
std::
string const& filePrefix,
bool flushWriteCache);
375 MCAPI
void $releaseSnapshot();
377 MCAPI ::Bedrock::Threading::Async<
void> $compactStorage();
379 MCAPI
void $syncAndSuspendStorage();
381 MCFOLD
void $resumeStorage();
383 MCAPI
void $setFlushAllowed(
bool flushAllowed);
385 MCAPI
void $flushToPermanentStorage();
387 MCAPI
void $freeCaches();
389 MCAPI
void $setCompactionCallback(::
std::function<
void(::CompactionStatus)> callback);
391 MCAPI
void $setCriticalSyncSaveCallback(::
std::function<
void()> callback);