54 ::ll::TypedStorage<8, 32, ::std::string> mKey;
55 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::std::string>> mValue;
56 ::ll::TypedStorage<4, 4, ::DBHelpers::Category> mCategory;
57 ::ll::TypedStorage<1, 1, bool> mIsDelete;
65 ::ll::TypedStorage<8, 8, ::std::atomic<int>*> mRefCounter;
73 ::ll::TypedStorage<8, 112, ::leveldb::Options> options;
74 ::ll::TypedStorage<8, 24, ::leveldb::ReadOptions> read;
75 ::ll::TypedStorage<1, 1, ::leveldb::WriteOptions> write;
83 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::std::string const>> mLatestValue;
84 ::ll::TypedStorage<1, 1, bool> mIsDeleted;
91 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::DBStorageEnvironmentChain>> mEnvChain;
92 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::leveldb::Cache>> mCache;
93 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::leveldb::FilterPolicy const>> mFilterPolicy;
94 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::DBStorage::Options>> mOptions;
95 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::leveldb::DecompressAllocator>> mDecompressAllocator;
96 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::leveldb::DB>> mDb;
97 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::TaskGroup>> mIOTaskGroup;
98 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::TaskGroup>> mCompactionTaskGroup;
99 ::ll::TypedStorage<8, 16, ::Bedrock::Threading::Async<void>> mCompactionTask;
100 ::ll::TypedStorage<8, 16, ::Bedrock::Threading::Async<void>> mWriteTask;
101 ::ll::TypedStorage<8, 40, ::Core::LevelStorageResult> mState;
102 ::ll::TypedStorage<8, 8, ::ContentIdentity const*> mContentIdentity;
103 ::ll::TypedStorage<8, 32, ::Core::PathBuffer<::std::string>> mFullPath;
104 ::ll::TypedStorage<8, 32, ::Core::PathBuffer<::std::string>> mDbPath;
105 ::ll::TypedStorage<8, 32, ::std::string> mLevelId;
106 ::ll::TypedStorage<8, 80, ::std::mutex> mCompactionMutex;
107 ::ll::TypedStorage<8, 8, ::std::shared_mutex> mWriteCacheMutex;
108 ::ll::TypedStorage<8, 80, ::std::mutex> mCacheFlushMutex;
109 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastCompactionStartTime;
110 ::ll::TypedStorage<8, 8, ::std::chrono::nanoseconds> mCompactionInterval;
111 ::ll::TypedStorage<8, 8, ::std::chrono::nanoseconds> mWriteFlushInterval;
112 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mAllowFlush;
113 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mSavingInProgress;
114 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mSnapshotInProgress;
115 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mShutdownStarted;
116 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mNoMoreWrites;
117 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mShutdownDone;
118 ::ll::TypedStorage<4, 4, ::std::atomic<int>> mOutstandingJobs;
119 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::SaveTransactionManager>> mSaveTransactionManager;
120 ::ll::TypedStorage<8, 64, ::std::function<void()>> mCriticalSyncSaveCallback;
121 ::ll::TypedStorage<8, 64, ::std::function<void(::CompactionStatus)>> mExternallyRegisteredCompactionCallback;
127 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::LevelStorageObserver>>> mObservers;
128 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mDestructorInProgress;
129 ::ll::TypedStorage<1, 1, bool> mForceCorrupt;
130 ::ll::TypedStorage<1, 1, bool const> mStorageEnabled;
131 ::ll::TypedStorage<1, 1, bool const> mJigsawPersistenceToggle;
132 ::ll::TypedStorage<8, 32, ::Core::PathBuffer<::std::string>> mDbSubfolder;
133 ::ll::TypedStorage<8, 128, ::LevelStorageWriteBatch> mSingleKeyWrites;
134 ::ll::TypedStorage<8, 24, ::std::vector<::LevelStorageWriteBatch>> mBatchWrites;
135 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::LevelStorageEventing>> mEventing;
136 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::LevelDbEnv>> mLevelDbEnv;
137 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::DBStorageFolderWatcher>>> mFolderTelemetryWatcher;
138 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mNextSizeTelemetryCaptureTime;
139 ::ll::TypedStorage<8, 8, ::std::chrono::nanoseconds const> mSizeTelemetryCaptureInterval;
140 ::ll::TypedStorage<8, 192, ::DBStoragePerformanceTelemetry> mDBStoragePerformanceTelemetry;
150 virtual ~DBStorage() =
default;
152 virtual void addStorageObserver(::std::unique_ptr<::LevelStorageObserver> observer) ;
154 virtual bool loadedSuccessfully() const ;
156 virtual ::Core::LevelStorageResult getState() const ;
159 createChunkStorage(::
std::unique_ptr<::
ChunkSource> generator, ::StorageVersion) ;
161 virtual ::Core::PathBuffer<::
std::
string> const& getFullPath() const ;
164 getCompoundTag(::
std::
string const& key, ::DBHelpers::Category category) ;
166 virtual
bool hasKey(::
std::string_view key, ::DBHelpers::Category category) const ;
168 virtual
bool loadLevelData(::
LevelData& data) ;
170 virtual
void saveLevelData(::
LevelData const& levelData) ;
172 virtual ::Bedrock::Threading::Async<
void>
173 saveData(::
std::
string const& key, ::
std::
string&& data, ::DBHelpers::Category category) ;
177 virtual ::Bedrock::Threading::Async<
void>
178 deleteData(::
std::
string const& key, ::DBHelpers::Category category) ;
180 virtual
bool loadData(::
std::string_view key, ::
std::
string&
buffer, ::DBHelpers::Category category) const
183 virtual
void forEachKeyWithPrefix(
184 ::
std::string_view prefix,
185 ::DBHelpers::Category category,
186 ::
std::function<
void(::
std::string_view, ::
std::string_view)> const& callback
189 virtual ::Core::LevelStorageResult getLevelStorageState() const ;
193 virtual
void startShutdown() ;
195 virtual
bool isShuttingDown() const ;
197 virtual
bool checkShutdownDone() ;
199 virtual
void getStatistics(::
std::
string& outStats, ::
LevelStorage::StatsType statsType) const ;
202 createSnapshot(::
std::
string const& filePrefix,
bool flushWriteCache) ;
204 virtual
void releaseSnapshot() ;
206 virtual ::Bedrock::Threading::Async<
void> compactStorage() ;
208 virtual
void syncAndSuspendStorage() ;
210 virtual
void resumeStorage() ;
212 virtual
void setFlushAllowed(
bool flushAllowed) ;
214 virtual
void flushToPermanentStorage() ;
216 virtual
void freeCaches() ;
218 virtual
void setCompactionCallback(::
std::function<
void(::CompactionStatus)> callback) ;
220 virtual
void setCriticalSyncSaveCallback(::
std::function<
void()> callback) ;
263 MCNAPI
bool $hasKey(::
std::string_view key, ::DBHelpers::Category category) const;
269 MCNAPI ::Bedrock::Threading::Async<
void>
270 $saveData(::
std::
string const& key, ::
std::
string&& data, ::DBHelpers::Category category);
274 MCNAPI ::Bedrock::Threading::Async<
void>
$deleteData(::
std::
string const& key, ::DBHelpers::Category category);
276 MCAPI
bool $loadData(::
std::string_view key, ::
std::
string&
buffer, ::DBHelpers::Category category) const;
279 ::
std::string_view prefix,
280 ::DBHelpers::Category category,
281 ::
std::function<
void(::
std::string_view, ::
std::string_view)> const& callback
292 MCAPI
bool $checkShutdownDone();
297 $createSnapshot(::
std::
string const& filePrefix,
bool flushWriteCache);
299 MCAPI
void $releaseSnapshot();