Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor shared memory data layout to use named identifiers #4975

Merged
merged 19 commits into from
Apr 4, 2018

Conversation

TheMarex
Copy link
Member

@TheMarex TheMarex commented Mar 26, 2018

Issue

This works towards #4952 by using the string identifiers everywhere to reference to the data. This makes DataLayout quite "stupid" as it does not know about the data anymore and can have a variable number of entries.

Tasklist

Requirements / Relations

This PR is based on #4960.

@TheMarex TheMarex force-pushed the refactor/shared_memory_addressing branch 2 times, most recently from c10eded to 76f88a4 Compare March 26, 2018 13:16
@TheMarex TheMarex self-assigned this Mar 26, 2018
@TheMarex TheMarex force-pushed the refactor/shared_memory_addressing branch 2 times, most recently from 99976aa to 21f759e Compare March 27, 2018 16:32
@TheMarex TheMarex force-pushed the refactor/shared_memory_addressing branch 2 times, most recently from cd326db to 995a09a Compare March 28, 2018 12:13
@TheMarex TheMarex force-pushed the refactor/shared_memory_addressing branch from 995a09a to 00395bc Compare March 28, 2018 12:21
@TheMarex TheMarex added this to the 5.17.0 milestone Mar 28, 2018
Copy link
Contributor

@oxidase oxidase left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 looks good!

class DataLayout
{
public:
enum BlockID
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@@ -402,15 +313,15 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
{
const auto name_blocks_ptr =
layout.GetBlockPtr<extractor::NameTableView::IndexedData::BlockReference, true>(
memory_ptr, DataLayout::NAME_BLOCKS);
memory_ptr, "/common/names/blocks");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is good to move initialization into a free function as

return util::vector_view<BlockT> (layout.GetBlockPtr<BlockT, true>(memory_ptr, name), layout.GetBlockEntries(name));

to avoid duplication of type-name pairs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh great idea. 👍

inline std::string trimName(const std::string &name_prefix, const std::string &name)
{
// list directory and
if (name_prefix.back() == '/')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!name_prefix.empty() && ...

@TheMarex
Copy link
Member Author

TheMarex commented Apr 3, 2018

@oxidase Could you review this again? I refactored creating the views so it can be shared by osrm-datastore and the datafacade. This make it necessary to remove the canary logic.

Copy link
Contributor

@oxidase oxidase left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I don't think that canary blocks are needed since layout and data blocks were merged into a single one. imho ✂️ is 🆗

@TheMarex TheMarex merged commit 14d2199 into master Apr 4, 2018
@TheMarex TheMarex deleted the refactor/shared_memory_addressing branch April 4, 2018 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants