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

Write in existing MCAP #5

Open
jdsika opened this issue Nov 15, 2024 · 3 comments
Open

Write in existing MCAP #5

jdsika opened this issue Nov 15, 2024 · 3 comments
Assignees

Comments

@jdsika
Copy link
Contributor

jdsika commented Nov 15, 2024

  • Use osi version in schema name in order to make sure that the schema was not already registered
  • Read existing schemas
  • Can schemas have the same name?
@ClemensLinnhoff
Copy link
Collaborator

Let's wait for merge of initial PR, then implement this on separate branch.

@jdsika
Copy link
Contributor Author

jdsika commented Dec 2, 2024

This method must be adapted to read exisitng meta data and adapt:

mcap::Metadata MCAPTraceFileWriter::PrepareRequiredFileMetadata() {
    mcap::Metadata metadata;
    metadata.name = "net.asam.osi.trace";

    const auto osi_version = osi3::InterfaceVersion::descriptor()->file()->options().GetExtension(osi3::current_interface_version);
    const auto osi_version_string =
        std::to_string(osi_version.version_major()) + "." + std::to_string(osi_version.version_minor()) + "." + std::to_string(osi_version.version_patch());
    metadata.metadata["version"] = osi_version_string;
    metadata.metadata["min_osi_version"] = osi_version_string;
    metadata.metadata["max_osi_version"] = osi_version_string;
    metadata.metadata["min_protobuf_version"] = google::protobuf::internal::VersionString(GOOGLE_PROTOBUF_VERSION);
    metadata.metadata["max_protobuf_version"] = google::protobuf::internal::VersionString(GOOGLE_PROTOBUF_VERSION);

    return metadata;
}

@TimmRuppert
Copy link
Collaborator

According to my understanding it is not possible to add data to an existing MCAP file in-place

We tend to view mcap files as append-only, write once, robot log files rather than "database" files which you can go back and modify.
foxglove/mcap#1084 (reply in thread)

Nonetheless, it would be possible to create a complete new trace file, add data and replace the existing file.

In any case, I am not sure where to add it. The writer would require a lot of changes to handle something like this transparently (e.g. the user simple using the Open() function on an existing trace file). I would argue for an new MCAPTraceFileAppender class.

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

No branches or pull requests

3 participants