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 virtual ~LevelStorage();
40
41 virtual void addStorageObserver(::std::unique_ptr<::LevelStorageObserver> observer) = 0;
42
43 virtual bool loadedSuccessfully() const;
44
45 virtual ::std::unique_ptr<::CompoundTag>
46 getCompoundTag(::std::string const& key, ::DBHelpers::Category category) = 0;
47
48 virtual bool hasKey(::std::string_view key, ::DBHelpers::Category category) const = 0;
49
50 virtual void forEachKeyWithPrefix(
51 ::std::string_view prefix,
52 ::DBHelpers::Category category,
53 ::std::function<void(::std::string_view, ::std::string_view)> const& callback
54 ) const = 0;
55
56 virtual bool loadLevelData(::LevelData& data) = 0;
57
58 virtual ::std::unique_ptr<::ChunkSource> createChunkStorage(::std::unique_ptr<::ChunkSource>, ::StorageVersion) = 0;
59
60 virtual void saveLevelData(::LevelData const& levelData) = 0;
61
62 virtual ::Core::PathBuffer<::std::string> const& getFullPath() const = 0;
63
64 virtual ::Bedrock::Threading::Async<void>
65 saveData(::std::string const& key, ::std::string&& data, ::DBHelpers::Category category) = 0;
66
67 virtual ::Bedrock::Threading::Async<void> saveData(::LevelStorageWriteBatch const& batch) = 0;
68
69 virtual ::Bedrock::Threading::Async<void> deleteData(::std::string const& key, ::DBHelpers::Category category) = 0;
70
71 virtual void getStatistics(::std::string& outStats, ::LevelStorage::StatsType statsType) const = 0;
72
73 virtual bool clonePlayerData(::std::string_view fromKey, ::std::string_view toKey);
74
75 virtual ::Core::LevelStorageResult getLevelStorageState() const = 0;
76
77 virtual ::ContentIdentity const* getContentIdentity() const = 0;
78
79 virtual void startShutdown() = 0;
80
81 virtual bool isShuttingDown() const = 0;
82
83 virtual bool checkShutdownDone() = 0;
84
85 virtual bool loadData(::std::string_view key, ::std::string& buffer, ::DBHelpers::Category category) const;
86
87 virtual ::Core::LevelStorageResult getState() const = 0;
88
89 virtual ::std::vector<::SnapshotFilenameAndLength>
90 createSnapshot(::std::string const& filePrefix, bool flushWriteCache) = 0;
91
92 virtual void releaseSnapshot() = 0;
93
94 virtual ::Bedrock::Threading::Async<void> compactStorage() = 0;
95
96 virtual void syncAndSuspendStorage() = 0;
97
98 virtual void resumeStorage() = 0;
99
100 virtual void setFlushAllowed(bool flushAllowed) = 0;
101
102 virtual void flushToPermanentStorage() = 0;
103
104 virtual void freeCaches();
105
106 virtual void setCompactionCallback(::std::function<void(::CompactionStatus)> callback) = 0;
107
108 virtual void setCriticalSyncSaveCallback(::std::function<void()> callback) = 0;
109
110 virtual void corruptLevel();
111 // NOLINTEND
112
113public:
114 // member functions
115 // NOLINTBEGIN
116#ifdef LL_PLAT_C
117 MCAPI ::std::unique_ptr<::LevelStorageWriteBatch> createWriteBatch();
118#endif
119
120 MCAPI ::std::string getServerId(::Player const& client, bool isXboxLive);
121
122 MCAPI ::std::vector<::std::string> loadAllPlayerIDs(bool includeLocalPlayer) const;
123
124 MCAPI ::std::unique_ptr<::CompoundTag> loadServerPlayerData(::Player const& client, bool isXboxLive);
125
126 MCAPI void save(::Player& player);
127
128 MCAPI ::Bedrock::Threading::Async<void>
129 saveData(::std::string const& key, ::CompoundTag const& tag, ::DBHelpers::Category category);
130 // NOLINTEND
131
132public:
133 // static variables
134 // NOLINTBEGIN
135 MCAPI static ::std::string const& LEGACY_CONSOLE_PLAYER_PREFIX();
136
137 MCAPI static ::std::string const& LOCAL_PLAYER_TAG();
138 // NOLINTEND
139
140public:
141 // destructor thunk
142 // NOLINTBEGIN
143 MCAPI void $dtor();
144 // NOLINTEND
145
146public:
147 // virtual function thunks
148 // NOLINTBEGIN
149 MCFOLD bool $loadedSuccessfully() const;
150
151 MCAPI bool $clonePlayerData(::std::string_view fromKey, ::std::string_view toKey);
152
153 MCFOLD bool $loadData(::std::string_view key, ::std::string& buffer, ::DBHelpers::Category category) const;
154
155 MCFOLD void $freeCaches();
156
157 MCFOLD void $corruptLevel();
158
159
160 // NOLINTEND
161
162public:
163 // vftables
164 // NOLINTBEGIN
165 MCNAPI static void** $vftable();
166 // NOLINTEND
167};
Definition ChunkSource.h:38
Definition CompoundTag.h:23
Definition ContentIdentity.h:8
Definition LevelData.h:52
Definition LevelStorageObserver.h:5
Definition LevelStorageWriteBatch.h:14
Definition LevelStorage.h:25
static MCAPI void ** $vftable()
Definition Player.h:129
Definition LevelStorageResult.h:7
Definition SnapshotFilenameAndLength.h:5
Definition buffer.h:5