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