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;
22namespace Core { struct LevelStorageResult; }
23// clang-format on
24
26public:
27 // LevelStorage inner types define
28 enum class StatsType : uint {
29 Level0 = 0,
30 Level1 = 1,
31 Level2 = 2,
32 Memory = 3,
33 Default = 0,
34 };
35
36public:
37 // virtual functions
38 // NOLINTBEGIN
39 // vIndex: 0
40 virtual ~LevelStorage();
41
42 // vIndex: 1
43 virtual void addStorageObserver(::std::unique_ptr<::LevelStorageObserver>) = 0;
44
45 // vIndex: 2
46 virtual bool loadedSuccessfully() const;
47
48 // vIndex: 3
49 virtual ::std::unique_ptr<::CompoundTag> getCompoundTag(::std::string const&, ::DBHelpers::Category) = 0;
50
51 // vIndex: 4
52 virtual bool hasKey(::std::string_view, ::DBHelpers::Category) const = 0;
53
54 // vIndex: 5
55 virtual void forEachKeyWithPrefix(
56 ::std::string_view,
57 ::DBHelpers::Category,
58 ::std::function<void(::std::string_view, ::std::string_view)> const&
59 ) const = 0;
60
61 // vIndex: 6
62 virtual bool loadLevelData(::LevelData&) = 0;
63
64 // vIndex: 7
65 virtual ::std::unique_ptr<::ChunkSource> createChunkStorage(::std::unique_ptr<::ChunkSource>, ::StorageVersion) = 0;
66
67 // vIndex: 8
68 virtual void saveLevelData(::LevelData const&) = 0;
69
70 // vIndex: 9
71 virtual ::Core::PathBuffer<::std::string> const& getFullPath() const = 0;
72
73 // vIndex: 11
74 virtual ::Bedrock::Threading::Async<void>
75 saveData(::std::string const&, ::std::string&&, ::DBHelpers::Category) = 0;
76
77 // vIndex: 10
78 virtual ::Bedrock::Threading::Async<void> saveData(::LevelStorageWriteBatch const&) = 0;
79
80 // vIndex: 12
81 virtual ::Bedrock::Threading::Async<void> deleteData(::std::string const&, ::DBHelpers::Category) = 0;
82
83 // vIndex: 13
84 virtual void getStatistics(::std::string&, ::LevelStorage::StatsType) const = 0;
85
86 // vIndex: 14
87 virtual bool clonePlayerData(::std::string_view fromKey, ::std::string_view toKey);
88
89 // vIndex: 15
90 virtual ::Core::LevelStorageResult getLevelStorageState() const = 0;
91
92 // vIndex: 16
93 virtual ::ContentIdentity const* getContentIdentity() const = 0;
94
95 // vIndex: 17
96 virtual void startShutdown() = 0;
97
98 // vIndex: 18
99 virtual bool isShuttingDown() const = 0;
100
101 // vIndex: 19
102 virtual bool checkShutdownDone() = 0;
103
104 // vIndex: 20
105 virtual bool loadData(::std::string_view key, ::std::string& buffer, ::DBHelpers::Category category) const;
106
107 // vIndex: 21
108 virtual ::Core::LevelStorageResult getState() const = 0;
109
110 // vIndex: 22
111 virtual ::std::vector<::SnapshotFilenameAndLength> createSnapshot(::std::string const&, bool) = 0;
112
113 // vIndex: 23
114 virtual void releaseSnapshot() = 0;
115
116 // vIndex: 24
117 virtual ::Bedrock::Threading::Async<void> compactStorage() = 0;
118
119 // vIndex: 25
120 virtual void syncAndSuspendStorage() = 0;
121
122 // vIndex: 26
123 virtual void resumeStorage() = 0;
124
125 // vIndex: 27
126 virtual void setFlushAllowed(bool) = 0;
127
128 // vIndex: 28
129 virtual void flushToPermanentStorage() = 0;
130
131 // vIndex: 29
132 virtual void freeCaches();
133
134 // vIndex: 30
135 virtual void setCompactionCallback(::std::function<void(::CompactionStatus)>) = 0;
136
137 // vIndex: 31
138 virtual void setCriticalSyncSaveCallback(::std::function<void()>) = 0;
139
140 // vIndex: 32
141 virtual void corruptLevel();
142 // NOLINTEND
143
144public:
145 // member functions
146 // NOLINTBEGIN
147 MCAPI ::std::string getServerId(::Player const& client, bool isXboxLive);
148
149 MCAPI ::std::vector<::std::string> loadAllPlayerIDs(bool includeLocalPlayer) const;
150
151 MCAPI ::std::unique_ptr<::CompoundTag> loadServerPlayerData(::Player const& client, bool isXboxLive);
152
153 MCAPI void save(::Player& player);
154
155 MCAPI ::Bedrock::Threading::Async<void>
156 saveData(::std::string const& key, ::CompoundTag const& tag, ::DBHelpers::Category category);
157 // NOLINTEND
158
159public:
160 // static variables
161 // NOLINTBEGIN
162 MCAPI static ::std::string const& LEGACY_CONSOLE_PLAYER_PREFIX();
163
164 MCAPI static ::std::string const& LOCAL_PLAYER_TAG();
165 // NOLINTEND
166
167public:
168 // destructor thunk
169 // NOLINTBEGIN
170 MCAPI void $dtor();
171 // NOLINTEND
172
173public:
174 // virtual function thunks
175 // NOLINTBEGIN
176 MCFOLD bool $loadedSuccessfully() const;
177
178 MCAPI bool $clonePlayerData(::std::string_view fromKey, ::std::string_view toKey);
179
180 MCFOLD bool $loadData(::std::string_view key, ::std::string& buffer, ::DBHelpers::Category category) const;
181
182 MCFOLD void $freeCaches();
183
184 MCFOLD void $corruptLevel();
185 // NOLINTEND
186
187public:
188 // vftables
189 // NOLINTBEGIN
190 MCNAPI static void** $vftable();
191 // NOLINTEND
192};
Definition ChunkSource.h:34
Definition CompoundTag.h:13
Definition ContentIdentity.h:8
Definition LevelData.h:49
Definition LevelStorageObserver.h:5
Definition LevelStorageWriteBatch.h:14
Definition LevelStorage.h:25
static MCAPI void ** $vftable()
Definition Player.h:123
Definition SnapshotFilenameAndLength.h:5
Definition buffer.h:5