Fix shared memory
This commit is contained in:
parent
0f04fe75bd
commit
4bbb587280
@ -343,14 +343,14 @@ int Storage::Run()
|
|||||||
// exist.
|
// exist.
|
||||||
std::ifstream geometry_datasource_input_stream(datasource_indexes_path.c_str(),
|
std::ifstream geometry_datasource_input_stream(datasource_indexes_path.c_str(),
|
||||||
std::ios::binary);
|
std::ios::binary);
|
||||||
|
std::size_t number_of_compressed_datasources = 0;
|
||||||
if (geometry_datasource_input_stream)
|
if (geometry_datasource_input_stream)
|
||||||
{
|
{
|
||||||
std::size_t number_of_compressed_datasources = 0;
|
|
||||||
geometry_datasource_input_stream.read(
|
geometry_datasource_input_stream.read(
|
||||||
reinterpret_cast<char *>(&number_of_compressed_datasources), sizeof(std::size_t));
|
reinterpret_cast<char *>(&number_of_compressed_datasources), sizeof(std::size_t));
|
||||||
|
}
|
||||||
shared_layout_ptr->SetBlockSize<uint8_t>(SharedDataLayout::DATASOURCES_LIST,
|
shared_layout_ptr->SetBlockSize<uint8_t>(SharedDataLayout::DATASOURCES_LIST,
|
||||||
number_of_compressed_datasources);
|
number_of_compressed_datasources);
|
||||||
}
|
|
||||||
|
|
||||||
// Load datasource name sizes. This file is optional, and it's non-fatal if it doesn't
|
// Load datasource name sizes. This file is optional, and it's non-fatal if it doesn't
|
||||||
// exist
|
// exist
|
||||||
@ -368,14 +368,13 @@ int Storage::Run()
|
|||||||
std::back_inserter(m_datasource_name_data));
|
std::back_inserter(m_datasource_name_data));
|
||||||
m_datasource_name_lengths.push_back(name.size());
|
m_datasource_name_lengths.push_back(name.size());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
shared_layout_ptr->SetBlockSize<char>(SharedDataLayout::DATASOURCE_NAME_DATA,
|
shared_layout_ptr->SetBlockSize<char>(SharedDataLayout::DATASOURCE_NAME_DATA,
|
||||||
m_datasource_name_data.size());
|
m_datasource_name_data.size());
|
||||||
shared_layout_ptr->SetBlockSize<std::size_t>(SharedDataLayout::DATASOURCE_NAME_OFFSETS,
|
shared_layout_ptr->SetBlockSize<std::size_t>(SharedDataLayout::DATASOURCE_NAME_OFFSETS,
|
||||||
m_datasource_name_offsets.size());
|
m_datasource_name_offsets.size());
|
||||||
shared_layout_ptr->SetBlockSize<std::size_t>(SharedDataLayout::DATASOURCE_NAME_LENGTHS,
|
shared_layout_ptr->SetBlockSize<std::size_t>(SharedDataLayout::DATASOURCE_NAME_LENGTHS,
|
||||||
m_datasource_name_lengths.size());
|
m_datasource_name_lengths.size());
|
||||||
}
|
|
||||||
|
|
||||||
// allocate shared memory block
|
// allocate shared memory block
|
||||||
util::SimpleLogger().Write() << "allocating shared memory of "
|
util::SimpleLogger().Write() << "allocating shared memory of "
|
||||||
@ -491,8 +490,6 @@ int Storage::Run()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// load datasource information (if it exists)
|
// load datasource information (if it exists)
|
||||||
if (geometry_datasource_input_stream)
|
|
||||||
{
|
|
||||||
uint8_t *datasources_list_ptr = shared_layout_ptr->GetBlockPtr<uint8_t, true>(
|
uint8_t *datasources_list_ptr = shared_layout_ptr->GetBlockPtr<uint8_t, true>(
|
||||||
shared_memory_ptr, SharedDataLayout::DATASOURCES_LIST);
|
shared_memory_ptr, SharedDataLayout::DATASOURCES_LIST);
|
||||||
if (shared_layout_ptr->GetBlockSize(SharedDataLayout::DATASOURCES_LIST) > 0)
|
if (shared_layout_ptr->GetBlockSize(SharedDataLayout::DATASOURCES_LIST) > 0)
|
||||||
@ -501,11 +498,8 @@ int Storage::Run()
|
|||||||
reinterpret_cast<char *>(datasources_list_ptr),
|
reinterpret_cast<char *>(datasources_list_ptr),
|
||||||
shared_layout_ptr->GetBlockSize(SharedDataLayout::DATASOURCES_LIST));
|
shared_layout_ptr->GetBlockSize(SharedDataLayout::DATASOURCES_LIST));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// load datasource name information (if it exists)
|
// load datasource name information (if it exists)
|
||||||
if (!m_datasource_name_data.empty())
|
|
||||||
{
|
|
||||||
char *datasource_name_data_ptr = shared_layout_ptr->GetBlockPtr<char, true>(
|
char *datasource_name_data_ptr = shared_layout_ptr->GetBlockPtr<char, true>(
|
||||||
shared_memory_ptr, SharedDataLayout::DATASOURCE_NAME_DATA);
|
shared_memory_ptr, SharedDataLayout::DATASOURCE_NAME_DATA);
|
||||||
if (shared_layout_ptr->GetBlockSize(SharedDataLayout::DATASOURCE_NAME_DATA) > 0)
|
if (shared_layout_ptr->GetBlockSize(SharedDataLayout::DATASOURCE_NAME_DATA) > 0)
|
||||||
@ -532,7 +526,6 @@ int Storage::Run()
|
|||||||
std::copy(m_datasource_name_lengths.begin(), m_datasource_name_lengths.end(),
|
std::copy(m_datasource_name_lengths.begin(), m_datasource_name_lengths.end(),
|
||||||
datasource_name_lengths_ptr);
|
datasource_name_lengths_ptr);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Loading list of coordinates
|
// Loading list of coordinates
|
||||||
util::Coordinate *coordinates_ptr = shared_layout_ptr->GetBlockPtr<util::Coordinate, true>(
|
util::Coordinate *coordinates_ptr = shared_layout_ptr->GetBlockPtr<util::Coordinate, true>(
|
||||||
|
Loading…
Reference in New Issue
Block a user