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

nsqd: use metadata struct for both marshal and unmarshal #1380

Merged
merged 1 commit into from
Aug 2, 2022
Merged

nsqd: use metadata struct for both marshal and unmarshal #1380

merged 1 commit into from
Aug 2, 2022

Conversation

karalabe
Copy link
Contributor

@karalabe karalabe commented Oct 19, 2021

Metadata marshaling currently is done via a map containing untyped interfaces, which is unfortunate given that the code also contains a meta type used during unmarshaling.

This commit elevates the old meta type a bit to be used during both operations. The changeste also exposes a GetMetadata method to return the same metadata type without pushing it to disk. This is useful for use cases where NSQD is embedded into another Go program and some introspection is needed.

@karalabe
Copy link
Contributor Author

Hmm, I've seen that I can list all the topics by specifying "" for nsqd.GetStatus, so maybe this PR is not that useful at the end of the day. Still, might be a nice code cleanup to use a data struct on marshaling too vs. making a map of interfaces.

Copy link
Member

@mreiferson mreiferson left a comment

Choose a reason for hiding this comment

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

I think this is fine to land after the minor fix, thanks.

nsqd/nsqd.go Outdated Show resolved Hide resolved
Metadata marshaling currently is done via a map containing untyped
interfaces, which is unfortunate given that the code also contains
a `meta` type used during unmarshaling.

This commit elevates the old `meta` type a bit to be used during
both operations. The changeste also exposes a GetMetadata method
to return the same metadata type without pushing it to disk. This
is useful for use cases where NSQD is embedded into another Go
program and some introspection is needed.
@mreiferson
Copy link
Member

updated this myself

@mreiferson mreiferson merged commit ae2e77a into nsqio:master Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants