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

Create crates in order (for Engine V2) #119

Merged
merged 1 commit into from
Apr 4, 2024
Merged

Conversation

mr-smidge
Copy link
Contributor

@mr-smidge mr-smidge commented Apr 2, 2024

New method create_..._after() provides the ability to maintain a sorted list of crates. Pseudo-code as follows could achieve this:

djinterop::crate create_sorted(djinterop::database& db, const std::string& name)
{
  for (auto&& crate : db.root_crates())  // Assume already sorted
  {
    if (name > crate.name())
    {
      return db.create_root_crate_after(name, crate);
    }
  }

  return db.create_root_crate(name);
}

At present this is only implemented for Engine V2, which makes the process easy via its DB triggers. The DB schema in Engine V1 would require a little extra work that is not high priority now, given that Engine 1.x is not readily used any longer.

Fixes #117.

@mr-smidge mr-smidge self-assigned this Apr 2, 2024
@mr-smidge mr-smidge changed the title Create crates in order Create crates in order (for Engine V2) Apr 2, 2024
@mr-smidge mr-smidge merged commit f34a8fb into main Apr 4, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow sorted insert of crates in high-level API
1 participant