Namespaced VoxelStreamSQLite

master
Marc Gilleron 2022-01-09 05:04:28 +00:00
parent 774adfca3c
commit 0e48ee71a4
2 changed files with 12 additions and 6 deletions

View File

@ -8,8 +8,7 @@
#include <limits>
#include <string>
using namespace zylann;
using namespace voxel;
namespace zylann::voxel {
struct BlockLocation {
int16_t x;
@ -573,8 +572,13 @@ void VoxelStreamSQLiteInternal::save_meta(Meta meta) {
}
}
} // namespace zylann::voxel
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
using namespace zylann;
using namespace voxel;
thread_local BlockSerializer VoxelStreamSQLite::_voxel_block_serializer;
thread_local std::vector<uint8_t> VoxelStreamSQLite::_temp_block_data;
thread_local std::vector<uint8_t> VoxelStreamSQLite::_temp_compressed_block_data;

View File

@ -7,7 +7,9 @@
#include <core/os/mutex.h>
#include <vector>
namespace zylann::voxel {
class VoxelStreamSQLiteInternal;
}
// Saves voxel data into a single SQLite database file.
class VoxelStreamSQLite : public VoxelStream {
@ -55,14 +57,14 @@ private:
// Because of this, in our use case, it might be simpler to just leave SQLite in thread-safe mode,
// and synchronize ourselves.
VoxelStreamSQLiteInternal *get_connection();
void recycle_connection(VoxelStreamSQLiteInternal *con);
void flush_cache(VoxelStreamSQLiteInternal *con);
zylann::voxel::VoxelStreamSQLiteInternal *get_connection();
void recycle_connection(zylann::voxel::VoxelStreamSQLiteInternal *con);
void flush_cache(zylann::voxel::VoxelStreamSQLiteInternal *con);
static void _bind_methods();
String _connection_path;
std::vector<VoxelStreamSQLiteInternal *> _connection_pool;
std::vector<zylann::voxel::VoxelStreamSQLiteInternal *> _connection_pool;
Mutex _connection_mutex;
zylann::voxel::VoxelStreamCache _cache;