BigFile/Sasquatch #1

Merged
rboullard merged 100 commits from BigFile into Development 2026-09-01 16:32:02 +00:00
5 changed files with 17 additions and 15 deletions
Showing only changes of commit a674533f80 - Show all commits
@@ -89,7 +89,10 @@ class SasquatchFixture: public benchmark::Fixture
}
{
SasquatchWriter writer {File {SASQUATCH_ENGINEBENCHMARKS_LOCATION}, assets.size(), totalFlatbufferBytes, totalHardReferencesBytes};
SasquatchWriter writer {File {SASQUATCH_ENGINEBENCHMARKS_LOCATION},
assets.size(),
totalFlatbufferBytes,
totalHardReferencesBytes};
for (const SasquatchData& asset: assets)
{
writer.WriteAsset(asset.m_uuid, asset.m_flatbuffer, asset.m_hardReferences);
@@ -187,7 +187,7 @@ eastl::vector<eastl::vector<std::byte>> Sasquatch::GetAssetFlatbuffers(const eas
eastl::vector<eastl::vector<std::byte>> flatbuffers;
flatbuffers.reserve(p_uuids.size());
for (const UUID& uuid : p_uuids)
for (const UUID& uuid: p_uuids)
{
flatbuffers.push_back(GetAssetFlatbuffer(uuid));
}
@@ -208,7 +208,7 @@ AssetMetadata Sasquatch::GetAssetMetadata([[maybe_unused]] const UUID& p_uuid) c
eastl::vector<AssetMetadata> Sasquatch::GetAssetMetadatas([[maybe_unused]] const eastl::span<const UUID> p_uuids) const
{
ASSERT(EngineAssertHandler, false, "Sasquatch does not support metadata queries, only flatbuffers");
return eastl::vector<AssetMetadata>{p_uuids.size()};
return eastl::vector<AssetMetadata> {p_uuids.size()};
}
/****************************************************************************************/
@@ -247,7 +247,7 @@ eastl::vector<eastl::vector<UUID>> Sasquatch::GetAssetsHardReferences(eastl::spa
eastl::vector<eastl::vector<UUID>> hardReferences;
hardReferences.reserve(p_uuids.size());
for (const UUID& uuid : p_uuids)
for (const UUID& uuid: p_uuids)
{
hardReferences.push_back(GetAssetHardReferences(uuid));
}
@@ -34,7 +34,8 @@ void Bake(const BigFile& p_bigFile, const File& p_outputFile)
std::uint64_t totalHardReferencesBytes = 0;
{
BigFile::Request sizeRequest {p_bigFile, "SELECT COALESCE(SUM(LENGTH(AssetHardReference)), 0) FROM AssetHardReference;"};
BigFile::Request sizeRequest {p_bigFile,
"SELECT COALESCE(SUM(LENGTH(AssetHardReference)), 0) FROM AssetHardReference;"};
[[maybe_unused]]
const bool hasSize = sizeRequest.Step();
ASSERT(SasquatchBakerAssertHandler, hasSize, "Failed to sum the hardreferences sizes of the BigFile");
@@ -47,7 +48,7 @@ void Bake(const BigFile& p_bigFile, const File& p_outputFile)
while (request.Step())
{
const eastl::span<const std::byte> rawUUID = request.Get(0);
ASSERT(SasquatchBakerAssertHandler,
rawUUID.size() == UUID::UUID_BYTE_SIZE,
"Unexpected UUID blob size in BigFile (got {} / expected {})",
@@ -17,10 +17,7 @@ class DataAccessorFixture: public ::testing::Test
class DataAccessorMock: public DataAccessor
{
public:
MOCK_METHOD(eastl::vector<std::byte>,
GetAssetFlatbuffer,
(const UUID& p_uuid),
(const, override));
MOCK_METHOD(eastl::vector<std::byte>, GetAssetFlatbuffer, (const UUID& p_uuid), (const, override));
MOCK_METHOD(eastl::vector<eastl::vector<std::byte>>,
GetAssetFlatbuffers,
(eastl::span<const UUID> p_uuids),
+6 -5
View File
@@ -56,7 +56,10 @@ class SasquatchFixture: public ::testing::Test
}
{
SasquatchWriter writer {File {SASQUATCH_ENGINETESTS_LOCATION}, assets.size(), totalFlatbufferBytes, totalHardReferencesBytes};
SasquatchWriter writer {File {SASQUATCH_ENGINETESTS_LOCATION},
assets.size(),
totalFlatbufferBytes,
totalHardReferencesBytes};
for (const SasquatchData& asset: assets)
{
writer.WriteAsset(asset.m_uuid, asset.m_flatbuffer, asset.m_hardReferences);
@@ -102,8 +105,7 @@ TEST_F(SasquatchFixture, GetAssetHardReference_ShouldGetTheAssetHardReferences)
TEST_F(SasquatchFixture, GetAssetHardReferences_ShouldReturnEmptyVectorsForUUIDsThatDoNotExistOrHaveNoReferences)
{
const UUID missingUUID;
const eastl::array<UUID, 2> uuids {missingUUID,
m_assetB.GetHeader().uuid};
const eastl::array<UUID, 2> uuids {missingUUID, m_assetB.GetHeader().uuid};
const eastl::vector<eastl::vector<UUID>> hardReferences = m_sasquatch->GetAssetsHardReferences(uuids);
@@ -139,8 +141,7 @@ TEST_F(SasquatchFixture, GetAssetFlatbuffer_ShouldReturnEmptyForNonExistentUUID)
TEST_F(SasquatchFixture, GetAssetFlatbuffer_ShouldGetTheAssetFlatbuffer)
{
const eastl::vector<std::byte> savedFlatbuffer = m_sasquatch->GetAssetFlatbuffer(
m_assetA.GetHeader().uuid);
const eastl::vector<std::byte> savedFlatbuffer = m_sasquatch->GetAssetFlatbuffer(m_assetA.GetHeader().uuid);
EXPECT_EQ(savedFlatbuffer, m_flatbufferA);
}