-
Notifications
You must be signed in to change notification settings - Fork 106
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
Add support for adding metadata/attachments #614
Conversation
todo:
|
die("Unexpected number of args") | ||
} | ||
filename := args[0] | ||
err := utils.WithReader(ctx, filename, func(_ bool, rs io.ReadSeeker) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in general, the run commands in this patch are too heavy. It would be easier to test if these dispatched to standalone functions.
99c5027
to
870e338
Compare
870e338
to
e393a96
Compare
go/cli/mcap/utils/utils.go
Outdated
@@ -111,10 +115,152 @@ func FormatTable(w io.Writer, rows [][]string) { | |||
tw.Render() | |||
} | |||
|
|||
func inferWriterOptions(info *mcap.Info) *mcap.WriterOptions { | |||
// assume if there are no chunk indexes, the file is not chunked |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this assumption fail on an unindexed file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the file is chunked but not indexed, yeah it'll fail. I think though the only way to guard against that would be to scan the entire file to see if a chunk is present. I'm not sure that's worth it, but it's something we could do.
This is where it would be handy to have the writer options in the header.
52a1b5a
to
d49a81d
Compare
Adds support for adding and getting metadata and attachments from an existing mcap file. To add an attachment to a file, mcap add attachment demo.mcap -f Makefile To get an attachment out of the file, mcap get attachment demo.mcap -n Makefile -o attachment.txt To add metadata to a file, mcap add metadata demo.mcap -k foo=bar -k bar=baz -n "my metadata" To get metadata out of the file, mcap get metadata demo.mcap -n "my metadata" { "bar": "baz", "foo": "bar" } Also fixes a bug in the list attachments subcommand. Previously this was listing chunks.
d49a81d
to
1f66244
Compare
Add support for adding metadata/attachments
Adds support for adding and getting metadata and attachments from an
existing mcap file. To add an attachment to a file,
To get an attachment out of the file,
To add metadata to a file,
To get metadata out of the file,
Also fixes a bug in the list attachments subcommand. Previously this was
listing chunks.
Fixes: #434
Fixes: #372