38 using LevelAddedType = ::LevelListCacheObserver::LevelAddedType;
45 ::ll::TypedStorage<8, 8, ::LevelStorageSource&> mLevelStorageSource;
46 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, ::LevelCache>> mCachedLevelData;
47 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, ::LevelSummary>> mCachedUnSyncedLevelData;
48 ::ll::TypedStorage<1, 1, bool> mDiscoverLevels;
49 ::ll::TypedStorage<8, 32, ::Core::Subject<::LevelListCacheObserver, ::Core::SingleThreadedLock>> mSubject;
50 ::ll::TypedStorage<8, 80, ::std::recursive_mutex> mCacheLock;
51 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::AppPlatform const>
const> mAppPlatform;
52 ::ll::TypedStorage<8, 64, ::std::function<bool()>> mCheckIsSafeToFlushCache;
57 LevelListCache& operator=(LevelListCache
const&);
58 LevelListCache(LevelListCache
const&);
64 virtual ~LevelListCache() =
default;
66 virtual void addLevel(::std::string
const& levelId,
::LevelData&& levelData) ;
68 virtual void deleteLevel(::std::string
const& levelId) ;
70 virtual void refreshLevel(::std::string
const& levelId) ;
72 virtual void ensureLevelInitialized(::std::string
const& levelId) ;
74 virtual void deleteLevelFiles(::std::string
const& levelId) ;
76 virtual void postDeleteLevel(::std::string
const& levelId) ;
78 virtual void renameLevel(::std::string
const& levelId, ::std::string
const& newLevelName) ;
80 virtual void renameAndSaveLevelData(
81 ::std::string
const& levelId,
82 ::std::string
const& newLevelName,
86 virtual void saveLevelData(::std::string
const& levelId,
::LevelData const& levelData) ;
88 virtual void createBackupCopyOfWorld(
89 ::std::string
const& levelId,
90 ::std::string
const& newLevelId,
91 ::std::string
const& newName
94 virtual bool hasLevelWithId(::std::string
const& levelId) ;
98 virtual bool checkIfLevelIsCorruptOrMissing(::std::string
const& levelId) ;
104 virtual ::Bedrock::UniqueOwnerPointer<::LevelStorage> createLevelStorage(
106 ::std::string
const& levelId,
108 ::Bedrock::NotNullNonOwnerPtr<::IContentKeyProvider const>
const& keyProvider,
109 ::std::chrono::nanoseconds
const& writeFlushInterval,
110 ::Bedrock::NotNullNonOwnerPtr<::LevelDbEnv> levelDbEnv,
111 ::std::unique_ptr<::LevelStorageEventing> levelStorageEventing
114 virtual ::std::unique_ptr<::LevelLooseFileStorage> createLevelLooseStorage(
115 ::std::string
const& levelId,
117 ::Bedrock::NotNullNonOwnerPtr<::IContentKeyProvider const>
const& keyProvider
120 virtual ::LevelSummary* getLevelSummary(::std::string
const& levelId) ;
122 virtual ::LevelSummary
const* getLevelSummaryByName(::std::string
const& levelName) ;
124 virtual ::LevelSummary* getOrCreateLevelSummary(
::Core::Path const& directory) ;
126 virtual ::LevelData* getLevelData(::std::string
const& levelId) ;
128 virtual ::Bedrock::NonOwnerPointer<::LevelData>
129 getLevelDataNonOwnerPointer(::std::string
const& levelId) ;
131 virtual ::LevelSummary* getShallowLevelSummary(::std::string
const& levelId) ;
133 virtual void getLevelList(
134 ::std::vector<::LevelSummary>& dest,
135 bool includeShallowSummaries,
136 bool includePartiallyCopiedLevels,
137 bool includeBetaRetailLevels,
138 bool includeInvalidLevelDataLevels
141 virtual bool hasCachedLevels(
bool includeShallowSummaries)
const ;
143 virtual void updateLevelCache(::std::string
const& levelId) ;
145 virtual ::std::unique_ptr<::LevelStorageObserver> createLevelStorageObserver() ;
147 virtual void onSave(::std::string
const& levelId) ;
149 virtual void onStorageChanged() ;
151 virtual ::Core::PathBuffer<::std::string>
const getBasePath()
const ;
153 virtual ::Core::PathBuffer<::std::string>
const getPathToLevel(::std::string
const& levelId)
const ;
159 MCAPI LevelListCache(
161 ::Bedrock::NotNullNonOwnerPtr<::AppPlatform const> appPlatform,
162 ::std::function<
bool()>&& checkIsSafeToFlushCache
165 MCAPI ::LevelCache* _addOrReplaceCache(
::Core::Path const& path);
167 MCAPI ::LevelCache* _addToCache(
168 ::std::string
const& levelId,
170 ::LevelListCacheObserver::LevelAddedType levelAddedType
173 MCAPI ::LevelCache* _createAndAddToCache(
174 ::std::string
const& levelId,
176 ::LevelListCacheObserver::LevelAddedType levelAddedType
179 MCAPI ::LevelCache* _getLevelCache(::std::string
const& levelId);
181 MCAPI ::LevelSummary* _getLevelSummary(::std::string
const& levelId);
183 MCAPI
void _notifyLevelUpdated(::std::string
const& levelId);
185 MCAPI
void _notifyNewLevelFound(::std::string
const& levelId, ::LevelListCacheObserver::LevelAddedType type);
187 MCAPI
void _refreshSummary(::std::string
const& levelId,
::LevelCache& cache);
195 ::Bedrock::NotNullNonOwnerPtr<::AppPlatform const> appPlatform,
196 ::std::function<
bool()>&& checkIsSafeToFlushCache
203 MCAPI
void $addLevel(::std::string
const& levelId,
::LevelData&& levelData);
205 MCAPI
void $deleteLevel(::std::string
const& levelId);
207 MCAPI
void $refreshLevel(::std::string
const& levelId);
209 MCAPI
void $ensureLevelInitialized(::std::string
const& levelId);
211 MCAPI
void $deleteLevelFiles(::std::string
const& levelId);
213 MCAPI
void $postDeleteLevel(::std::string
const& levelId);
215 MCAPI
void $renameLevel(::std::string
const& levelId, ::std::string
const& newLevelName);
217 MCAPI
void $renameAndSaveLevelData(
218 ::std::string
const& levelId,
219 ::std::string
const& newLevelName,
223 MCAPI
void $saveLevelData(::std::string
const& levelId,
::LevelData const& levelData);
225 MCAPI
void $createBackupCopyOfWorld(
226 ::std::string
const& levelId,
227 ::std::string
const& newLevelId,
228 ::std::string
const& newName
231 MCAPI
bool $hasLevelWithId(::std::string
const& levelId);
235 MCAPI
bool $checkIfLevelIsCorruptOrMissing(::std::string
const& levelId);
241 MCAPI ::Bedrock::UniqueOwnerPointer<::LevelStorage> $createLevelStorage(
243 ::std::string
const& levelId,
245 ::Bedrock::NotNullNonOwnerPtr<::IContentKeyProvider const>
const& keyProvider,
246 ::std::chrono::nanoseconds
const& writeFlushInterval,
247 ::Bedrock::NotNullNonOwnerPtr<::LevelDbEnv> levelDbEnv,
248 ::std::unique_ptr<::LevelStorageEventing> levelStorageEventing
251 MCAPI ::std::unique_ptr<::LevelLooseFileStorage> $createLevelLooseStorage(
252 ::std::string
const& levelId,
254 ::Bedrock::NotNullNonOwnerPtr<::IContentKeyProvider const>
const& keyProvider
257 MCAPI ::LevelSummary* $getLevelSummary(::std::string
const& levelId);
259 MCAPI ::LevelSummary
const* $getLevelSummaryByName(::std::string
const& levelName);
261 MCAPI ::LevelSummary* $getOrCreateLevelSummary(
::Core::Path const& directory);
263 MCAPI ::LevelData* $getLevelData(::std::string
const& levelId);
265 MCAPI ::Bedrock::NonOwnerPointer<::LevelData> $getLevelDataNonOwnerPointer(::std::string
const& levelId);
267 MCAPI ::LevelSummary* $getShallowLevelSummary(::std::string
const& levelId);
269 MCAPI
void $getLevelList(
270 ::std::vector<::LevelSummary>& dest,
271 bool includeShallowSummaries,
272 bool includePartiallyCopiedLevels,
273 bool includeBetaRetailLevels,
274 bool includeInvalidLevelDataLevels
277 MCAPI
bool $hasCachedLevels(
bool includeShallowSummaries)
const;
279 MCAPI
void $updateLevelCache(::std::string
const& levelId);
281 MCAPI ::std::unique_ptr<::LevelStorageObserver> $createLevelStorageObserver();
283 MCAPI
void $onSave(::std::string
const& levelId);
285 MCAPI
void $onStorageChanged();
287 MCAPI ::Core::PathBuffer<::std::string>
const $getBasePath()
const;
289 MCAPI ::Core::PathBuffer<::std::string>
const $getPathToLevel(::std::string
const& levelId)
const;