LeviLamina
Loading...
Searching...
No Matches
LevelStorage.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/common/CompactionStatus.h"
7#include "mc/deps/core/file/PathBuffer.h"
8#include "mc/deps/core/threading/Async.h"
9#include "mc/world/level/storage/StorageVersion.h"
10#include "mc/world/level/storage/db_helpers/Category.h"
11
12// auto generated forward declare list
13// clang-format off
14class ChunkSource;
15class CompoundTag;
16class ContentIdentity;
17class LevelData;
20class Player;
21struct PlayerStorageIds;
23namespace Core { struct LevelStorageResult; }
24// clang-format on
25
27public:
28 // LevelStorage inner types define
29 enum class StatsType : uint {
30 Level0 = 0,
31 Level1 = 1,
32 Level2 = 2,
33 Memory = 3,
34 Default = 0,
35 };
36
37public:
38 // virtual functions
39 // NOLINTBEGIN
40 virtual ~LevelStorage();
41
42 virtual void addStorageObserver(::std::unique_ptr<::LevelStorageObserver> observer) = 0;
43
44 virtual bool loadedSuccessfully() const;
45
46 virtual ::std::unique_ptr<::CompoundTag>
47 getCompoundTag(::std::string const& key, ::DBHelpers::Category category) = 0;
48
49 virtual bool hasKey(::std::string_view, ::DBHelpers::Category) const = 0;
50
51 virtual void forEachKeyWithPrefix(
52 ::std::string_view prefix,
53 ::DBHelpers::Category category,
54 ::std::function<void(::std::string_view, ::std::string_view)> const& callback
55 ) const = 0;
56
57 virtual bool loadLevelData(::LevelData& data) = 0;
58
59 virtual ::std::unique_ptr<::ChunkSource> createChunkStorage(::std::unique_ptr<::ChunkSource>, ::StorageVersion) = 0;
60
61 virtual void saveLevelData(::LevelData const& levelData) = 0;
62
63 virtual ::Core::PathBuffer<::std::string> const& getFullPath() const = 0;
64
65 virtual ::Bedrock::Threading::Async<void>
66 saveData(::std::string const& key, ::std::string&& data, ::DBHelpers::Category category) = 0;
67
68 virtual ::Bedrock::Threading::Async<void> saveData(::LevelStorageWriteBatch const& batch) = 0;
69
70 virtual ::Bedrock::Threading::Async<void> deleteData(::std::string const& key, ::DBHelpers::Category category) = 0;
71
72 virtual void getStatistics(::std::string& outStats, ::LevelStorage::StatsType statsType) const = 0;
73
74 virtual bool clonePlayerData(::std::string_view fromKey, ::std::string_view toKey);
75
76 virtual ::Core::LevelStorageResult getLevelStorageState() const = 0;
77
78 virtual ::ContentIdentity const* getContentIdentity() const = 0;
79
80 virtual void startShutdown() = 0;
81
82 virtual bool isShuttingDown() const = 0;
83
84 virtual bool checkShutdownDone() = 0;
85
86 virtual bool loadData(::std::string_view key, ::std::string& buffer, ::DBHelpers::Category category) const;
87
88 virtual ::Core::LevelStorageResult getState() const = 0;
89
90 virtual ::std::vector<::SnapshotFilenameAndLength>
91 createSnapshot(::std::string const& filePrefix, bool flushWriteCache) = 0;
92
93 virtual void releaseSnapshot() = 0;
94
95 virtual ::Bedrock::Threading::Async<void> compactStorage() = 0;
96
97 virtual void syncAndSuspendStorage() = 0;
98
99 virtual void resumeStorage() = 0;
100
101 virtual void setFlushAllowed(bool flushAllowed) = 0;
102
103 virtual void flushToPermanentStorage() = 0;
104
105 virtual void freeCaches();
106
107 virtual void setCompactionCallback(::std::function<void(::CompactionStatus)> callback) = 0;
108
109 virtual void setCriticalSyncSaveCallback(::std::function<void()> callback) = 0;
110
111 virtual void corruptLevel();
112 // NOLINTEND
113
114public:
115 // member functions
116 // NOLINTBEGIN
117#ifdef LL_PLAT_C
118 MCAPI ::std::unique_ptr<::LevelStorageWriteBatch> createWriteBatch();
119#endif
120
121 MCAPI ::std::string getServerId(::PlayerStorageIds const& playerId);
122
123 MCAPI ::std::string getServerId(::Player const& client, bool isXboxLive);
124
125 MCAPI ::std::vector<::std::string> loadAllPlayerIDs(bool includeLocalPlayer) const;
126
127 MCAPI ::std::unique_ptr<::CompoundTag> loadLocalPlayerData();
128
129 MCAPI ::std::unique_ptr<::CompoundTag> loadPlayerDataFromTag(::std::string_view saveTag);
130
131 MCAPI ::std::unique_ptr<::CompoundTag> loadServerPlayerData(::Player const& client, bool isXboxLive);
132
133 MCAPI void save(::Player& player);
134
135 MCAPI ::Bedrock::Threading::Async<void>
136 saveData(::std::string const& key, ::CompoundTag const& tag, ::DBHelpers::Category category);
137 // NOLINTEND
138
139public:
140 // static variables
141 // NOLINTBEGIN
142 MCAPI static ::std::string const& LEGACY_CONSOLE_PLAYER_PREFIX();
143
144 MCAPI static ::std::string const& LOCAL_PLAYER_TAG();
145 // NOLINTEND
146
147public:
148 // destructor thunk
149 // NOLINTBEGIN
150 MCFOLD void $dtor();
151 // NOLINTEND
152
153public:
154 // virtual function thunks
155 // NOLINTBEGIN
156 MCAPI bool $clonePlayerData(::std::string_view fromKey, ::std::string_view toKey);
157
158 MCFOLD void $corruptLevel();
159
160
161 // NOLINTEND
162};
Definition ChunkSource.h:37
Definition CompoundTag.h:23
Definition ContentIdentity.h:8
Definition LevelData.h:55
Definition LevelStorageObserver.h:5
Definition LevelStorageWriteBatch.h:14
Definition LevelStorage.h:26
Definition Player.h:137
Definition LevelStorageResult.h:7
Definition PlayerStorageIds.h:5
Definition SnapshotFilenameAndLength.h:5
Definition buffer.h:5